Fix qubes-create in offline mode

QubesOS/qubes-issues#2412
This commit is contained in:
Marek Marczykowski-Górecki 2016-11-02 17:30:27 +01:00
parent 5e15db4176
commit d8a1216daf
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
2 changed files with 21 additions and 2 deletions

View File

@ -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

View File

@ -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`