Default to virtio console for supported OS

This could cause issues for people trying unattended non-graphical
kickstart installs and expecting ttyS0 in the guest to be hooked
up to the default console. So to get back the default behavior, you
can do:

  --console pty
This commit is contained in:
Cole Robinson 2013-10-06 08:53:05 -04:00
parent dae3678d26
commit f44ad5ae05
9 changed files with 44 additions and 23 deletions

View File

@ -64,7 +64,9 @@
</interface>
<input type="tablet" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<console type="pty"/>
<console type="pty">
<target type="virtio"/>
</console>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
@ -137,7 +139,9 @@
</interface>
<input type="tablet" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<console type="pty"/>
<console type="pty">
<target type="virtio"/>
</console>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>

View File

@ -40,7 +40,9 @@
</interface>
<input type="tablet" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<console type="pty"/>
<console type="pty">
<target type="virtio"/>
</console>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>

View File

@ -39,6 +39,8 @@
<model type="virtio"/>
</interface>
<input type="tablet" bus="usb"/>
<console type="pty"/>
<console type="pty">
<target type="virtio"/>
</console>
</devices>
</domain>

View File

@ -43,7 +43,9 @@
</interface>
<input type="tablet" bus="usb"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<console type="pty"/>
<console type="pty">
<target type="virtio"/>
</console>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>

View File

@ -466,18 +466,18 @@ c.add_valid("--nodisks --boot hd --paravirt --arch i686") # 32 on 64 xen
c = vinst.add_category("kvm", "--connect %(KVMURI)s --noautoconsole")
c.add_compare("--os-variant fedora14 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host", "kvm-f14-url") # F14 Directory tree URL install with extra-args
c.add_compare("--os-variant fedora14 --disk %(NEWIMG1)s,size=.01 --location %(TREEDIR)s --extra-args console=ttyS0 --quiet", "quiet-url") # Quiet URL install should make no noise
c.add_compare("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --cpu host", "kvm-f14-url") # F14 Directory tree URL install with extra-args
c.add_compare("--os-variant fedora20 --disk %(NEWIMG1)s,size=.01 --location %(TREEDIR)s --extra-args console=ttyS0 --quiet", "quiet-url") # Quiet URL install should make no noise
c.add_compare("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound --controller usb", "kvm-win2k3-cdrom") # HVM windows install with disk
c.add_compare("--os-variant fedora14 --nodisks --boot hd --paravirt", "kvm-xenner") # xenner
c.add_compare("--os-variant fedora14 --nodisks --boot cdrom --virt-type qemu --cpu Penryn", "qemu-plain") # plain qemu
c.add_compare("--os-variant fedora14 --nodisks --boot network --nographics --arch i686", "qemu-32-on-64") # 32 on 64
c.add_compare("--os-variant fedora14 --nodisks --boot fd --graphics spice --machine pc", "kvm-machine") # kvm machine type 'pc'
c.add_compare("--os-variant fedora14 --nodisks --boot fd --graphics sdl --arch sparc --machine SS-20", "qemu-sparc") # exotic arch + machine type
c.add_compare("--os-variant fedora20 --nodisks --boot hd --paravirt", "kvm-xenner") # xenner
c.add_compare("--os-variant fedora20 --nodisks --boot cdrom --virt-type qemu --cpu Penryn", "qemu-plain") # plain qemu
c.add_compare("--os-variant fedora20 --nodisks --boot network --nographics --arch i686", "qemu-32-on-64") # 32 on 64
c.add_compare("--os-variant fedora20 --nodisks --boot fd --graphics spice --machine pc", "kvm-machine") # kvm machine type 'pc'
c.add_compare("--os-variant fedora20 --nodisks --boot fd --graphics sdl --arch sparc --machine SS-20", "qemu-sparc") # exotic arch + machine type
c.add_compare("--arch armv7l --machine vexpress-a9 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,kernel_args=\"console=ttyAMA0 rw root=/dev/mmcblk0p3\" --disk %(EXISTIMG1)s --nographics", "arm-vexpress-plain", support_check=support.SUPPORT_CONN_DISK_SD)
c.add_compare("--arch armv7l --machine vexpress-a15 --boot kernel=/f19-arm.kernel,initrd=/f19-arm.initrd,dtb=/f19-arm.dtb,kernel_args=\"console=ttyAMA0 rw root=/dev/vda3\" --disk %(EXISTIMG1)s --nographics --os-variant fedora19", "arm-vexpress-f19", support_check=support.SUPPORT_CONN_VIRTIO_MMIO)
c.add_valid("--cdrom %(EXISTIMG2)s --file %(EXISTIMG1)s --os-variant win2k3 --wait 0 --sound") # HVM windows install with disk
c.add_valid("--os-variant fedora14 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --sound") # F14 Directory tree URL install with extra-args
c.add_valid("--os-variant fedora20 --file %(EXISTIMG1)s --location %(TREEDIR)s --extra-args console=ttyS0 --sound") # F14 Directory tree URL install with extra-args
c.add_invalid("--nodisks --boot network --machine foobar") # Unknown machine type
c.add_invalid("--nodisks --boot network --arch mips --virt-type kvm") # Invalid domain type for arch
c.add_invalid("--nodisks --boot network --paravirt --arch mips") # Invalid arch/virt combo

