qvm-tools: display date of last backup

This commit is contained in:
Marek Marczykowski-Górecki 2014-03-10 04:29:46 +01:00
parent 09652cb0f8
commit 61c10d7621
2 changed files with 12 additions and 1 deletions

View File

@ -80,7 +80,10 @@ fields = {
"kernel" : {"func" : "('*' if vm.uses_default_kernel else '') + str(vm.kernel) if hasattr(vm, 'kernel') else 'n/a'"}, "kernel" : {"func" : "('*' if vm.uses_default_kernel else '') + str(vm.kernel) if hasattr(vm, 'kernel') else 'n/a'"},
"kernelopts" : {"func" : "('*' if vm.uses_default_kernelopts else '') + str(vm.kernelopts) if hasattr(vm, 'kernelopts') else 'n/a'"}, "kernelopts" : {"func" : "('*' if vm.uses_default_kernelopts else '') + str(vm.kernelopts) if hasattr(vm, 'kernelopts') else 'n/a'"},
"on" : {"func" : "'*' if vm.is_running() else ''"} "on" : {"func" : "'*' if vm.is_running() else ''"},
"last backup" : {"func": "str(vm.backup_timestamp.date()) if "
"vm.backup_timestamp else '-'"},
} }
@ -114,6 +117,10 @@ def main():
action="store_true", default=False, action="store_true", default=False,
help="Show Qubes and Xen id#s") help="Show Qubes and Xen id#s")
parser.add_option("-b", "--last-backup", dest="backup",
action="store_true", default=False,
help="Show date of last VM backup")
(options, args) = parser.parse_args () (options, args) = parser.parse_args ()
@ -137,6 +144,9 @@ def main():
if (options.mem): if (options.mem):
fields_to_display += ["mem"] fields_to_display += ["mem"]
if options.backup:
fields_to_display += ["last backup"]
if (options.network): if (options.network):
if 'template' in fields_to_display: if 'template' in fields_to_display:
fields_to_display.remove ("template") fields_to_display.remove ("template")

View File

@ -45,6 +45,7 @@ def do_list(vm):
print fmt.format ("autostart", vm.autostart) print fmt.format ("autostart", vm.autostart)
print fmt.format ("installed_by_rpm", vm.installed_by_rpm) print fmt.format ("installed_by_rpm", vm.installed_by_rpm)
print fmt.format ("include_in_backups", vm.include_in_backups) print fmt.format ("include_in_backups", vm.include_in_backups)
print fmt.format ("last_backup", vm.backup_timestamp)
print fmt.format ("dir", vm.dir_path) print fmt.format ("dir", vm.dir_path)
print fmt.format ("config", vm.conf_file) print fmt.format ("config", vm.conf_file)
print fmt.format ("pcidevs", vm.pcidevs) print fmt.format ("pcidevs", vm.pcidevs)