From 90e4f65bea820864c7e765c3aa7b44e6076fc1c1 Mon Sep 17 00:00:00 2001 From: WillyPillow Date: Wed, 29 Jul 2020 20:55:56 +0800 Subject: [PATCH] qvm-template*: Add option to specify pool to store created VM. --- qubesadmin/tools/qvm_template.py | 4 ++++ qubesadmin/tools/qvm_template_postprocess.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/qubesadmin/tools/qvm_template.py b/qubesadmin/tools/qvm_template.py index b988efc..d058d2e 100644 --- a/qubesadmin/tools/qvm_template.py +++ b/qubesadmin/tools/qvm_template.py @@ -64,6 +64,8 @@ parser.add_argument('--nogpgcheck', action='store_true', help='Disable signature checks.') parser.add_argument('--allow-pv', action='store_true', help='Allow setting virt_mode to pv in configuration file.') +parser.add_argument('--pool', + help='Specify pool to store created VMs in.') # qvm-template download parser.add_argument('--downloaddir', default='.', help='Override download directory.') @@ -228,6 +230,8 @@ def install(args, app, version_selector=VersionSelector.LATEST, ] if args.allow_pv: cmdline.append('--allow-pv') + if args.pool: + cmdline += ['--pool', args.pool] subprocess.check_call(cmdline + [ 'post-install', name, diff --git a/qubesadmin/tools/qvm_template_postprocess.py b/qubesadmin/tools/qvm_template_postprocess.py index 568cfde..c6b51f7 100644 --- a/qubesadmin/tools/qvm_template_postprocess.py +++ b/qubesadmin/tools/qvm_template_postprocess.py @@ -53,6 +53,8 @@ parser.add_argument('--no-installed-by-rpm', action='store_true', help='Do not set installed_by_rpm') parser.add_argument('--allow-pv', action='store_true', help='Allow setting virt_mode to pv in configuration file.') +parser.add_argument('--pool', + help='Specify pool to store created VMs in.') parser.add_argument('action', choices=['post-install', 'pre-remove'], help='Action to perform') parser.add_argument('name', action='store', @@ -259,7 +261,8 @@ def post_install(args): vm = app.add_new_vm('TemplateVM', name=args.name, - label=qubesadmin.config.defaults['template_label']) + label=qubesadmin.config.defaults['template_label'], + pool=args.pool) vm_created = True vm.log.info('Importing data')