mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-install: Print when we set default memory and disk
Since we never defaulted here before, print out the values we are setting. Users can see right away if they actually want those values or not.
This commit is contained in:
parent
cb0e37786f
commit
13b3790829
@ -0,0 +1,116 @@
|
||||
<domain type="test">
|
||||
<name>fedora26</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<metadata>
|
||||
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||
<libosinfo:os id="http://fedoraproject.org/fedora/26"/>
|
||||
</libosinfo:libosinfo>
|
||||
</metadata>
|
||||
<memory>2097152</memory>
|
||||
<currentMemory>2097152</currentMemory>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="i686">hvm</type>
|
||||
<boot dev="network"/>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<features>
|
||||
<pae/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<clock offset="utc"/>
|
||||
<on_reboot>destroy</on_reboot>
|
||||
<pm>
|
||||
<suspend-to-mem enabled="no"/>
|
||||
<suspend-to-disk enabled="no"/>
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/test-hv</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<source file="/var/lib/libvirt/images/fedora26.qcow2"/>
|
||||
<target dev="hda" bus="ide"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="ich9-ehci1"/>
|
||||
<controller type="usb" index="0" model="ich9-uhci1">
|
||||
<master startport="0"/>
|
||||
</controller>
|
||||
<controller type="usb" index="0" model="ich9-uhci2">
|
||||
<master startport="2"/>
|
||||
</controller>
|
||||
<controller type="usb" index="0" model="ich9-uhci3">
|
||||
<master startport="4"/>
|
||||
</controller>
|
||||
<interface type="user">
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<model type="e1000"/>
|
||||
</interface>
|
||||
<console type="pty"/>
|
||||
<input type="tablet" bus="usb"/>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
|
||||
<image compression="off"/>
|
||||
</graphics>
|
||||
<sound model="ich6"/>
|
||||
<video>
|
||||
<model type="qxl"/>
|
||||
</video>
|
||||
<redirdev bus="usb" type="spicevmc"/>
|
||||
<redirdev bus="usb" type="spicevmc"/>
|
||||
</devices>
|
||||
</domain>
|
||||
<domain type="test">
|
||||
<name>fedora26</name>
|
||||
<uuid>00000000-1111-2222-3333-444444444444</uuid>
|
||||
<metadata>
|
||||
<libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
|
||||
<libosinfo:os id="http://fedoraproject.org/fedora/26"/>
|
||||
</libosinfo:libosinfo>
|
||||
</metadata>
|
||||
<memory>2097152</memory>
|
||||
<currentMemory>2097152</currentMemory>
|
||||
<vcpu>2</vcpu>
|
||||
<os>
|
||||
<type arch="i686">hvm</type>
|
||||
<boot dev="hd"/>
|
||||
</os>
|
||||
<features>
|
||||
<pae/>
|
||||
<vmport state="off"/>
|
||||
</features>
|
||||
<clock offset="utc"/>
|
||||
<pm>
|
||||
<suspend-to-mem enabled="no"/>
|
||||
<suspend-to-disk enabled="no"/>
|
||||
</pm>
|
||||
<devices>
|
||||
<emulator>/usr/bin/test-hv</emulator>
|
||||
<disk type="file" device="disk">
|
||||
<source file="/var/lib/libvirt/images/fedora26.qcow2"/>
|
||||
<target dev="hda" bus="ide"/>
|
||||
</disk>
|
||||
<controller type="usb" index="0" model="ich9-ehci1"/>
|
||||
<controller type="usb" index="0" model="ich9-uhci1">
|
||||
<master startport="0"/>
|
||||
</controller>
|
||||
<controller type="usb" index="0" model="ich9-uhci2">
|
||||
<master startport="2"/>
|
||||
</controller>
|
||||
<controller type="usb" index="0" model="ich9-uhci3">
|
||||
<master startport="4"/>
|
||||
</controller>
|
||||
<interface type="user">
|
||||
<mac address="00:11:22:33:44:55"/>
|
||||
<model type="e1000"/>
|
||||
</interface>
|
||||
<console type="pty"/>
|
||||
<input type="tablet" bus="usb"/>
|
||||
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
|
||||
<image compression="off"/>
|
||||
</graphics>
|
||||
<sound model="ich6"/>
|
||||
<video>
|
||||
<model type="qxl"/>
|
||||
</video>
|
||||
<redirdev bus="usb" type="spicevmc"/>
|
||||
<redirdev bus="usb" type="spicevmc"/>
|
||||
</devices>
|
||||
</domain>
|
@ -0,0 +1,6 @@
|
||||
Using default --name fedora26
|
||||
Using fedora26 default --memory 2048
|
||||
Using fedora26 default --disk size=20
|
||||
ERROR
|
||||
An install method must be specified
|
||||
(--location URL, --cdrom CD/ISO, --pxe, --import, --boot hd|cdrom|...)
|
@ -834,6 +834,8 @@ c.add_invalid("--paravirt --import --print-xml 2") # PV Import install, no seco
|
||||
|
||||
c = vinst.add_category("misc-install", "--nographics --noautoconsole")
|
||||
c.add_compare("--connect %s" % (utils.URIs.test_suite), "noargs-fail", use_default_args=False) # No arguments
|
||||
c.add_compare("--connect %s --os-variant fedora26" % (utils.URIs.test_suite), "osvariant-noargs-fail", use_default_args=False) # No arguments
|
||||
c.add_compare("--connect %s --os-variant fedora26 --pxe --print-xml" % (utils.URIs.test_suite), "osvariant-defaults-pxe", use_default_args=False) # No arguments
|
||||
c.add_valid("--panic help --disk=? --check=help", grep="path_in_use") # Make sure introspection doesn't blow up
|
||||
c.add_valid("--test-stub-command") # --test-stub-command
|
||||
c.add_valid("--nodisks --pxe", grep="VM performance may suffer") # os variant warning
|
||||
|
10
virt-install
10
virt-install
@ -538,17 +538,25 @@ def set_cli_defaults(options, guest):
|
||||
ncpus = res.get_recommended_ncpus(guest.os.arch)
|
||||
|
||||
if ram and not memory_specified(guest):
|
||||
mbram = str(ram / (1024 * 1024)).rstrip("0").rstrip(".")
|
||||
cli.print_stdout(
|
||||
_("Using {os_name} default --memory {megabytes}").format(
|
||||
os_name=guest.osinfo.name, megabytes=mbram))
|
||||
guest.currentMemory = ram // 1024
|
||||
|
||||
if ncpus:
|
||||
# We need to do this upfront, so we don't incorrectly set guest.vcpus
|
||||
guest.sync_vcpus_topology()
|
||||
if not guest.vcpus:
|
||||
# I don't think we need to print anything here as this was never
|
||||
# a required value.
|
||||
guest.vcpus = ncpus
|
||||
|
||||
if storage and not storage_specified(options, guest):
|
||||
diskstr = 'size=%d' % (storage // (1024 ** 3))
|
||||
logging.debug("Generated default libosinfo '--disk %s'", diskstr)
|
||||
cli.print_stdout(
|
||||
_("Using {os_name} default --disk {disk_options}".format(
|
||||
os_name=guest.osinfo.name, disk_options=diskstr)))
|
||||
options.disk = [diskstr]
|
||||
cli.ParserDisk(diskstr, guest=guest).parse(None)
|
||||
|
||||
|
@ -263,6 +263,7 @@ def fail(msg, do_exit=True):
|
||||
|
||||
|
||||
def print_stdout(msg, do_force=False):
|
||||
logging.debug(msg)
|
||||
if do_force or not get_global_state().quiet:
|
||||
print(msg)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user