dom0/qvm-core: output messages to stderr (#276)
This commit is contained in:
parent
9152bf6652
commit
98827c7020
@ -280,10 +280,10 @@ class QubesVm(object):
|
|||||||
self.template_vm = template_vm
|
self.template_vm = template_vm
|
||||||
if template_vm is not None:
|
if template_vm is not None:
|
||||||
if updateable:
|
if updateable:
|
||||||
print "ERROR: Template based VM cannot be updateable!"
|
print >> sys.stderr, "ERROR: Template based VM cannot be updateable!"
|
||||||
return False
|
return False
|
||||||
if not template_vm.is_template():
|
if not template_vm.is_template():
|
||||||
print "ERROR: template_qid={0} doesn't point to a valid TemplateVM".\
|
print >> sys.stderr, "ERROR: template_qid={0} doesn't point to a valid TemplateVM".\
|
||||||
format(template_vm.qid)
|
format(template_vm.qid)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -733,17 +733,17 @@ class QubesVm(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Creating directory: {0}".format(self.dir_path)
|
print >> sys.stderr, "--> Creating directory: {0}".format(self.dir_path)
|
||||||
os.mkdir (self.dir_path)
|
os.mkdir (self.dir_path)
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Creating the VM config file: {0}".format(self.conf_file)
|
print >> sys.stderr, "--> Creating the VM config file: {0}".format(self.conf_file)
|
||||||
|
|
||||||
self.create_config_file(source_template = source_template)
|
self.create_config_file(source_template = source_template)
|
||||||
|
|
||||||
template_priv = source_template.private_img
|
template_priv = source_template.private_img
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's private image: {0}".\
|
print >> sys.stderr, "--> Copying the template's private image: {0}".\
|
||||||
format(template_priv)
|
format(template_priv)
|
||||||
|
|
||||||
# We prefer to use Linux's cp, because it nicely handles sparse files
|
# We prefer to use Linux's cp, because it nicely handles sparse files
|
||||||
@ -754,7 +754,7 @@ class QubesVm(object):
|
|||||||
|
|
||||||
if os.path.exists(source_template.dir_path + '/vm-' + qubes_whitelisted_appmenus):
|
if os.path.exists(source_template.dir_path + '/vm-' + qubes_whitelisted_appmenus):
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Creating default whitelisted apps list: {0}".\
|
print >> sys.stderr, "--> Creating default whitelisted apps list: {0}".\
|
||||||
format(self.dir_path + '/' + qubes_whitelisted_appmenus)
|
format(self.dir_path + '/' + qubes_whitelisted_appmenus)
|
||||||
shutil.copy(source_template.dir_path + '/vm-' + qubes_whitelisted_appmenus,
|
shutil.copy(source_template.dir_path + '/vm-' + qubes_whitelisted_appmenus,
|
||||||
self.dir_path + '/' + qubes_whitelisted_appmenus)
|
self.dir_path + '/' + qubes_whitelisted_appmenus)
|
||||||
@ -762,7 +762,7 @@ class QubesVm(object):
|
|||||||
if self.is_updateable():
|
if self.is_updateable():
|
||||||
template_root = source_template.root_img
|
template_root = source_template.root_img
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's root image: {0}".\
|
print >> sys.stderr, "--> Copying the template's root image: {0}".\
|
||||||
format(template_root)
|
format(template_root)
|
||||||
|
|
||||||
# We prefer to use Linux's cp, because it nicely handles sparse files
|
# We prefer to use Linux's cp, because it nicely handles sparse files
|
||||||
@ -773,7 +773,7 @@ class QubesVm(object):
|
|||||||
|
|
||||||
kernels_dir = source_template.kernels_dir
|
kernels_dir = source_template.kernels_dir
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the kernel (set kernel \"none\" to use it): {0}".\
|
print >> sys.stderr, "--> Copying the kernel (set kernel \"none\" to use it): {0}".\
|
||||||
format(kernels_dir)
|
format(kernels_dir)
|
||||||
|
|
||||||
os.mkdir (self.dir_path + '/kernels')
|
os.mkdir (self.dir_path + '/kernels')
|
||||||
@ -802,7 +802,7 @@ class QubesVm(object):
|
|||||||
# Only add apps to menu
|
# Only add apps to menu
|
||||||
subprocess.check_call ([qubes_appmenu_create_cmd, "none", self.name, vmtype])
|
subprocess.check_call ([qubes_appmenu_create_cmd, "none", self.name, vmtype])
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print "Ooops, there was a problem creating appmenus for {0} VM!".format (self.name)
|
print >> sys.stderr, "Ooops, there was a problem creating appmenus for {0} VM!".format (self.name)
|
||||||
|
|
||||||
def verify_files(self):
|
def verify_files(self):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
@ -850,7 +850,7 @@ class QubesVm(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Cleaning volatile image: {0}...".format (self.volatile_img)
|
print >> sys.stderr, "--> Cleaning volatile image: {0}...".format (self.volatile_img)
|
||||||
if dry_run:
|
if dry_run:
|
||||||
return
|
return
|
||||||
if os.path.exists (self.volatile_img):
|
if os.path.exists (self.volatile_img):
|
||||||
@ -899,7 +899,7 @@ class QubesVm(object):
|
|||||||
fcntl.lockf(f, fcntl.LOCK_UN)
|
fcntl.lockf(f, fcntl.LOCK_UN)
|
||||||
f.close()
|
f.close()
|
||||||
except EnvironmentError as err:
|
except EnvironmentError as err:
|
||||||
print "{0}: save error: {1}".format(
|
print >> sys.stderr, "{0}: save error: {1}".format(
|
||||||
os.path.basename(sys.argv[0]), err)
|
os.path.basename(sys.argv[0]), err)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -969,20 +969,20 @@ class QubesVm(object):
|
|||||||
if netvm.qid != 0:
|
if netvm.qid != 0:
|
||||||
if not netvm.is_running():
|
if not netvm.is_running():
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Starting NetVM {0}...".format(netvm.name)
|
print >> sys.stderr, "--> Starting NetVM {0}...".format(netvm.name)
|
||||||
netvm.start()
|
netvm.start()
|
||||||
|
|
||||||
xs_path = '/local/domain/%d/device/vif/0/state' % (self.xid)
|
xs_path = '/local/domain/%d/device/vif/0/state' % (self.xid)
|
||||||
if xs.read('', xs_path) is not None:
|
if xs.read('', xs_path) is not None:
|
||||||
# TODO: check its state and backend state (this can be stale vif after NetVM restart)
|
# TODO: check its state and backend state (this can be stale vif after NetVM restart)
|
||||||
if verbose:
|
if verbose:
|
||||||
print "NOTICE: Network already attached"
|
print >> sys.stderr, "NOTICE: Network already attached"
|
||||||
return
|
return
|
||||||
|
|
||||||
xm_cmdline = ["/usr/sbin/xl", "network-attach", str(self.xid), "script=/etc/xen/scripts/vif-route-qubes", "ip="+self.ip, "backend="+netvm.name ]
|
xm_cmdline = ["/usr/sbin/xl", "network-attach", str(self.xid), "script=/etc/xen/scripts/vif-route-qubes", "ip="+self.ip, "backend="+netvm.name ]
|
||||||
retcode = subprocess.call (xm_cmdline)
|
retcode = subprocess.call (xm_cmdline)
|
||||||
if retcode != 0:
|
if retcode != 0:
|
||||||
print ("WARNING: Cannot attach to network to '{0}'!".format(self.name))
|
print >> sys.stderr, ("WARNING: Cannot attach to network to '{0}'!".format(self.name))
|
||||||
if wait:
|
if wait:
|
||||||
tries = 0
|
tries = 0
|
||||||
while xs.read('', xs_path) != '4':
|
while xs.read('', xs_path) != '4':
|
||||||
@ -1003,12 +1003,12 @@ class QubesVm(object):
|
|||||||
if self.netvm_vm.qid != 0:
|
if self.netvm_vm.qid != 0:
|
||||||
if not self.netvm_vm.is_running():
|
if not self.netvm_vm.is_running():
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Starting NetVM {0}...".format(self.netvm_vm.name)
|
print >> sys.stderr, "--> Starting NetVM {0}...".format(self.netvm_vm.name)
|
||||||
self.netvm_vm.start()
|
self.netvm_vm.start()
|
||||||
|
|
||||||
self.reset_volatile_storage(verbose=verbose)
|
self.reset_volatile_storage(verbose=verbose)
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Loading the VM (type = {0})...".format(self.type)
|
print >> sys.stderr, "--> Loading the VM (type = {0})...".format(self.type)
|
||||||
|
|
||||||
# refresh config file
|
# refresh config file
|
||||||
self.create_config_file()
|
self.create_config_file()
|
||||||
@ -1034,7 +1034,7 @@ class QubesVm(object):
|
|||||||
self.xid = xid
|
self.xid = xid
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Setting Xen Store info for the VM..."
|
print >> sys.stderr, "--> Setting Xen Store info for the VM..."
|
||||||
self.create_xenstore_entries(xid)
|
self.create_xenstore_entries(xid)
|
||||||
|
|
||||||
qvm_collection = QubesVmCollection()
|
qvm_collection = QubesVmCollection()
|
||||||
@ -1043,18 +1043,18 @@ class QubesVm(object):
|
|||||||
qvm_collection.unlock_db()
|
qvm_collection.unlock_db()
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Updating firewall rules..."
|
print >> sys.stderr, "--> Updating firewall rules..."
|
||||||
for vm in qvm_collection.values():
|
for vm in qvm_collection.values():
|
||||||
if vm.is_proxyvm() and vm.is_running():
|
if vm.is_proxyvm() and vm.is_running():
|
||||||
vm.write_iptables_xenstore_entry()
|
vm.write_iptables_xenstore_entry()
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Starting the VM..."
|
print >> sys.stderr, "--> Starting the VM..."
|
||||||
xc.domain_unpause(xid)
|
xc.domain_unpause(xid)
|
||||||
|
|
||||||
if not preparing_dvm:
|
if not preparing_dvm:
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Starting the qrexec daemon..."
|
print >> sys.stderr, "--> Starting the qrexec daemon..."
|
||||||
retcode = subprocess.call ([qrexec_daemon_path, str(xid)])
|
retcode = subprocess.call ([qrexec_daemon_path, str(xid)])
|
||||||
if (retcode != 0) :
|
if (retcode != 0) :
|
||||||
self.force_shutdown()
|
self.force_shutdown()
|
||||||
@ -1069,7 +1069,7 @@ class QubesVm(object):
|
|||||||
|
|
||||||
if preparing_dvm:
|
if preparing_dvm:
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Preparing config template for DispVM"
|
print >> sys.stderr, "--> Preparing config template for DispVM"
|
||||||
self.create_config_file(file_path = self.dir_path + '/dvm.conf', prepare_dvm = True)
|
self.create_config_file(file_path = self.dir_path + '/dvm.conf', prepare_dvm = True)
|
||||||
|
|
||||||
# perhaps we should move it before unpause and fork?
|
# perhaps we should move it before unpause and fork?
|
||||||
@ -1077,7 +1077,7 @@ class QubesVm(object):
|
|||||||
if debug_console:
|
if debug_console:
|
||||||
from xen.xm import console
|
from xen.xm import console
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Starting debug console..."
|
print >> sys.stderr, "--> Starting debug console..."
|
||||||
console.execConsole (xid)
|
console.execConsole (xid)
|
||||||
|
|
||||||
return xid
|
return xid
|
||||||
@ -1190,11 +1190,11 @@ class QubesTemplateVm(QubesVm):
|
|||||||
assert not src_template_vm.is_running(), "Attempt to clone a running Template VM!"
|
assert not src_template_vm.is_running(), "Attempt to clone a running Template VM!"
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Creating directory: {0}".format(self.dir_path)
|
print >> sys.stderr, "--> Creating directory: {0}".format(self.dir_path)
|
||||||
os.mkdir (self.dir_path)
|
os.mkdir (self.dir_path)
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's private image:\n{0} ==>\n{1}".\
|
print >> sys.stderr, "--> Copying the template's private image:\n{0} ==>\n{1}".\
|
||||||
format(src_template_vm.private_img, self.private_img)
|
format(src_template_vm.private_img, self.private_img)
|
||||||
# We prefer to use Linux's cp, because it nicely handles sparse files
|
# We prefer to use Linux's cp, because it nicely handles sparse files
|
||||||
retcode = subprocess.call (["cp", src_template_vm.private_img, self.private_img])
|
retcode = subprocess.call (["cp", src_template_vm.private_img, self.private_img])
|
||||||
@ -1203,7 +1203,7 @@ class QubesTemplateVm(QubesVm):
|
|||||||
format(src_template_vm.private_img, self.private_img))
|
format(src_template_vm.private_img, self.private_img))
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's root image:\n{0} ==>\n{1}".\
|
print >> sys.stderr, "--> Copying the template's root image:\n{0} ==>\n{1}".\
|
||||||
format(src_template_vm.root_img, self.root_img)
|
format(src_template_vm.root_img, self.root_img)
|
||||||
# We prefer to use Linux's cp, because it nicely handles sparse files
|
# We prefer to use Linux's cp, because it nicely handles sparse files
|
||||||
retcode = subprocess.call (["cp", src_template_vm.root_img, self.root_img])
|
retcode = subprocess.call (["cp", src_template_vm.root_img, self.root_img])
|
||||||
@ -1211,7 +1211,7 @@ class QubesTemplateVm(QubesVm):
|
|||||||
raise IOError ("Error while copying {0} to {1}".\
|
raise IOError ("Error while copying {0} to {1}".\
|
||||||
format(src_template_vm.root_img, self.root_img))
|
format(src_template_vm.root_img, self.root_img))
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's clean volatile image:\n{0} ==>\n{1}".\
|
print >> sys.stderr, "--> Copying the template's clean volatile image:\n{0} ==>\n{1}".\
|
||||||
format(src_template_vm.clean_volatile_img, self.clean_volatile_img)
|
format(src_template_vm.clean_volatile_img, self.clean_volatile_img)
|
||||||
# We prefer to use Linux's cp, because it nicely handles sparse files
|
# We prefer to use Linux's cp, because it nicely handles sparse files
|
||||||
retcode = subprocess.call (["cp", src_template_vm.clean_volatile_img, self.clean_volatile_img])
|
retcode = subprocess.call (["cp", src_template_vm.clean_volatile_img, self.clean_volatile_img])
|
||||||
@ -1219,7 +1219,7 @@ class QubesTemplateVm(QubesVm):
|
|||||||
raise IOError ("Error while copying {0} to {1}".\
|
raise IOError ("Error while copying {0} to {1}".\
|
||||||
format(src_template_vm.clean_volatile_img, self.clean_volatile_img))
|
format(src_template_vm.clean_volatile_img, self.clean_volatile_img))
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's volatile image:\n{0} ==>\n{1}".\
|
print >> sys.stderr, "--> Copying the template's volatile image:\n{0} ==>\n{1}".\
|
||||||
format(self.clean_volatile_img, self.volatile_img)
|
format(self.clean_volatile_img, self.volatile_img)
|
||||||
# We prefer to use Linux's cp, because it nicely handles sparse files
|
# We prefer to use Linux's cp, because it nicely handles sparse files
|
||||||
retcode = subprocess.call (["cp", self.clean_volatile_img, self.volatile_img])
|
retcode = subprocess.call (["cp", self.clean_volatile_img, self.volatile_img])
|
||||||
@ -1228,33 +1228,33 @@ class QubesTemplateVm(QubesVm):
|
|||||||
format(self.clean_volatile_img, self.volatile_img))
|
format(self.clean_volatile_img, self.volatile_img))
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's DispVM prerun script..."
|
print >> sys.stderr, "--> Copying the template's DispVM prerun script..."
|
||||||
retcode = subprocess.call (["cp", src_template_vm.dir_path + '/dispvm-prerun.sh', self.dir_path + '/dispvm-prerun.sh'])
|
retcode = subprocess.call (["cp", src_template_vm.dir_path + '/dispvm-prerun.sh', self.dir_path + '/dispvm-prerun.sh'])
|
||||||
if retcode != 0:
|
if retcode != 0:
|
||||||
raise IOError ("Error while copying DispVM prerun script")
|
raise IOError ("Error while copying DispVM prerun script")
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}".\
|
print >> sys.stderr, "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}".\
|
||||||
format(src_template_vm.appmenus_templates_dir, self.appmenus_templates_dir)
|
format(src_template_vm.appmenus_templates_dir, self.appmenus_templates_dir)
|
||||||
shutil.copytree (src_template_vm.appmenus_templates_dir, self.appmenus_templates_dir)
|
shutil.copytree (src_template_vm.appmenus_templates_dir, self.appmenus_templates_dir)
|
||||||
|
|
||||||
if os.path.exists(src_template_vm.dir_path + '/' + qubes_whitelisted_appmenus):
|
if os.path.exists(src_template_vm.dir_path + '/' + qubes_whitelisted_appmenus):
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying whitelisted apps list: {0}".\
|
print >> sys.stderr, "--> Copying whitelisted apps list: {0}".\
|
||||||
format(self.dir_path + '/' + qubes_whitelisted_appmenus)
|
format(self.dir_path + '/' + qubes_whitelisted_appmenus)
|
||||||
shutil.copy(src_template_vm.dir_path + '/' + qubes_whitelisted_appmenus,
|
shutil.copy(src_template_vm.dir_path + '/' + qubes_whitelisted_appmenus,
|
||||||
self.dir_path + '/' + qubes_whitelisted_appmenus)
|
self.dir_path + '/' + qubes_whitelisted_appmenus)
|
||||||
|
|
||||||
if os.path.exists(src_template_vm.dir_path + '/vm-' + qubes_whitelisted_appmenus):
|
if os.path.exists(src_template_vm.dir_path + '/vm-' + qubes_whitelisted_appmenus):
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying default whitelisted apps list: {0}".\
|
print >> sys.stderr, "--> Copying default whitelisted apps list: {0}".\
|
||||||
format(self.dir_path + '/vm-' + qubes_whitelisted_appmenus)
|
format(self.dir_path + '/vm-' + qubes_whitelisted_appmenus)
|
||||||
shutil.copy(src_template_vm.dir_path + '/vm-' + qubes_whitelisted_appmenus,
|
shutil.copy(src_template_vm.dir_path + '/vm-' + qubes_whitelisted_appmenus,
|
||||||
self.dir_path + '/vm-' + qubes_whitelisted_appmenus)
|
self.dir_path + '/vm-' + qubes_whitelisted_appmenus)
|
||||||
|
|
||||||
icon_path = "/usr/share/qubes/icons/template.png"
|
icon_path = "/usr/share/qubes/icons/template.png"
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Creating icon symlink: {0} -> {1}".format(self.icon_path, icon_path)
|
print >> sys.stderr, "--> Creating icon symlink: {0} -> {1}".format(self.icon_path, icon_path)
|
||||||
os.symlink (icon_path, self.icon_path)
|
os.symlink (icon_path, self.icon_path)
|
||||||
|
|
||||||
# Create root-cow.img
|
# Create root-cow.img
|
||||||
@ -1270,7 +1270,7 @@ class QubesTemplateVm(QubesVm):
|
|||||||
try:
|
try:
|
||||||
subprocess.check_call ([qubes_appmenu_create_cmd, self.appmenus_templates_dir, self.name, "vm-templates"])
|
subprocess.check_call ([qubes_appmenu_create_cmd, self.appmenus_templates_dir, self.name, "vm-templates"])
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print "Ooops, there was a problem creating appmenus for {0} VM!".format (self.name)
|
print >> sys.stderr, "Ooops, there was a problem creating appmenus for {0} VM!".format (self.name)
|
||||||
|
|
||||||
def remove_from_disk(self):
|
def remove_from_disk(self):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
@ -1333,7 +1333,7 @@ class QubesTemplateVm(QubesVm):
|
|||||||
assert not self.is_running(), "Attempt to clean volatile image of running Template VM!"
|
assert not self.is_running(), "Attempt to clean volatile image of running Template VM!"
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Cleaning volatile image: {0}...".format (self.volatile_img)
|
print >> sys.stderr, "--> Cleaning volatile image: {0}...".format (self.volatile_img)
|
||||||
if dry_run:
|
if dry_run:
|
||||||
return
|
return
|
||||||
if os.path.exists (self.volatile_img):
|
if os.path.exists (self.volatile_img):
|
||||||
@ -1349,7 +1349,7 @@ class QubesTemplateVm(QubesVm):
|
|||||||
assert not self.is_running(), "Attempt to commit changes on running Template VM!"
|
assert not self.is_running(), "Attempt to commit changes on running Template VM!"
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Commiting template updates... COW: {0}...".format (self.rootcow_img)
|
print >> sys.stderr, "--> Commiting template updates... COW: {0}...".format (self.rootcow_img)
|
||||||
|
|
||||||
if dry_run:
|
if dry_run:
|
||||||
return
|
return
|
||||||
@ -1473,7 +1473,7 @@ class QubesNetVm(QubesVm):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Attaching network to '{0}'...".format(vm.name)
|
print >> sys.stderr, "--> Attaching network to '{0}'...".format(vm.name)
|
||||||
|
|
||||||
# Cleanup stale VIFs
|
# Cleanup stale VIFs
|
||||||
vm.cleanup_vifs()
|
vm.cleanup_vifs()
|
||||||
@ -1484,7 +1484,7 @@ class QubesNetVm(QubesVm):
|
|||||||
try:
|
try:
|
||||||
vm.attach_network(wait=False)
|
vm.attach_network(wait=False)
|
||||||
except QubesException as ex:
|
except QubesException as ex:
|
||||||
print ("WARNING: Cannot attach to network to '{0}': {1}".format(vm.name, ex))
|
print >> sys.stderr, ("WARNING: Cannot attach to network to '{0}': {1}".format(vm.name, ex))
|
||||||
|
|
||||||
return xid
|
return xid
|
||||||
|
|
||||||
@ -1756,12 +1756,12 @@ class QubesAppVm(QubesVm):
|
|||||||
|
|
||||||
if self.is_updateable():
|
if self.is_updateable():
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}".\
|
print >> sys.stderr, "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}".\
|
||||||
format(source_template.appmenus_templates_dir, self.appmenus_templates_dir)
|
format(source_template.appmenus_templates_dir, self.appmenus_templates_dir)
|
||||||
shutil.copytree (source_template.appmenus_templates_dir, self.appmenus_templates_dir)
|
shutil.copytree (source_template.appmenus_templates_dir, self.appmenus_templates_dir)
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print "--> Creating icon symlink: {0} -> {1}".format(self.icon_path, self.label.icon_path)
|
print >> sys.stderr, "--> Creating icon symlink: {0} -> {1}".format(self.icon_path, self.label.icon_path)
|
||||||
os.symlink (self.label.icon_path, self.icon_path)
|
os.symlink (self.label.icon_path, self.icon_path)
|
||||||
|
|
||||||
if not self.internal:
|
if not self.internal:
|
||||||
@ -2028,14 +2028,14 @@ class QubesVmCollection(dict):
|
|||||||
# Verify that qid is unique
|
# Verify that qid is unique
|
||||||
for vm in self.values():
|
for vm in self.values():
|
||||||
if vm.qid == new_vm.qid:
|
if vm.qid == new_vm.qid:
|
||||||
print "ERROR: The qid={0} is already used by VM '{1}'!".\
|
print >> sys.stderr, "ERROR: The qid={0} is already used by VM '{1}'!".\
|
||||||
format(vm.qid, vm.name)
|
format(vm.qid, vm.name)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Verify that name is unique
|
# Verify that name is unique
|
||||||
for vm in self.values():
|
for vm in self.values():
|
||||||
if vm.name == new_vm.name:
|
if vm.name == new_vm.name:
|
||||||
print "ERROR: The name={0} is already used by other VM with qid='{1}'!".\
|
print >> sys.stderr, "ERROR: The name={0} is already used by other VM with qid='{1}'!".\
|
||||||
format(vm.name, vm.qid)
|
format(vm.name, vm.qid)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -2154,14 +2154,14 @@ class QubesVmCollection(dict):
|
|||||||
kwargs["template_qid"] = int(kwargs["template_qid"])
|
kwargs["template_qid"] = int(kwargs["template_qid"])
|
||||||
template_vm = self[kwargs.pop("template_qid")]
|
template_vm = self[kwargs.pop("template_qid")]
|
||||||
if template_vm is None:
|
if template_vm is None:
|
||||||
print "ERROR: VM '{0}' uses unkown template qid='{1}'!".\
|
print >> sys.stderr, "ERROR: VM '{0}' uses unkown template qid='{1}'!".\
|
||||||
format(kwargs["name"], kwargs["template_qid"])
|
format(kwargs["name"], kwargs["template_qid"])
|
||||||
|
|
||||||
kwargs["template_vm"] = template_vm
|
kwargs["template_vm"] = template_vm
|
||||||
|
|
||||||
if "label" in kwargs:
|
if "label" in kwargs:
|
||||||
if kwargs["label"] not in QubesVmLabels:
|
if kwargs["label"] not in QubesVmLabels:
|
||||||
print "ERROR: incorrect label for VM '{0}'".format(kwargs["name"])
|
print >> sys.stderr, "ERROR: incorrect label for VM '{0}'".format(kwargs["name"])
|
||||||
kwargs.pop ("label")
|
kwargs.pop ("label")
|
||||||
else:
|
else:
|
||||||
kwargs["label"] = QubesVmLabels[kwargs["label"]]
|
kwargs["label"] = QubesVmLabels[kwargs["label"]]
|
||||||
@ -2375,7 +2375,7 @@ class QubesVmCollection(dict):
|
|||||||
|
|
||||||
template_vm = self[kwargs.pop("template_qid")]
|
template_vm = self[kwargs.pop("template_qid")]
|
||||||
if template_vm is None:
|
if template_vm is None:
|
||||||
print "ERROR: DisposableVM '{0}' uses unkown template qid='{1}'!".\
|
print >> sys.stderr, "ERROR: DisposableVM '{0}' uses unkown template qid='{1}'!".\
|
||||||
format(kwargs["name"], kwargs["template_qid"])
|
format(kwargs["name"], kwargs["template_qid"])
|
||||||
|
|
||||||
kwargs["template_vm"] = template_vm
|
kwargs["template_vm"] = template_vm
|
||||||
@ -2383,7 +2383,7 @@ class QubesVmCollection(dict):
|
|||||||
|
|
||||||
if kwargs["label"] is not None:
|
if kwargs["label"] is not None:
|
||||||
if kwargs["label"] not in QubesVmLabels:
|
if kwargs["label"] not in QubesVmLabels:
|
||||||
print "ERROR: incorrect label for VM '{0}'".format(kwargs["name"])
|
print >> sys.stderr, "ERROR: incorrect label for VM '{0}'".format(kwargs["name"])
|
||||||
kwargs.pop ("label")
|
kwargs.pop ("label")
|
||||||
else:
|
else:
|
||||||
kwargs["label"] = QubesVmLabels[kwargs["label"]]
|
kwargs["label"] = QubesVmLabels[kwargs["label"]]
|
||||||
@ -2438,7 +2438,7 @@ class QubesDaemonPidfile(object):
|
|||||||
# check if the pid file is valid...
|
# check if the pid file is valid...
|
||||||
proc_path = "/proc/" + str(self.read_pid()) + "/cmdline"
|
proc_path = "/proc/" + str(self.read_pid()) + "/cmdline"
|
||||||
if not os.path.exists (proc_path):
|
if not os.path.exists (proc_path):
|
||||||
print "Path {0} doesn't exist, assuming stale pidfile.".format(proc_path)
|
print >> sys.stderr, "Path {0} doesn't exist, assuming stale pidfile.".format(proc_path)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
f = open (proc_path)
|
f = open (proc_path)
|
||||||
@ -2447,7 +2447,7 @@ class QubesDaemonPidfile(object):
|
|||||||
|
|
||||||
# The following doesn't work with python -- one would have to get argv[1] and compare it with self.name...
|
# The following doesn't work with python -- one would have to get argv[1] and compare it with self.name...
|
||||||
# if not cmdline.strip().endswith(self.name):
|
# if not cmdline.strip().endswith(self.name):
|
||||||
# print "{0} = {1} doesn't seem to point to our process ({2}), assuming stale pidile.".format(proc_path, cmdline, self.name)
|
# print >> sys.stderr, "{0} = {1} doesn't seem to point to our process ({2}), assuming stale pidile.".format(proc_path, cmdline, self.name)
|
||||||
# return True
|
# return True
|
||||||
|
|
||||||
return False # It's a good pidfile
|
return False # It's a good pidfile
|
||||||
|
Loading…
Reference in New Issue
Block a user