Merge branch 'master' of git.qubes-os.org:/var/lib/qubes/git/marmarek/core

This commit is contained in:
Joanna Rutkowska 2011-09-13 19:22:16 +02:00
commit d5576ce77f
3 changed files with 21 additions and 12 deletions

View File

@ -502,10 +502,10 @@ class QubesVm(object):
if dominfo: if dominfo:
if dominfo['paused']: if dominfo['paused']:
return "Paused" return "Paused"
elif dominfo['shutdown']:
return "Halted"
elif dominfo['crashed']: elif dominfo['crashed']:
return "Crashed" return "Crashed"
elif dominfo['shutdown']:
return "Halting"
elif dominfo['dying']: elif dominfo['dying']:
return "Dying" return "Dying"
else: else:
@ -988,7 +988,8 @@ class QubesVm(object):
if dry_run: if dry_run:
return return
if self.is_running(): # Intentionally not used is_running(): eliminate also "Paused", "Crashed", "Halting"
if self.get_power_state() != "Halted":
raise QubesException ("VM is already running!") raise QubesException ("VM is already running!")
if self.netvm_vm is not None: if self.netvm_vm is not None:

View File

@ -87,7 +87,7 @@ def main():
files_to_backup = file_to_backup (qubes_store_filename) files_to_backup = file_to_backup (qubes_store_filename)
appvms_to_backup = [vm for vm in vms_list if vm.is_appvm() and not vm.name.endswith('-dvm')] appvms_to_backup = [vm for vm in vms_list if vm.is_appvm() and not vm.internal]
netvms_to_backup = [vm for vm in vms_list if vm.is_netvm() and not vm.qid == 0] netvms_to_backup = [vm for vm in vms_list if vm.is_netvm() and not vm.qid == 0]
there_are_running_vms = False there_are_running_vms = False

View File

@ -57,7 +57,8 @@ fields = {
+ ('}' if vm.is_netvm() else '')"}, + ('}' if vm.is_netvm() else '')"},
"type": {"func": "'Tpl' if vm.is_template() else \ "type": {"func": "'Tpl' if vm.is_template() else \
(' Net' if vm.is_netvm() else 'App')"}, ('Proxy' if vm.is_proxyvm() else \
(' Net' if vm.is_netvm() else 'App'))"},
"updbl" : {"func": "'Yes' if vm.is_updateable() else ''"}, "updbl" : {"func": "'Yes' if vm.is_updateable() else ''"},
@ -331,7 +332,7 @@ def main():
# ... then NetVMs... # ... then NetVMs...
for vm in [ vm for vm in vms_to_restore if vm.is_netvm()]: for vm in [ vm for vm in vms_to_restore if vm.is_netvm()]:
print "-> Restoring NetVM {0}...".format(vm.name) print "-> Restoring {0} {1}...".format(vm.type, vm.name)
retcode = subprocess.call (["mkdir", "-p", vm.dir_path]) retcode = subprocess.call (["mkdir", "-p", vm.dir_path])
if retcode != 0: if retcode != 0:
print ("*** Cannot create directory: {0}?!".format(dest_dir)) print ("*** Cannot create directory: {0}?!".format(dest_dir))
@ -354,11 +355,18 @@ def main():
updateable = vm.updateable updateable = vm.updateable
try: try:
vm = host_collection.add_new_netvm(vm.name, template_vm, if vm.type == "NetVM":
conf_file=vm.conf_file, vm = host_collection.add_new_netvm(vm.name, template_vm,
dir_path=vm.dir_path, conf_file=vm.conf_file,
updateable=updateable, dir_path=vm.dir_path,
label=vm.label) updateable=updateable,
label=vm.label)
elif vm.type == "ProxyVM":
vm = host_collection.add_new_proxyvm(vm.name, template_vm,
conf_file=vm.conf_file,
dir_path=vm.dir_path,
updateable=updateable,
label=vm.label)
except Exception as err: except Exception as err:
print "ERROR: {0}".format(err) print "ERROR: {0}".format(err)
print "*** Skiping VM: {0}".format(vm.name) print "*** Skiping VM: {0}".format(vm.name)
@ -366,7 +374,7 @@ def main():
host_collection.pop(vm.qid) host_collection.pop(vm.qid)
continue continue
if not uses_default_netvm: if vm.is_proxyvm() and not uses_default_netvm:
vm.uses_default_netvm = False vm.uses_default_netvm = False
vm.netvm_vm = netvm_vm vm.netvm_vm = netvm_vm