diff --git a/doc/manpages/qvm-create.rst b/doc/manpages/qvm-create.rst index ed008e97..69988a8c 100644 --- a/doc/manpages/qvm-create.rst +++ b/doc/manpages/qvm-create.rst @@ -32,7 +32,7 @@ Options 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 Set domain's property, like "internal", "memory" or "vcpus". Any property may be set this way, even "qid". @@ -57,9 +57,14 @@ Options Use provided :file:`root.img` instead of default/empty one (file will be *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 ------------------------ diff --git a/qubes/tools/qvm_create.py b/qubes/tools/qvm_create.py index a3b47e13..acf2cbfa 100644 --- a/qubes/tools/qvm_create.py +++ b/qubes/tools/qvm_create.py @@ -42,15 +42,21 @@ parser.add_argument('--class', '-C', dest='cls', default='AppVM', 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, help='set domain\'s property, like "internal", "memory" or "vcpus"') -parser.add_argument('--pool', '-P', +parser.add_argument('--pool', '-p', action='append', metavar='POOL_NAME:VOLUME_NAME', 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', action=qubes.tools.SinglePropertyAction, help='specify the TemplateVM to use') @@ -80,16 +86,18 @@ parser.add_argument('name', metavar='VMNAME', def main(args=None): args = parser.parse_args(args) - if args.pool: - args.properties['volume_config'] = {} + pools = {} + pool = None + if hasattr(args, 'pools') and args.pools: for pool_vol in args.pool: try: pool_name, volume_name = pool_vol.split(':') - config = {'pool': pool_name, 'name': volume_name} - args.properties['volume_config'][volume_name] = config + pools[volume_name] = pool_name except ValueError: parser.error( '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: parser.error('--label option is mandatory') @@ -144,7 +152,7 @@ def main(args=None): if not args.no_root: try: - vm.create_on_disk() + vm.create_on_disk(pool, pools) # TODO this is file pool specific. Change it to a more general # solution