diff --git a/Makefile b/Makefile index 29e3d8ce..72316fcd 100644 --- a/Makefile +++ b/Makefile @@ -152,6 +152,10 @@ endif ln -s qvm-device $(DESTDIR)/usr/bin/qvm-block ln -s qvm-device $(DESTDIR)/usr/bin/qvm-pci ln -s qvm-device $(DESTDIR)/usr/bin/qvm-usb + install -d $(DESTDIR)/usr/share/man/man1 + ln -s qvm-device.1.gz $(DESTDIR)/usr/share/man/man1/qvm-block.1.gz + ln -s qvm-device.1.gz $(DESTDIR)/usr/share/man/man1/qvm-pci.1.gz + ln -s qvm-device.1.gz $(DESTDIR)/usr/share/man/man1/qvm-usb.1.gz # $(MAKE) install -C tests $(MAKE) install -C relaxng mkdir -p $(DESTDIR)/etc/qubes diff --git a/qubes/backup.py b/qubes/backup.py index 03a2cfcc..a3b4f7aa 100644 --- a/qubes/backup.py +++ b/qubes/backup.py @@ -819,7 +819,8 @@ class Backup(object): # Save date of last backup, only when backup succeeded for qid, vm_info in files_to_backup.items(): if vm_info.vm: - vm_info.vm.backup_timestamp = datetime.datetime.now() + vm_info.vm.backup_timestamp = \ + int(datetime.datetime.now().strftime('%s')) self.app.save() diff --git a/qubes/tests/vm/qubesvm.py b/qubes/tests/vm/qubesvm.py index e8637aad..14e4b933 100644 --- a/qubes/tests/vm/qubesvm.py +++ b/qubes/tests/vm/qubesvm.py @@ -513,12 +513,12 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase): timestamp = datetime.datetime(2016, 1, 1, 12, 14, 2) timestamp_str = timestamp.strftime('%s') self.assertPropertyDefaultValue(vm, 'backup_timestamp', None) - self.assertPropertyValue(vm, 'backup_timestamp', timestamp, - timestamp, timestamp_str) + self.assertPropertyValue(vm, 'backup_timestamp', int(timestamp_str), + int(timestamp_str), timestamp_str) del vm.backup_timestamp self.assertPropertyDefaultValue(vm, 'backup_timestamp', None) self.assertPropertyValue(vm, 'backup_timestamp', timestamp_str, - timestamp) + int(timestamp_str)) def test_401_backup_timestamp_invalid(self): vm = self.get_vm() diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 6450b90d..1d73f7ec 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -24,7 +24,6 @@ from __future__ import absolute_import import asyncio import base64 -import datetime import errno import grp import os @@ -100,6 +99,11 @@ def _setter_virt_mode(self, prop, value): "pvh mode can't be set if pci devices are attached") return value +def _default_virt_mode(self): + if self.devices['pci'].persistent(): + return 'hvm' + return 'pvh' + class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): '''Base functionality of Qubes VM shared between all VMs. @@ -386,9 +390,9 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): virt_mode = qubes.property('virt_mode', type=str, setter=_setter_virt_mode, - default='hvm', + default=_default_virt_mode, doc='''Virtualisation mode: full virtualisation ("hvm"), - or paravirtualisation ("pv")''') + or paravirtualisation ("pv"), or hybrid ("pvh")''') installed_by_rpm = qubes.property('installed_by_rpm', type=bool, setter=qubes.property.bool, @@ -476,13 +480,9 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): type=bool, setter=qubes.property.bool, doc='If this domain is to be included in default backup.') - # format got changed from %s to str(datetime.datetime) backup_timestamp = qubes.property('backup_timestamp', default=None, - setter=(lambda self, prop, value: - value if isinstance(value, datetime.datetime) else - datetime.datetime.fromtimestamp(int(value))), - saver=(lambda self, prop, value: value.strftime('%s')), - doc='FIXME') + type=int, + doc='Time of last backup of the qube, in seconds since unix epoch') default_dispvm = qubes.VMProperty('default_dispvm', load_stage=4, @@ -1766,10 +1766,11 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): # miscellanous - def get_start_time(self): + @qubes.stateless_property + def start_time(self): '''Tell when machine was started. - :rtype: datetime.datetime + :rtype: float or None ''' if not self.is_running(): return None @@ -1778,7 +1779,7 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): start_time = self.app.vmm.xs.read('', '/vm/{}/start_time'.format(self.uuid)) if start_time != '': - return datetime.datetime.fromtimestamp(float(start_time)) + return float(start_time) return None diff --git a/rpm_spec/core-dom0.spec b/rpm_spec/core-dom0.spec index 104cdf8b..e953ec94 100644 --- a/rpm_spec/core-dom0.spec +++ b/rpm_spec/core-dom0.spec @@ -216,6 +216,7 @@ fi %{_mandir}/man1/qrexec-policy-graph.1* %{_mandir}/man1/qubes*.1* +%{_mandir}/man1/qvm-*.1* %dir %{python3_sitelib}/qubes-*.egg-info %{python3_sitelib}/qubes-*.egg-info/*