View File

@ -497,6 +497,12 @@ def build_guest_instance(conn, options):
convert_old_disks(options)
cli.convert_old_features(options)
# Install options
guest.installer.extraargs = options.extra
guest.installer.initrd_injections = options.initrd_injections
cli.set_os_variant(guest, options.distro_type, options.distro_variant)
guest.os.init = options.init
# Guest configuration
cli.get_uuid(guest, options.uuid)
cli.get_vcpus(guest, options.vcpus, options.check_cpu)
@ -534,12 +540,6 @@ def build_guest_instance(conn, options):
guest.add_default_video_device()
guest.add_default_usb_controller()
# Install options
cli.set_os_variant(guest, options.distro_type, options.distro_variant)
guest.installer.extraargs = options.extra
guest.installer.initrd_injections = options.initrd_injections
guest.os.init = options.init
# Do this after setting up all optional parameters, so we report error
# about those first.
need_storage, need_install = validate_required_options(options, guest)

View File

@ -526,6 +526,13 @@ class Guest(XMLBuilder):
dev = virtinst.VirtualConsoleDevice(self.conn)
dev.type = dev.TYPE_PTY
if (self.os.is_x86() and
self._lookup_osdict_key("virtioconsole", False) and
self.conn.check_conn_support(
self.conn.SUPPORT_CONN_VIRTIO_CONSOLE)):
dev.target_type = "virtio"
self.add_device(dev)
def add_default_video_device(self):

View File

@ -132,12 +132,14 @@ class _OSVariant(object):
distros we show in virt-manager by default, so old distros aren't
squeezing out current ones.
@three_stage_install: If True, this VM has a 3 stage install, AKA windows.
@xen_disable_acpi: If True, disable acpi/apic for this OS if on old xen.
This corresponds with the SUPPORT_CONN_SKIP_DEFAULT_ACPI check
@virtionet: If True, this OS supports virtionet out of the box
@virtiodisk: If True, this OS supports virtiodisk out of the box
@virtiommio: If True, this OS supports virtio-mmio out of the box,
which provides virtio for certain ARM configurations
@virtioconsole: If True, this OS supports virtio-console out of the box,
and we should use it as the default console.
@xen_disable_acpi: If True, disable acpi/apic for this OS if on old xen.
This corresponds with the SUPPORT_CONN_SKIP_DEFAULT_ACPI check
The rest of the parameters are about setting device/guest defaults
based on the OS. They should be self explanatory. See guest.py for
@ -152,7 +154,7 @@ class _OSVariant(object):
inputtype=_SENTINEL, inputbus=_SENTINEL,
videomodel=_SENTINEL, virtionet=_SENTINEL,
virtiodisk=_SENTINEL, virtiommio=_SENTINEL,
xen_disable_acpi=_SENTINEL):
virtioconsole=_SENTINEL, xen_disable_acpi=_SENTINEL):
if is_type:
if parent != _SENTINEL:
raise RuntimeError("OS types must not specify parent")
@ -210,6 +212,7 @@ class _OSVariant(object):
self.virtiodisk = _get_default("virtiodisk", virtiodisk)
self.virtionet = _get_default("virtionet", virtionet)
self.virtiommio = _get_default("virtiommio", virtiommio)
self.virtioconsole = _get_default("virtioconsole", virtioconsole)
def _add_type(*args, **kwargs):
@ -247,7 +250,7 @@ _add_var("fedora14", "Fedora 14", parent="fedora13")
_add_var("fedora15", "Fedora 15", parent="fedora14")
_add_var("fedora16", "Fedora 16", parent="fedora15")
_add_var("fedora17", "Fedora 17", parent="fedora16")
_add_var("fedora18", "Fedora 18", supported=True, parent="fedora17")
_add_var("fedora18", "Fedora 18", supported=True, virtioconsole=True, parent="fedora17")
_add_var("fedora19", "Fedora 19", virtiommio=True, parent="fedora18")
_add_var("fedora20", "Fedora 20", parent="fedora19")

View File

@ -296,6 +296,7 @@ SUPPORT_CONN_FILESYSTEM = _make(
SUPPORT_CONN_AUTOSOCKET = _make(drv_libvirt_version=[("qemu", 1000006)])
SUPPORT_CONN_ADVANCED_CLOCK = _make(
drv_libvirt_version=[("qemu", 8000)])
SUPPORT_CONN_VIRTIO_CONSOLE = _make(drv_libvirt_version=[("qemu", 8003)])
# Domain checks