Merge branch 'hvm' of 10.141.1.101:/var/lib/qubes/git/marmarek/core into hvm
This commit is contained in:
commit
4ebcace459
@ -881,9 +881,15 @@ class QubesVm(object):
|
|||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
@property
|
||||||
|
def uses_custom_config(self):
|
||||||
|
return self.conf_file != self.absolute_path(self.name + ".conf", None)
|
||||||
|
|
||||||
def create_config_file(self, file_path = None, source_template = None, prepare_dvm = False):
|
def create_config_file(self, file_path = None, source_template = None, prepare_dvm = False):
|
||||||
if file_path is None:
|
if file_path is None:
|
||||||
file_path = self.conf_file
|
file_path = self.conf_file
|
||||||
|
if self.uses_custom_config:
|
||||||
|
return
|
||||||
if source_template is None:
|
if source_template is None:
|
||||||
source_template = self.template
|
source_template = self.template
|
||||||
|
|
||||||
@ -1622,19 +1628,6 @@ class QubesTemplateVm(QubesVm):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def start(self, debug_console = False, verbose = False, preparing_dvm=False):
|
|
||||||
if dry_run:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.reset_volatile_storage(verbose=verbose)
|
|
||||||
|
|
||||||
if not self.updateable:
|
|
||||||
raise QubesException ("Cannot start Template VM that is marked \"nonupdatable\"")
|
|
||||||
|
|
||||||
# TODO?: check if none of running appvms are outdated
|
|
||||||
|
|
||||||
return super(QubesTemplateVm, self).start(debug_console=debug_console, verbose=verbose)
|
|
||||||
|
|
||||||
def reset_volatile_storage(self, verbose = False):
|
def reset_volatile_storage(self, verbose = False):
|
||||||
assert not self.is_running(), "Attempt to clean volatile image of running Template VM!"
|
assert not self.is_running(), "Attempt to clean volatile image of running Template VM!"
|
||||||
|
|
||||||
|
@ -119,16 +119,23 @@ def block_name_to_majorminor(name):
|
|||||||
|
|
||||||
major = 0
|
major = 0
|
||||||
minor = 0
|
minor = 0
|
||||||
|
dXpY_style = False
|
||||||
|
|
||||||
name_match = re.match(r"([a-z]+)([a-z])([0-9]*)", name)
|
name_match = re.match(r"([a-z]+)([a-z])([0-9]*)", name)
|
||||||
|
if not name_match:
|
||||||
|
name_match = re.match(r"([a-z]+)([0-9]*)(?:p([0-9]+)?", name)
|
||||||
if not name_match:
|
if not name_match:
|
||||||
raise QubesException("Invalid device name: %s" % name)
|
raise QubesException("Invalid device name: %s" % name)
|
||||||
|
else:
|
||||||
|
dXpY_style = True
|
||||||
|
|
||||||
disk = True
|
disk = True
|
||||||
if name_match.group(1) == "xvd":
|
if name_match.group(1) == "xvd":
|
||||||
major = 202
|
major = 202
|
||||||
elif name_match.group(1) == "sd":
|
elif name_match.group(1) == "sd":
|
||||||
major = 8
|
major = 8
|
||||||
|
elif name_match.group(1) == "mmcblk":
|
||||||
|
major = 179
|
||||||
elif name.startswith("scd"):
|
elif name.startswith("scd"):
|
||||||
disk = False
|
disk = False
|
||||||
major = 11
|
major = 11
|
||||||
@ -143,6 +150,9 @@ def block_name_to_majorminor(name):
|
|||||||
return (0, 0)
|
return (0, 0)
|
||||||
|
|
||||||
if disk:
|
if disk:
|
||||||
|
if dXpY_style:
|
||||||
|
minor = int(name_match.group(2))*8
|
||||||
|
else:
|
||||||
minor = (ord(name_match.group(2))-ord('a')) * 16
|
minor = (ord(name_match.group(2))-ord('a')) * 16
|
||||||
else:
|
else:
|
||||||
minor = 0
|
minor = 0
|
||||||
|
@ -41,6 +41,8 @@ def main():
|
|||||||
help="Temporarily attach specified drive as CD/DVD")
|
help="Temporarily attach specified drive as CD/DVD")
|
||||||
parser.add_option ("--dvm", action="store_true", dest="preparing_dvm", default=False,
|
parser.add_option ("--dvm", action="store_true", dest="preparing_dvm", default=False,
|
||||||
help="Do actions necessary when preparing DVM image")
|
help="Do actions necessary when preparing DVM image")
|
||||||
|
parser.add_option ("--custom-config", action="store", dest="custom_config", default=None,
|
||||||
|
help="Use custom Xen config instead of Qubes-generated one")
|
||||||
|
|
||||||
(options, args) = parser.parse_args ()
|
(options, args) = parser.parse_args ()
|
||||||
if (len (args) != 1):
|
if (len (args) != 1):
|
||||||
@ -64,6 +66,9 @@ def main():
|
|||||||
print >> sys.stderr, "This VM does not support attaching drives"
|
print >> sys.stderr, "This VM does not support attaching drives"
|
||||||
exit (1)
|
exit (1)
|
||||||
|
|
||||||
|
if options.custom_config:
|
||||||
|
vm.conf_file = options.custom_config
|
||||||
|
|
||||||
try:
|
try:
|
||||||
vm.verify_files()
|
vm.verify_files()
|
||||||
xid = vm.start(debug_console=options.debug_console, verbose=options.verbose, preparing_dvm=options.preparing_dvm)
|
xid = vm.start(debug_console=options.debug_console, verbose=options.verbose, preparing_dvm=options.preparing_dvm)
|
||||||
|
Loading…
Reference in New Issue
Block a user