diff --git a/qubes/tools/qubes_create.py b/qubes/tools/qubes_create.py index 360e6a03..8b94ab22 100644 --- a/qubes/tools/qubes_create.py +++ b/qubes/tools/qubes_create.py @@ -48,7 +48,8 @@ def main(args=None): ''' args = parser.parse_args(args) - qubes.Qubes.create_empty_store(args.app, **args.properties) + qubes.Qubes.create_empty_store(args.app, + offline_mode=args.offline_mode, **args.properties) return 0 diff --git a/qubes/vm/adminvm.py b/qubes/vm/adminvm.py index 965a4434..f6b17df5 100644 --- a/qubes/vm/adminvm.py +++ b/qubes/vm/adminvm.py @@ -25,6 +25,7 @@ ''' This module contains the AdminVM implementation ''' +import libvirt import qubes import qubes.exc import qubes.vm.qubesvm @@ -42,6 +43,14 @@ class AdminVM(qubes.vm.qubesvm.QubesVM): default=None, doc='There are other ways to set kernel for Dom0.') + memory = qubes.property('memory', setter=qubes.property.forbidden, + default=lambda self: self.get_mem(), + doc='Memory currently assigned to dom0.') + + maxmem = qubes.property('maxmem', setter=qubes.property.forbidden, + default=lambda self: self.get_mem_static_max(), + doc='Maximum dom0 memory size, modify using xen boot options.') + @property def attached_volumes(self): return [] @@ -101,7 +110,16 @@ class AdminVM(qubes.vm.qubesvm.QubesVM): .. seealso: :py:meth:`qubes.vm.qubesvm.QubesVM.get_mem_static_max` ''' - return self.app.vmm.libvirt_conn.getInfo()[1] + if self.app.vmm.offline_mode: + # default value passed on xen cmdline + return 4096 + else: + try: + return self.app.vmm.libvirt_conn.getInfo()[1] + except libvirt.libvirtError as e: + self.log.warning( + 'Failed to get memory limit for dom0: {}'.format(e)) + return 4096 def verify_files(self): '''Always :py:obj:`True`