DVM: add --dvm option to qvm-start

Currently it only forces to use a fake IP address, which can be
replaced during restore time.
This commit is contained in:
Rafal Wojtczuk 2010-09-07 16:15:24 +02:00
parent 1239643c73
commit 2dd9bab23a
3 changed files with 10 additions and 5 deletions

View File

@ -460,7 +460,7 @@ class QubesVm(object):
ret = host_metrics_record["memory_free"]
return long(ret)
def start(self, debug_console = False, verbose = False):
def start(self, debug_console = False, verbose = False, preparing_dvm = False):
if dry_run:
return
@ -500,8 +500,11 @@ class QubesVm(object):
assert self.netvm_vm is not None
if verbose:
print "--> Attaching to the network backend (netvm={0})...".format(self.netvm_vm.name)
xm_cmdline = ["/usr/sbin/xm", "network-attach", self.name, "script=vif-route-qubes", "ip="+self.ip]
if preparing_dvm:
actual_ip = "254.254.254.254"
else:
actual_ip = self.ip
xm_cmdline = ["/usr/sbin/xm", "network-attach", self.name, "script=vif-route-qubes", "ip="+actual_ip]
if self.netvm_vm.qid != 0:
if not self.netvm_vm.is_running():
print "ERROR: NetVM not running, please start it first"

View File

@ -35,6 +35,8 @@ def main():
help="Do not start the GUId")
parser.add_option ("--console", action="store_true", dest="debug_console", default=False,
help="Attach debugging console to the newly started VM")
parser.add_option ("--dvm", action="store_true", dest="preparing_dvm", default=False,
help="Do actions necessary when preparing DVM image")
(options, args) = parser.parse_args ()
if (len (args) != 1):
@ -53,7 +55,7 @@ def main():
try:
vm.verify_files()
xid = vm.start(debug_console=options.debug_console, verbose=options.verbose)
xid = vm.start(debug_console=options.debug_console, verbose=options.verbose, preparing_dvm=options.preparing_dvm)
except (IOError, OSError, QubesException) as err:
print "ERROR: {0}".format(err)
exit (1)

View File

@ -21,7 +21,7 @@ if ! [ -d $VMDIR ] ; then
echo $VMDIR does not exist ?
exit 1
fi
if ! qvm-start $1 --no-guid ; then
if ! qvm-start $1 --no-guid --dvm ; then
exit 1
fi