diff --git a/core-modules/01QubesHVm.py b/core-modules/01QubesHVm.py index ae929155..b843b504 100644 --- a/core-modules/01QubesHVm.py +++ b/core-modules/01QubesHVm.py @@ -29,12 +29,12 @@ import subprocess import stat import sys import re - -from qubes.qubes import QubesVm,register_qubes_vm_class,xs,xc,dry_run -from qubes.qubes import QubesException,QubesVmCollection +import stat +from qubes.qubes import QubesVm,register_qubes_vm_class,xs,dry_run from qubes.qubes import system_path,defaults +from qubes.qubes import QubesException -system_path["config_template_hvm"] = '/usr/share/qubes/vm-template-hvm.conf' +system_path["config_template_hvm"] = '/usr/share/qubes/vm-template-hvm.xml' defaults["hvm_disk_size"] = 20*1024*1024*1024 defaults["hvm_private_img_size"] = 2*1024*1024*1024 @@ -285,40 +285,26 @@ class QubesHVm(QubesVm): params['volatiledev'] = '' if self.drive: - type_mode = ":cdrom,r" (drive_type, drive_domain, drive_path) = self.drive.split(":") - if drive_type == "hd": - type_mode = ",w" - elif drive_type == "cdrom": - type_mode = ":cdrom,r" - # leave empty to use standard syntax in case of dom0 if drive_domain.lower() == "dom0": - backend_domain = "" - else: - backend_domain = "," + drive_domain + drive_domain = None + + params['otherdevs'] = self._format_disk_dev(drive_path, None, "xvdc", + rw=True if type == "disk" else False, type=type, + domain=backend_domain) - # FIXME: os.stat will work only when backend in dom0... - stat_res = None - if backend_domain == "": - stat_res = os.stat(drive_path) - if stat_res and stat.S_ISBLK(stat_res.st_mode): - params['otherdevs'] = "'phy:%s,xvdc%s%s'," % ( - drive_path, type_mode, backend_domain) - else: - params['otherdevs'] = "'script:file:%s,xvdc%s%s'," % ( - drive_path, type_mode, backend_domain) else: params['otherdevs'] = '' if self.timezone.lower() == 'localtime': - params['localtime'] = '1' + params['time_basis'] = 'localtime' params['timeoffset'] = '0' elif self.timezone.isdigit(): - params['localtime'] = '0' + params['time_basis'] = 'UTC' params['timeoffset'] = self.timezone else: print >>sys.stderr, "WARNING: invalid 'timezone' value: %s" % self.timezone - params['localtime'] = '0' + params['time_basis'] = 'UTC' params['timeoffset'] = '0' return params @@ -434,6 +420,7 @@ class QubesHVm(QubesVm): def start_stubdom_guid(self): cmdline = [system_path["qubes_guid_path"], "-d", str(self.stubdom_xid), + "-t", str(self.xid), "-c", self.label.color, "-i", self.label.icon_path, "-l", str(self.label.index)] @@ -532,20 +519,6 @@ class QubesHVm(QubesVm): self.pause() - def pause(self): - if dry_run: - return - - xc.domain_pause(self.stubdom_xid) - super(QubesHVm, self).pause() - - def unpause(self): - if dry_run: - return - - xc.domain_unpause(self.stubdom_xid) - super(QubesHVm, self).unpause() - def is_guid_running(self): # If user force the guiagent, is_guid_running will mimic a standard QubesVM if self.guiagent_installed: diff --git a/rpm_spec/core-dom0.spec b/rpm_spec/core-dom0.spec index 331f2e00..f39fd907 100644 --- a/rpm_spec/core-dom0.spec +++ b/rpm_spec/core-dom0.spec @@ -171,7 +171,7 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/qubes/dvmdata mkdir -p $RPM_BUILD_ROOT/usr/share/qubes cp xen-vm-config/vm-template.xml $RPM_BUILD_ROOT/usr/share/qubes/xen-vm-template.xml -cp xen-vm-config/vm-template-hvm.conf $RPM_BUILD_ROOT/usr/share/qubes/ +cp xen-vm-config/vm-template-hvm.xml $RPM_BUILD_ROOT/usr/share/qubes/ mkdir -p $RPM_BUILD_ROOT/usr/bin @@ -320,7 +320,7 @@ fi %attr(0770,root,qubes) %dir /var/lib/qubes/dvmdata %attr(0770,root,qubes) %dir /var/lib/qubes/vm-kernels /usr/share/qubes/xen-vm-template.xml -/usr/share/qubes/vm-template-hvm.conf +/usr/share/qubes/vm-template-hvm.xml /usr/bin/xenstore-watch-qubes /usr/lib/qubes/qubes-restore /usr/lib/qubes/qubes-prepare-saved-domain.sh diff --git a/xen-vm-config/vm-template-hvm.conf b/xen-vm-config/vm-template-hvm.conf deleted file mode 100644 index ca10840e..00000000 --- a/xen-vm-config/vm-template-hvm.conf +++ /dev/null @@ -1,39 +0,0 @@ -# -# This is a Xen VM config file for Qubes VM -# DO NOT EDIT - autogenerated by qubes tools -# - -name = "{name}" - -builder='hvm' -memory={mem} -viridian=1 -kernel='hvmloader' -stdvga=1 -#acpi=1 -#apic=1 -boot='dca' -device_model='stubdom-dm' -#pae=1 -usbdevice='tablet' -sdl=0 -vnc=0 -localtime = {localtime} -rtc_timeoffset = {timeoffset} -disk = [ {rootdev} - {privatedev} - {otherdevs} - ] -vif = [ {netdev} ] -pci = [ {pcidev} ] -vcpus = {vcpus} - -#tsc_mode = 2 -#xen_extended_power_mgmt=0 - -on_poweroff = 'destroy' -on_reboot = 'destroy' -on_crash = 'destroy' - -# Use of DNS2 as DHCP server IP makes DNS2 not accessible, but DNS1 still should work -{disable_network}device_model_args = [ '-net', 'lwip,client_ip={ip},server_ip={dns2},dns={dns1},gw={gateway},netmask={netmask}' ] diff --git a/xen-vm-config/vm-template-hvm.xml b/xen-vm-config/vm-template-hvm.xml new file mode 100644 index 00000000..3fc66c0d --- /dev/null +++ b/xen-vm-config/vm-template-hvm.xml @@ -0,0 +1,30 @@ + + {name} + {maxmem} + {mem} + {vcpus} + + hvm + hvmloader + + + {disable_network1}-net lwip,client_ip={ip},server_ip={dns2},dns={dns1},gw={gateway},netmask={netmask}{disable_network2} + + + + + + destroy + destroy + destroy + + stubdom-dm +{rootdev} +{privatedev} +{otherdevs} +{netdev} +{pcidevs} + + + +