Load machine type from command-line

Change-Id: Ib2bdac78e0eb4043e2a2f86244ea168641571817
This commit is contained in:
cid 2024-04-16 00:27:30 +01:00
parent 668dd24108
commit 211e007472
2 changed files with 4 additions and 1 deletions

View File

@ -65,6 +65,8 @@ def main():
help='The virtualization engine to use') help='The virtualization engine to use')
parser.add_argument('--arch', default='i686', parser.add_argument('--arch', default='i686',
help='The architecture to use') help='The architecture to use')
parser.add_argument('--machine_type', default='q35',
help='Machine type based on architecture')
parser.add_argument('--memory', default='2097152', parser.add_argument('--memory', default='2097152',
help="Maximum memory for the VM in KB.") help="Maximum memory for the VM in KB.")
parser.add_argument('--cpus', default='1', parser.add_argument('--cpus', default='1',
@ -104,6 +106,7 @@ def main():
'images': images, 'images': images,
'engine': args.engine, 'engine': args.engine,
'arch': args.arch, 'arch': args.arch,
'machine_type': args.machine_type,
'memory': args.memory, 'memory': args.memory,
'cpus': args.cpus, 'cpus': args.cpus,
'bootdev': args.bootdev, 'bootdev': args.bootdev,

View File

@ -3,7 +3,7 @@
<memory unit='KiB'>{{ memory }}</memory> <memory unit='KiB'>{{ memory }}</memory>
<vcpu>{{ cpus }}</vcpu> <vcpu>{{ cpus }}</vcpu>
<os> <os>
<type arch='{{ arch }}' machine='q35'>hvm</type> <type arch='{{ arch }}' machine='{{ machine_type }}'>hvm</type>
{% if bootdev == 'network' and not uefi_loader %} {% if bootdev == 'network' and not uefi_loader %}
<boot dev='{{ bootdev }}'/> <boot dev='{{ bootdev }}'/>
{% endif %} {% endif %}