qvm-create uses new api
- `-p` is now used for `--pool` instead of `--property` - Documented pool usage
This commit is contained in:
parent
61feb0ced7
commit
496434d865
@ -32,7 +32,7 @@ Options
|
|||||||
The new domain class name (default: **AppVM** for
|
The new domain class name (default: **AppVM** for
|
||||||
:py:class:`qubes.vm.appvm.AppVM`).
|
:py:class:`qubes.vm.appvm.AppVM`).
|
||||||
|
|
||||||
.. option:: --prop=NAME=VALUE, --property=NAME=VALUE, -p NAME=VALUE
|
.. option:: --prop=NAME=VALUE, --property=NAME=VALUE
|
||||||
|
|
||||||
Set domain's property, like "internal", "memory" or "vcpus". Any property may
|
Set domain's property, like "internal", "memory" or "vcpus". Any property may
|
||||||
be set this way, even "qid".
|
be set this way, even "qid".
|
||||||
@ -57,9 +57,14 @@ Options
|
|||||||
Use provided :file:`root.img` instead of default/empty one (file will be
|
Use provided :file:`root.img` instead of default/empty one (file will be
|
||||||
*moved*). This option is mutually exclusive with :option:`--root-copy-from`.
|
*moved*). This option is mutually exclusive with :option:`--root-copy-from`.
|
||||||
|
|
||||||
.. option:: --pool=POOL_NAME:VOLUME_NAME, -P POOL_NAME:VOLUME_NAME
|
.. option:: -P POOL
|
||||||
|
|
||||||
Specify the pool to use for a volume
|
Pool to use for the new domain. All volumes besides snapshots volumes are
|
||||||
|
imported in to the specified POOL. ~HIS IS WHAT YOU WANT TO USE NORMALLY.
|
||||||
|
|
||||||
|
.. option:: --pool=POOL:VOLUME, -p POOL:VOLUME
|
||||||
|
|
||||||
|
Specify the pool to use for the specific volume
|
||||||
|
|
||||||
Options for internal use
|
Options for internal use
|
||||||
------------------------
|
------------------------
|
||||||
|
@ -42,15 +42,21 @@ parser.add_argument('--class', '-C', dest='cls',
|
|||||||
default='AppVM',
|
default='AppVM',
|
||||||
help='specify the class of the new domain (default: %(default)s)')
|
help='specify the class of the new domain (default: %(default)s)')
|
||||||
|
|
||||||
parser.add_argument('--property', '--prop', '-p',
|
parser.add_argument('--property', '--prop',
|
||||||
action=qubes.tools.PropertyAction,
|
action=qubes.tools.PropertyAction,
|
||||||
help='set domain\'s property, like "internal", "memory" or "vcpus"')
|
help='set domain\'s property, like "internal", "memory" or "vcpus"')
|
||||||
|
|
||||||
parser.add_argument('--pool', '-P',
|
parser.add_argument('--pool', '-p',
|
||||||
action='append',
|
action='append',
|
||||||
metavar='POOL_NAME:VOLUME_NAME',
|
metavar='POOL_NAME:VOLUME_NAME',
|
||||||
help='specify the pool to use for a volume')
|
help='specify the pool to use for a volume')
|
||||||
|
|
||||||
|
parser.add_argument('-P',
|
||||||
|
metavar='POOL_NAME',
|
||||||
|
dest='one_pool',
|
||||||
|
default='',
|
||||||
|
help='change all volume pools to specified pool')
|
||||||
|
|
||||||
parser.add_argument('--template', '-t',
|
parser.add_argument('--template', '-t',
|
||||||
action=qubes.tools.SinglePropertyAction,
|
action=qubes.tools.SinglePropertyAction,
|
||||||
help='specify the TemplateVM to use')
|
help='specify the TemplateVM to use')
|
||||||
@ -80,16 +86,18 @@ parser.add_argument('name', metavar='VMNAME',
|
|||||||
def main(args=None):
|
def main(args=None):
|
||||||
args = parser.parse_args(args)
|
args = parser.parse_args(args)
|
||||||
|
|
||||||
if args.pool:
|
pools = {}
|
||||||
args.properties['volume_config'] = {}
|
pool = None
|
||||||
|
if hasattr(args, 'pools') and args.pools:
|
||||||
for pool_vol in args.pool:
|
for pool_vol in args.pool:
|
||||||
try:
|
try:
|
||||||
pool_name, volume_name = pool_vol.split(':')
|
pool_name, volume_name = pool_vol.split(':')
|
||||||
config = {'pool': pool_name, 'name': volume_name}
|
pools[volume_name] = pool_name
|
||||||
args.properties['volume_config'][volume_name] = config
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
parser.error(
|
parser.error(
|
||||||
'Pool argument must be of form: -P pool_name:volume_name')
|
'Pool argument must be of form: -P pool_name:volume_name')
|
||||||
|
if args.one_pool:
|
||||||
|
pool = args.one_pool
|
||||||
|
|
||||||
if 'label' not in args.properties:
|
if 'label' not in args.properties:
|
||||||
parser.error('--label option is mandatory')
|
parser.error('--label option is mandatory')
|
||||||
@ -144,7 +152,7 @@ def main(args=None):
|
|||||||
|
|
||||||
if not args.no_root:
|
if not args.no_root:
|
||||||
try:
|
try:
|
||||||
vm.create_on_disk()
|
vm.create_on_disk(pool, pools)
|
||||||
|
|
||||||
# TODO this is file pool specific. Change it to a more general
|
# TODO this is file pool specific. Change it to a more general
|
||||||
# solution
|
# solution
|
||||||
|
Loading…
Reference in New Issue
Block a user