Merge branch 'master' of git.qubes-os.org:/var/lib/qubes/git/marmarek/core
This commit is contained in:
commit
d90040a726
@ -372,7 +372,11 @@ class QubesVm(object):
|
||||
self.session_metrics = None
|
||||
|
||||
def update_xen_storage(self):
|
||||
self.remove_from_xen_storage()
|
||||
try:
|
||||
self.remove_from_xen_storage()
|
||||
except OSError as ex:
|
||||
print "WARNING: {0}. Continuing anyway...".format(str(ex))
|
||||
pass
|
||||
self.add_to_xen_storage()
|
||||
if not dry_run and xend_session.session is not None:
|
||||
self.refresh_xend_session()
|
||||
@ -1807,7 +1811,7 @@ class QubesVmCollection(dict):
|
||||
|
||||
while len(new_vms) > 0:
|
||||
cur_vm = new_vms.pop()
|
||||
for vm in cur_vm.connected_vms.values():
|
||||
for vm in self[cur_vm].connected_vms.values():
|
||||
if vm.qid not in dependend_vms_qid:
|
||||
dependend_vms_qid.append(vm.qid)
|
||||
if vm.is_netvm():
|
||||
|
@ -25,6 +25,7 @@ from qubes.qubes import QubesVmLabels
|
||||
from optparse import OptionParser;
|
||||
import subprocess
|
||||
import re
|
||||
import os
|
||||
|
||||
def find_net_devices():
|
||||
p = subprocess.Popen (["lspci", "-mm", "-n"], stdout=subprocess.PIPE)
|
||||
@ -65,6 +66,8 @@ def main():
|
||||
help="VCPUs count")
|
||||
parser.add_option ("-i", "--internal", action="store_true", dest="internal", default=False,
|
||||
help="Create VM for internal use only (hidden in qubes-manager, no appmenus)")
|
||||
parser.add_option ("--force-root", action="store_true", dest="force_root", default=False,
|
||||
help="Force to run, even with root privileges")
|
||||
|
||||
parser.add_option ("-q", "--quiet", action="store_false", dest="verbose", default=True)
|
||||
(options, args) = parser.parse_args ()
|
||||
@ -75,6 +78,15 @@ def main():
|
||||
if options.netvm and options.proxyvm:
|
||||
parser.error ("You must specify at most one of --proxy and --net")
|
||||
|
||||
if os.geteuid() == 0:
|
||||
print "*** Running this tool as root is strongly discouraged, this will lead you in permissions problems."
|
||||
if options.force_root:
|
||||
print "Continuing as commanded. You have been warned."
|
||||
else:
|
||||
print "Retry as unprivileged user."
|
||||
print "... or use --force-root to continue anyway."
|
||||
exit(1)
|
||||
|
||||
if options.label is None:
|
||||
print "You must choose a label for the new VM by passing the --label option."
|
||||
print "Possible values are:"
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
from qubes.qubes import QubesVmCollection
|
||||
from optparse import OptionParser;
|
||||
import os
|
||||
|
||||
def main():
|
||||
usage = "usage: %prog [options] <vm-name>"
|
||||
@ -29,6 +30,8 @@ def main():
|
||||
parser.add_option ("-q", "--quiet", action="store_false", dest="verbose", default=True)
|
||||
parser.add_option ("--just-db", action="store_true", dest="remove_from_db_only", default=False,
|
||||
help="Remove only from the Qubes Xen DB, do not remove any files")
|
||||
parser.add_option ("--force-root", action="store_true", dest="force_root", default=False,
|
||||
help="Force to run, even with root privileges")
|
||||
(options, args) = parser.parse_args ()
|
||||
if (len (args) != 1):
|
||||
parser.error ("You must specify VM name!")
|
||||
@ -42,6 +45,15 @@ def main():
|
||||
print "A VM with the name '{0}' does not exist in the system.".format(vmname)
|
||||
exit(1)
|
||||
|
||||
if os.geteuid() == 0:
|
||||
print "*** Running this tool as root is strongly discouraged, this will lead you in permissions problems."
|
||||
if options.force_root:
|
||||
print "Continuing as commanded. You have been warned."
|
||||
else:
|
||||
print "Retry as unprivileged user."
|
||||
print "... or use --force-root to continue anyway."
|
||||
exit(1)
|
||||
|
||||
if vm.is_template():
|
||||
dependent_vms = qvm_collection.get_vms_based_on(vm.qid)
|
||||
if len(dependent_vms) > 0:
|
||||
|
Loading…
Reference in New Issue
Block a user