mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
qemu: Generate channel target paths on hotplug as well
Since commit 714080791778e3dfbd484ccb3953bffd820b8ba9, qemu agent channel cannot be plugged in because we won't generate its path automatically. Let's not only fix that, but also add tests for it so next time it's checked for. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1322210 Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
f371704708
commit
326e5941cd
@ -1502,6 +1502,10 @@ int qemuDomainAttachChrDevice(virQEMUDriverPtr driver,
|
||||
char *charAlias = NULL;
|
||||
bool need_release = false;
|
||||
|
||||
if (chr->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
|
||||
qemuDomainPrepareChannel(chr, priv->channelTargetDir) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuAssignDeviceChrAlias(vmdef, chr, -1) < 0)
|
||||
goto cleanup;
|
||||
|
||||
|
@ -487,6 +487,13 @@ mymain(void)
|
||||
"device_del", QMP_DEVICE_DELETED("scsi0-0-0-5") QMP_OK,
|
||||
"human-monitor-command", HMP(""));
|
||||
|
||||
DO_TEST_ATTACH("hotplug-base-live", "qemu-agent", false, true,
|
||||
"chardev-add", QMP_OK,
|
||||
"device_add", QMP_OK);
|
||||
DO_TEST_DETACH("hotplug-base-live", "qemu-agent-detach", false, false,
|
||||
"device_del", QMP_OK,
|
||||
"chardev-remove", QMP_OK);
|
||||
|
||||
qemuTestDriverFree(&driver);
|
||||
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||
}
|
||||
|
@ -0,0 +1,58 @@
|
||||
<domain type='kvm' id='7'>
|
||||
<name>hotplug</name>
|
||||
<uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
|
||||
<memory unit='KiB'>4194304</memory>
|
||||
<currentMemory unit='KiB'>4194304</currentMemory>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/libexec/qemu-kvm</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<alias name='usb'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<alias name='ide'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='scsi' index='0' model='virtio-scsi'>
|
||||
<alias name='scsi0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'>
|
||||
<alias name='pci'/>
|
||||
</controller>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<channel type='unix'>
|
||||
<source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-7-hotplug/org.qemu.guest_agent.0'/>
|
||||
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
||||
<alias name='channel0'/>
|
||||
<address type='virtio-serial' controller='0' bus='0' port='1'/>
|
||||
</channel>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'>
|
||||
<alias name='balloon0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
<seclabel type='none' model='none'/>
|
||||
</domain>
|
@ -0,0 +1,58 @@
|
||||
<domain type='kvm' id='7'>
|
||||
<name>hotplug</name>
|
||||
<uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
|
||||
<memory unit='KiB'>4194304</memory>
|
||||
<currentMemory unit='KiB'>4194304</currentMemory>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/libexec/qemu-kvm</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<alias name='usb'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<alias name='ide'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='scsi' index='0' model='virtio-scsi'>
|
||||
<alias name='scsi0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'>
|
||||
<alias name='pci'/>
|
||||
</controller>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<channel type='unix'>
|
||||
<source mode='bind' path='/tmp/channel/domain-7-hotplug/org.qemu.guest_agent.0'/>
|
||||
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
||||
<alias name='channel0'/>
|
||||
<address type='virtio-serial' controller='0' bus='0' port='1'/>
|
||||
</channel>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'>
|
||||
<alias name='balloon0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
<seclabel type='none' model='none'/>
|
||||
</domain>
|
@ -0,0 +1,58 @@
|
||||
<domain type='kvm' id='7'>
|
||||
<name>hotplug</name>
|
||||
<uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
|
||||
<memory unit='KiB'>4194304</memory>
|
||||
<currentMemory unit='KiB'>4194304</currentMemory>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/libexec/qemu-kvm</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<alias name='usb'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<alias name='ide'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='scsi' index='0' model='virtio-scsi'>
|
||||
<alias name='scsi0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'>
|
||||
<alias name='pci'/>
|
||||
</controller>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<channel type='unix'>
|
||||
<source mode='bind' path='/var/lib/libvirt/qemu/channel/target/domain-7-hotplug/org.qemu.guest_agent.0'/>
|
||||
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
||||
<alias name='channel0'/>
|
||||
<address type='virtio-serial' controller='0' bus='0' port='1'/>
|
||||
</channel>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'>
|
||||
<alias name='balloon0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
<seclabel type='none' model='none'/>
|
||||
</domain>
|
@ -0,0 +1,58 @@
|
||||
<domain type='kvm' id='7'>
|
||||
<name>hotplug</name>
|
||||
<uuid>d091ea82-29e6-2e34-3005-f02617b36e87</uuid>
|
||||
<memory unit='KiB'>4194304</memory>
|
||||
<currentMemory unit='KiB'>4194304</currentMemory>
|
||||
<vcpu placement='static'>4</vcpu>
|
||||
<os>
|
||||
<type arch='x86_64' machine='pc'>hvm</type>
|
||||
<boot dev='hd'/>
|
||||
</os>
|
||||
<features>
|
||||
<acpi/>
|
||||
<apic/>
|
||||
<pae/>
|
||||
</features>
|
||||
<clock offset='utc'/>
|
||||
<on_poweroff>destroy</on_poweroff>
|
||||
<on_reboot>restart</on_reboot>
|
||||
<on_crash>restart</on_crash>
|
||||
<devices>
|
||||
<emulator>/usr/libexec/qemu-kvm</emulator>
|
||||
<controller type='usb' index='0'>
|
||||
<alias name='usb'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
|
||||
</controller>
|
||||
<controller type='ide' index='0'>
|
||||
<alias name='ide'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
|
||||
</controller>
|
||||
<controller type='scsi' index='0' model='virtio-scsi'>
|
||||
<alias name='scsi0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
|
||||
</controller>
|
||||
<controller type='pci' index='0' model='pci-root'>
|
||||
<alias name='pci'/>
|
||||
</controller>
|
||||
<controller type='virtio-serial' index='0'>
|
||||
<alias name='virtio-serial0'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</controller>
|
||||
<channel type='unix'>
|
||||
<source mode='bind' path='/tmp/channel/domain-7-hotplug/org.qemu.guest_agent.0'/>
|
||||
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
||||
<alias name='channel0'/>
|
||||
<address type='virtio-serial' controller='0' bus='0' port='1'/>
|
||||
</channel>
|
||||
<input type='mouse' bus='ps2'>
|
||||
<alias name='input0'/>
|
||||
</input>
|
||||
<input type='keyboard' bus='ps2'>
|
||||
<alias name='input1'/>
|
||||
</input>
|
||||
<memballoon model='none'>
|
||||
<alias name='balloon0'/>
|
||||
</memballoon>
|
||||
</devices>
|
||||
<seclabel type='none' model='none'/>
|
||||
</domain>
|
@ -0,0 +1,5 @@
|
||||
<channel type='unix'>
|
||||
<source mode='bind' path='/tmp/channel/domain-7-hotplug/org.qemu.guest_agent.0'/>
|
||||
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
||||
<address type='virtio-serial' controller='0' bus='0' port='1'/>
|
||||
</channel>
|
5
tests/qemuhotplugtestdata/qemuhotplug-qemu-agent.xml
Normal file
5
tests/qemuhotplugtestdata/qemuhotplug-qemu-agent.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<channel type='unix'>
|
||||
<source mode='bind'/>
|
||||
<target type='virtio' name='org.qemu.guest_agent.0'/>
|
||||
<address type='virtio-serial' controller='0' bus='0' port='1'/>
|
||||
</channel>
|
Loading…
x
Reference in New Issue
Block a user