Merge branch 'master' of git://git.qubes-os.org/marmarek/core-admin
This commit is contained in:
commit
2347874690
@ -60,8 +60,12 @@ class QubesHVm(QubesVm):
|
|||||||
attrs['drive'] = { 'save': 'str(self.drive)' }
|
attrs['drive'] = { 'save': 'str(self.drive)' }
|
||||||
attrs['maxmem'].pop('save')
|
attrs['maxmem'].pop('save')
|
||||||
attrs['timezone'] = { 'default': 'localtime', 'save': 'str(self.timezone)' }
|
attrs['timezone'] = { 'default': 'localtime', 'save': 'str(self.timezone)' }
|
||||||
attrs['qrexec_installed'] = { 'default': False, 'save': 'str(self.qrexec_installed)' }
|
attrs['qrexec_installed'] = { 'default': False,
|
||||||
attrs['guiagent_installed'] = { 'default' : False, 'save': 'str(self.guiagent_installed)' }
|
'attr': '_qrexec_installed',
|
||||||
|
'save': 'str(self._qrexec_installed)' }
|
||||||
|
attrs['guiagent_installed'] = { 'default' : False,
|
||||||
|
'attr': '_guiagent_installed',
|
||||||
|
'save': 'str(self._guiagent_installed)' }
|
||||||
attrs['_start_guid_first']['eval'] = 'True'
|
attrs['_start_guid_first']['eval'] = 'True'
|
||||||
attrs['services']['default'] = "{'meminfo-writer': False}"
|
attrs['services']['default'] = "{'meminfo-writer': False}"
|
||||||
|
|
||||||
@ -110,6 +114,28 @@ class QubesHVm(QubesVm):
|
|||||||
attrs += [ 'guiagent_installed' ]
|
attrs += [ 'guiagent_installed' ]
|
||||||
return attrs
|
return attrs
|
||||||
|
|
||||||
|
@property
|
||||||
|
def qrexec_installed(self):
|
||||||
|
return self._qrexec_installed or \
|
||||||
|
bool(self.template and self.template.qrexec_installed)
|
||||||
|
|
||||||
|
@qrexec_installed.setter
|
||||||
|
def qrexec_installed(self, value):
|
||||||
|
if self.template and self.template.qrexec_installed and not value:
|
||||||
|
print >>sys.stderr, "WARNING: When qrexec_installed set in template, it will be propagated to the VM"
|
||||||
|
self._qrexec_installed = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def guiagent_installed(self):
|
||||||
|
return self._guiagent_installed or \
|
||||||
|
bool(self.template and self.template.guiagent_installed)
|
||||||
|
|
||||||
|
@guiagent_installed.setter
|
||||||
|
def guiagent_installed(self, value):
|
||||||
|
if self.template and self.template.guiagent_installed and not value:
|
||||||
|
print >>sys.stderr, "WARNING: When guiagent_installed set in template, it will be propagated to the VM"
|
||||||
|
self._guiagent_installed = value
|
||||||
|
|
||||||
def create_on_disk(self, verbose, source_template = None):
|
def create_on_disk(self, verbose, source_template = None):
|
||||||
if dry_run:
|
if dry_run:
|
||||||
return
|
return
|
||||||
@ -133,13 +159,26 @@ class QubesHVm(QubesVm):
|
|||||||
f_root.truncate(defaults["hvm_disk_size"])
|
f_root.truncate(defaults["hvm_disk_size"])
|
||||||
f_root.close()
|
f_root.close()
|
||||||
|
|
||||||
# create empty private.img
|
if self.template is None:
|
||||||
if verbose:
|
# create empty private.img
|
||||||
print >> sys.stderr, "--> Creating private image: {0}".\
|
if verbose:
|
||||||
format(self.private_img)
|
print >> sys.stderr, "--> Creating private image: {0}".\
|
||||||
f_private = open(self.private_img, "w")
|
format(self.private_img)
|
||||||
f_private.truncate(defaults["hvm_private_img_size"])
|
f_private = open(self.private_img, "w")
|
||||||
f_private.close()
|
f_private.truncate(defaults["hvm_private_img_size"])
|
||||||
|
f_private.close()
|
||||||
|
else:
|
||||||
|
# copy template private.img
|
||||||
|
template_priv = self.template.private_img
|
||||||
|
if verbose:
|
||||||
|
print >> sys.stderr, "--> Copying the template's private image: {0}".\
|
||||||
|
format(template_priv)
|
||||||
|
|
||||||
|
# We prefer to use Linux's cp, because it nicely handles sparse files
|
||||||
|
retcode = subprocess.call (["cp", template_priv, self.private_img])
|
||||||
|
if retcode != 0:
|
||||||
|
raise IOError ("Error while copying {0} to {1}".\
|
||||||
|
format(template_priv, self.private_img))
|
||||||
|
|
||||||
# fire hooks
|
# fire hooks
|
||||||
for hook in self.hooks_create_on_disk:
|
for hook in self.hooks_create_on_disk:
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
from qubes.qubes import QubesVmCollection,QubesException
|
from qubes.qubes import QubesVmCollection,QubesException
|
||||||
from qubes.qubes import shutdown_counter_max
|
from optparse import OptionParser
|
||||||
from optparse import OptionParser;
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ def main():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
if options.verbose:
|
if options.verbose:
|
||||||
print >> sys.stdout, "A VM with the name '{0}' is exist.".format(vmname)
|
print >> sys.stdout, "A VM with the name '{0}' does exist.".format(vmname)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
main()
|
main()
|
||||||
|
@ -41,10 +41,12 @@ notify_object = None
|
|||||||
from qubes.qubes import defaults
|
from qubes.qubes import defaults
|
||||||
|
|
||||||
def tray_notify(str, label, timeout = 3000):
|
def tray_notify(str, label, timeout = 3000):
|
||||||
notify_object.Notify("Qubes", 0, label.icon, "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
if notify_object:
|
||||||
|
notify_object.Notify("Qubes", 0, label.icon, "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
||||||
|
|
||||||
def tray_notify_error(str, timeout = 3000):
|
def tray_notify_error(str, timeout = 3000):
|
||||||
notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
if notify_object:
|
||||||
|
notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
||||||
|
|
||||||
def vm_run_cmd(vm, cmd, options):
|
def vm_run_cmd(vm, cmd, options):
|
||||||
if options.shutdown:
|
if options.shutdown:
|
||||||
@ -169,7 +171,10 @@ def main():
|
|||||||
|
|
||||||
if options.tray:
|
if options.tray:
|
||||||
global notify_object
|
global notify_object
|
||||||
notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
try:
|
||||||
|
notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
||||||
|
except dbus.DBusException as ex:
|
||||||
|
print >>sys.stderr, "WARNING: failed connect to tray notification service: %s" % str(ex)
|
||||||
|
|
||||||
qvm_collection = QubesVmCollection()
|
qvm_collection = QubesVmCollection()
|
||||||
qvm_collection.lock_db_for_reading()
|
qvm_collection.lock_db_for_reading()
|
||||||
|
@ -31,10 +31,12 @@ import dbus
|
|||||||
notify_object = None
|
notify_object = None
|
||||||
|
|
||||||
def tray_notify(str, label, timeout = 3000):
|
def tray_notify(str, label, timeout = 3000):
|
||||||
notify_object.Notify("Qubes", 0, label.icon, "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
if notify_object:
|
||||||
|
notify_object.Notify("Qubes", 0, label.icon, "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
||||||
|
|
||||||
def tray_notify_error(str, timeout = 3000):
|
def tray_notify_error(str, timeout = 3000):
|
||||||
notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
if notify_object:
|
||||||
|
notify_object.Notify("Qubes", 0, "dialog-error", "Qubes", str, [], [], timeout, dbus_interface="org.freedesktop.Notifications")
|
||||||
|
|
||||||
def tray_notify_generic(level, str):
|
def tray_notify_generic(level, str):
|
||||||
if level == "info":
|
if level == "info":
|
||||||
@ -72,7 +74,10 @@ def main():
|
|||||||
|
|
||||||
if options.tray:
|
if options.tray:
|
||||||
global notify_object
|
global notify_object
|
||||||
notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
try:
|
||||||
|
notify_object = dbus.SessionBus().get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications")
|
||||||
|
except dbus.DBusException as ex:
|
||||||
|
print >>sys.stderr, "WARNING: failed connect to tray notification service: %s" % str(ex)
|
||||||
|
|
||||||
qvm_collection = QubesVmCollection()
|
qvm_collection = QubesVmCollection()
|
||||||
qvm_collection.lock_db_for_reading()
|
qvm_collection.lock_db_for_reading()
|
||||||
|
Loading…
Reference in New Issue
Block a user