Use better time functionality
This commit is contained in:
parent
5d0c674d1d
commit
67b0b19bca
|
@ -1308,7 +1308,7 @@ def backup_vm(
|
||||||
zkhandler, domain, target_path, incremental_parent=None, retain_snapshots=False
|
zkhandler, domain, target_path, incremental_parent=None, retain_snapshots=False
|
||||||
):
|
):
|
||||||
|
|
||||||
tstart = datetime.now()
|
tstart = time.time()
|
||||||
|
|
||||||
# 0. Validations
|
# 0. Validations
|
||||||
# Validate that VM exists in cluster
|
# Validate that VM exists in cluster
|
||||||
|
@ -1454,8 +1454,8 @@ def backup_vm(
|
||||||
which_snapshot_remove_failed.append(f"{pool}/{volume}")
|
which_snapshot_remove_failed.append(f"{pool}/{volume}")
|
||||||
msg_snapshot_remove_failed.append(retmsg)
|
msg_snapshot_remove_failed.append(retmsg)
|
||||||
|
|
||||||
tend = datetime.now()
|
tend = time.time()
|
||||||
ttot = (tend - tstart).total_seconds()
|
ttot = round(tend - tstart, 2)
|
||||||
|
|
||||||
if is_snapshot_remove_failed:
|
if is_snapshot_remove_failed:
|
||||||
return (
|
return (
|
||||||
|
@ -1465,5 +1465,5 @@ def backup_vm(
|
||||||
|
|
||||||
return (
|
return (
|
||||||
True,
|
True,
|
||||||
f"Successfully backed up VM {domain} ({backup_type} @ {datestring}) to {target_path} in {ttot} seconds",
|
f"Successfully backed up VM {domain} ({backup_type} @ {datestring}) to {target_path} in {ttot} seconds.",
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue