Add qemu-guest-agent channel automatically for supported OS

This commit is contained in:
Cole Robinson 2013-10-06 09:19:59 -04:00
parent f44ad5ae05
commit 18fa751059
11 changed files with 54 additions and 2 deletions

View File

@ -33,5 +33,9 @@
<model type="virtio"/>
</interface>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
</devices>
</domain>

View File

@ -67,6 +67,10 @@
<console type="pty">
<target type="virtio"/>
</console>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>
@ -142,6 +146,10 @@
<console type="pty">
<target type="virtio"/>
</console>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>

View File

@ -43,6 +43,10 @@
<console type="pty">
<target type="virtio"/>
</console>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>

View File

@ -25,6 +25,10 @@
</interface>
<input type="mouse" bus="xen"/>
<graphics type="spice" port="-1" tlsPort="-1" autoport="yes"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>

View File

@ -42,5 +42,9 @@
<console type="pty">
<target type="virtio"/>
</console>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
</devices>
</domain>

View File

@ -46,6 +46,10 @@
<console type="pty">
<target type="virtio"/>
</console>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<channel type="spicevmc">
<target type="virtio" name="com.redhat.spice.0"/>
</channel>

View File

@ -25,6 +25,10 @@
</interface>
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>
<console type="pty"/>
<channel type="unix">
<source mode="bind"/>
<target type="virtio" name="org.qemu.guest_agent.0"/>
</channel>
<video>
<model type="cirrus"/>
</video>

View File

@ -539,6 +539,7 @@ def build_guest_instance(conn, options):
guest.add_default_console_device()
guest.add_default_video_device()
guest.add_default_usb_controller()
guest.add_default_channels()
# Do this after setting up all optional parameters, so we report error
# about those first.

View File

@ -1495,6 +1495,7 @@ class vmmCreate(vmmGObjectUI):
if self.config.get_new_vm_sound():
guest.add_default_sound_device()
guest.add_default_usb_controller()
guest.add_default_channels()
except Exception, e:
self.err.show_err(_("Error setting up default devices:") + str(e))
return None

View File

@ -557,6 +557,19 @@ class Guest(XMLBuilder):
for dev in virtinst.VirtualController.get_usb2_controllers(self.conn):
self.add_device(dev)
def add_default_channels(self):
if self.get_devices("channel"):
return
if (self.conn.is_qemu() and
self._lookup_osdict_key("qemu_ga", False) and
self.conn.check_conn_support(self.conn.SUPPORT_CONN_AUTOSOCKET)):
dev = virtinst.VirtualChannelDevice(self.conn)
dev.type = "unix"
dev.target_type = "virtio"
dev.target_name = dev.CHANNEL_NAME_QEMUGA
self.add_device(dev)
def _set_transient_device_defaults(self, install):
def do_remove_media(d):
# Keep cdrom around, but with no media attached,

View File

@ -97,6 +97,8 @@ def list_os(list_types=False, typename=None,
def lookup_osdict_key(variant, key, default):
val = _SENTINEL
if variant is not None:
if not hasattr(_allvariants[variant], key):
raise ValueError("Unknown osdict property '%s'" % key)
val = getattr(_allvariants[variant], key)
if val == _SENTINEL:
val = default
@ -140,6 +142,7 @@ class _OSVariant(object):
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
@qemu_ga: If True, this distro has qemu_ga available by default
The rest of the parameters are about setting device/guest defaults
based on the OS. They should be self explanatory. See guest.py for
@ -154,7 +157,8 @@ class _OSVariant(object):
inputtype=_SENTINEL, inputbus=_SENTINEL,
videomodel=_SENTINEL, virtionet=_SENTINEL,
virtiodisk=_SENTINEL, virtiommio=_SENTINEL,
virtioconsole=_SENTINEL, xen_disable_acpi=_SENTINEL):
virtioconsole=_SENTINEL, xen_disable_acpi=_SENTINEL,
qemu_ga=_SENTINEL):
if is_type:
if parent != _SENTINEL:
raise RuntimeError("OS types must not specify parent")
@ -213,6 +217,7 @@ class _OSVariant(object):
self.virtionet = _get_default("virtionet", virtionet)
self.virtiommio = _get_default("virtiommio", virtiommio)
self.virtioconsole = _get_default("virtioconsole", virtioconsole)
self.qemu_ga = _get_default("qemu_ga", qemu_ga)
def _add_type(*args, **kwargs):
@ -250,7 +255,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, virtioconsole=True, parent="fedora17")
_add_var("fedora18", "Fedora 18", supported=True, virtioconsole=True, qemu_ga=True, parent="fedora17")
_add_var("fedora19", "Fedora 19", virtiommio=True, parent="fedora18")
_add_var("fedora20", "Fedora 20", parent="fedora19")