qubes/tools/qvm-create: Add internal --no-root option
And documentation fixes.
This commit is contained in:
parent
136b3b36b8
commit
067f033af6
@ -6,7 +6,7 @@
|
|||||||
Synopsis
|
Synopsis
|
||||||
--------
|
--------
|
||||||
|
|
||||||
:command:`qvm-create` skel-manpage.py [-h] [--xml *XMLFILE*] [--force-root] [--class *CLS*] [--property *NAME*=*VALUE*] [--template *VALUE*] [--label *VALUE*] [--root-copy-from *FILENAME* | --root-move-from *FILENAME*] *VMNAME*
|
:command:`qvm-create` [-h] [--xml *XMLFILE*] [--force-root] [--class *CLS*] [--property *NAME*=*VALUE*] [--template *VALUE*] [--label *VALUE*] [--root-copy-from *FILENAME* | --root-move-from *FILENAME*] *VMNAME*
|
||||||
|
|
||||||
Options
|
Options
|
||||||
-------
|
-------
|
||||||
@ -25,7 +25,8 @@ Options
|
|||||||
|
|
||||||
.. option:: --class, -C
|
.. option:: --class, -C
|
||||||
|
|
||||||
The class of the new domain (default: AppVM).
|
The new domain class name (default: **AppVM** for
|
||||||
|
:py:class:`qubes.vm.appvm.AppVM`).
|
||||||
|
|
||||||
.. option:: --prop=NAME=VALUE, --property=NAME=VALUE, -p NAME=VALUE
|
.. option:: --prop=NAME=VALUE, --property=NAME=VALUE, -p NAME=VALUE
|
||||||
|
|
||||||
@ -44,11 +45,23 @@ Options
|
|||||||
|
|
||||||
.. option:: --root-copy-from=FILENAME, -r FILENAME
|
.. option:: --root-copy-from=FILENAME, -r FILENAME
|
||||||
|
|
||||||
Use provided root.img instead of default/empty one (file will be *copied*).
|
Use provided :file:`root.img` instead of default/empty one (file will be
|
||||||
|
*copied*). This option is mutually exclusive with :option:`--root-move-from`.
|
||||||
|
|
||||||
.. option:: --root-move-from=FILENAME, -R FILENAME
|
.. option:: --root-move-from=FILENAME, -R FILENAME
|
||||||
|
|
||||||
use provided root.img instead of default/empty one (file will be *moved*).
|
Use provided :file:`root.img` instead of default/empty one (file will be
|
||||||
|
*moved*). This option is mutually exclusive with :option:`--root-copy-from`.
|
||||||
|
|
||||||
|
Options for internal use
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Do not use if you don't know, what you are doing.
|
||||||
|
|
||||||
|
.. option:: --no-root
|
||||||
|
|
||||||
|
Do not create :file:`root.img`. This option is mutually exclusive with
|
||||||
|
:option:`--root-copy-from` and :option:`--root-move-from`.
|
||||||
|
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
|
@ -62,6 +62,9 @@ parser_root.add_argument('--root-copy-from', '-r', metavar='FILENAME',
|
|||||||
parser_root.add_argument('--root-move-from', '-R', metavar='FILENAME',
|
parser_root.add_argument('--root-move-from', '-R', metavar='FILENAME',
|
||||||
help='use provided root.img instead of default/empty one'
|
help='use provided root.img instead of default/empty one'
|
||||||
' (file will be MOVED)')
|
' (file will be MOVED)')
|
||||||
|
parser_root.add_argument('--no-root',
|
||||||
|
action='store_true', default=False,
|
||||||
|
help=argparse.SUPPRESS)
|
||||||
|
|
||||||
parser.add_argument('name', metavar='VMNAME',
|
parser.add_argument('name', metavar='VMNAME',
|
||||||
action=qubes.tools.SinglePropertyAction,
|
action=qubes.tools.SinglePropertyAction,
|
||||||
@ -124,23 +127,24 @@ def main():
|
|||||||
# if (options.verbose):
|
# if (options.verbose):
|
||||||
# print('--> Using default TemplateVM: {0}'.format(template.name))
|
# print('--> Using default TemplateVM: {0}'.format(template.name))
|
||||||
|
|
||||||
try:
|
if not args.no_root:
|
||||||
vm.create_on_disk()
|
try:
|
||||||
|
vm.create_on_disk()
|
||||||
|
|
||||||
if args.root_move_from is not None:
|
if args.root_move_from is not None:
|
||||||
# if (options.verbose):
|
# if (options.verbose):
|
||||||
# print "--> Replacing root.img with provided file"
|
# print "--> Replacing root.img with provided file"
|
||||||
os.unlink(vm.root_img)
|
os.unlink(vm.root_img)
|
||||||
os.rename(options.root_move_from, vm.root_img)
|
os.rename(options.root_move_from, vm.root_img)
|
||||||
elif args.root_copy_from is not None:
|
elif args.root_copy_from is not None:
|
||||||
# if (options.verbose):
|
# if (options.verbose):
|
||||||
# print "--> Replacing root.img with provided file"
|
# print "--> Replacing root.img with provided file"
|
||||||
os.unlink(vm.root_img)
|
os.unlink(vm.root_img)
|
||||||
# use 'cp' to preserve sparse file
|
# use 'cp' to preserve sparse file
|
||||||
subprocess.check_call(['cp', options.root_copy_from, vm.root_img])
|
subprocess.check_call(['cp', options.root_copy_from, vm.root_img])
|
||||||
|
|
||||||
except (IOError, OSError) as err:
|
except (IOError, OSError) as err:
|
||||||
parser.error(str(err))
|
parser.error(str(err))
|
||||||
|
|
||||||
app.save()
|
app.save()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user