diff --git a/doc/manpages/qvm-create.rst b/doc/manpages/qvm-create.rst index c5ec3cee..c287b4b6 100644 --- a/doc/manpages/qvm-create.rst +++ b/doc/manpages/qvm-create.rst @@ -53,6 +53,10 @@ 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 + + Specify the pool to use for a volume + Options for internal use ------------------------ @@ -71,5 +75,6 @@ Authors | Rafal Wojtczuk | Marek Marczykowski | Wojtek Porczyk +| Bahtiar `kalkin-` Gadimov .. vim: ts=3 sw=3 et tw=80 diff --git a/qubes/tools/qvm_create.py b/qubes/tools/qvm_create.py index 3ee077d6..83f1fb35 100644 --- a/qubes/tools/qvm_create.py +++ b/qubes/tools/qvm_create.py @@ -46,9 +46,10 @@ parser.add_argument('--property', '--prop', '-p', action=qubes.tools.PropertyAction, help='set domain\'s property, like "internal", "memory" or "vcpus"') -parser.add_argument('--pool-name', '--pool', '-P', - action=qubes.tools.SinglePropertyAction, - help='specify the storage pool to use') +parser.add_argument('--pool', '-P', + action='append', + metavar='POOL_NAME:VOLUME_NAME', + help='specify the pool to use for a volume') parser.add_argument('--template', '-t', action=qubes.tools.SinglePropertyAction, @@ -79,6 +80,17 @@ parser.add_argument('name', metavar='VMNAME', def main(args=None): args = parser.parse_args(args) + if args.pool: + args.properties['volume_config'] = {} + 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 + except ValueError: + parser.error( + 'Pool argument must be of form: -P pool_name:volume_name') + if 'label' not in args.properties: parser.error('--label option is mandatory')