qvm-template*: Add option to specify pool to store created VM.

This commit is contained in:
WillyPillow 2020-07-29 20:55:56 +08:00
parent ef59a658f4
commit 90e4f65bea
No known key found for this signature in database
GPG Key ID: 3839E194B1415A9C
2 changed files with 8 additions and 1 deletions

View File

@ -64,6 +64,8 @@ parser.add_argument('--nogpgcheck', action='store_true',
help='Disable signature checks.') help='Disable signature checks.')
parser.add_argument('--allow-pv', action='store_true', parser.add_argument('--allow-pv', action='store_true',
help='Allow setting virt_mode to pv in configuration file.') 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 # qvm-template download
parser.add_argument('--downloaddir', default='.', parser.add_argument('--downloaddir', default='.',
help='Override download directory.') help='Override download directory.')
@ -228,6 +230,8 @@ def install(args, app, version_selector=VersionSelector.LATEST,
] ]
if args.allow_pv: if args.allow_pv:
cmdline.append('--allow-pv') cmdline.append('--allow-pv')
if args.pool:
cmdline += ['--pool', args.pool]
subprocess.check_call(cmdline + [ subprocess.check_call(cmdline + [
'post-install', 'post-install',
name, name,

View File

@ -53,6 +53,8 @@ parser.add_argument('--no-installed-by-rpm', action='store_true',
help='Do not set installed_by_rpm') help='Do not set installed_by_rpm')
parser.add_argument('--allow-pv', action='store_true', parser.add_argument('--allow-pv', action='store_true',
help='Allow setting virt_mode to pv in configuration file.') 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'], parser.add_argument('action', choices=['post-install', 'pre-remove'],
help='Action to perform') help='Action to perform')
parser.add_argument('name', action='store', parser.add_argument('name', action='store',
@ -259,7 +261,8 @@ def post_install(args):
vm = app.add_new_vm('TemplateVM', vm = app.add_new_vm('TemplateVM',
name=args.name, name=args.name,
label=qubesadmin.config.defaults['template_label']) label=qubesadmin.config.defaults['template_label'],
pool=args.pool)
vm_created = True vm_created = True
vm.log.info('Importing data') vm.log.info('Importing data')