qvm-template-commit: add --offline-mode option
Allow force offline mode (disable check if VM isn't running) - useful for running from anaconda (inside of chroot).
This commit is contained in:
parent
8e9c59e7f8
commit
5a28074c2b
@ -28,7 +28,7 @@ import sys
|
||||
|
||||
from qubes.qubes import QubesVm,register_qubes_vm_class,dry_run
|
||||
from qubes.qubes import QubesVmCollection,QubesException,QubesVmLabels
|
||||
from qubes.qubes import defaults,system_path,vm_files
|
||||
from qubes.qubes import defaults,system_path,vm_files,vmm
|
||||
|
||||
class QubesTemplateVm(QubesVm):
|
||||
"""
|
||||
@ -151,6 +151,7 @@ class QubesTemplateVm(QubesVm):
|
||||
|
||||
def commit_changes (self, verbose = False):
|
||||
|
||||
if not vmm.offline_mode:
|
||||
assert not self.is_running(), "Attempt to commit changes on running Template VM!"
|
||||
|
||||
if verbose:
|
||||
|
@ -21,7 +21,7 @@
|
||||
#
|
||||
#
|
||||
|
||||
from qubes.qubes import QubesVmCollection
|
||||
from qubes.qubes import QubesVmCollection,vmm
|
||||
from qubes.qubes import QubesException
|
||||
from optparse import OptionParser
|
||||
import subprocess
|
||||
@ -39,6 +39,9 @@ def main():
|
||||
parser.error ("You must specify VM name!")
|
||||
vmname = args[0]
|
||||
|
||||
if options.offline_mode:
|
||||
vmm.offline_mode = True
|
||||
|
||||
qvm_collection = QubesVmCollection()
|
||||
qvm_collection.lock_db_for_reading()
|
||||
qvm_collection.load()
|
||||
@ -53,7 +56,7 @@ def main():
|
||||
print >> sys.stderr, "A VM '{0}' is not template.".format(vmname)
|
||||
exit(1)
|
||||
|
||||
if vm.is_running():
|
||||
if not vmm.offline_mode and vm.is_running():
|
||||
print >> sys.stderr, "You must stop VM first."
|
||||
exit(1)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user