[libvirt] [PATCH RFC 0/5] lxc: Add save/restore support to lxc driver
by Katerina Koukiou
This patch series adds support for saving an running lxc domain's state into
files with lxcDomainSave and restore afterwards from files with lxcDomainRestore.
Usage: virsh save [domain-name] [domain-id or domain-uuid] [directory name]
I use CRIU tool (https://criu.org/Main_Page), that offers checkpoint/restore
functionality for containers in userspace.
For the time, I have tried successfully the C/R procedure for simple sh containers
and OS containers.
I'll mention some notes/issues here:
*I have working C/R only for non systemd hosts (on systemd host I was facing
problems with CRIU).
*I have not done anything for container networking. Thats should be done with
--veth-pair IN=OUT option in CRIU.
*In new distros, where efivars mountpoint exists, CRIU dump fails.
*The only tty restored is /dev/tty1. I'll fix this in another patch, to allow more ttys.
*Currently for things to work, I have slightly modified criu source. That is in criu master
I have the following diff:
diff --git a/criu/tty.c b/criu/tty.c
index 302dd54..2226484 100644
--- a/criu/tty.c
+++ b/criu/tty.c
@@ -1394,8 +1394,10 @@ static int verify_info(struct tty_info *info)
*/
if (term_opts_missing_any(info)) {
if (tty_is_master(info)) {
+ /*
pr_err("Corrupted master peer %x\n", info->tfe->id);
return -1;
+ */
} else if (!term_opts_missing_all(info)) {
pr_err("Corrupted slave peer %x\n", info->tfe->id);
return -1;
Lastly, I have ready a patch that adds support for migration but I wait for
feedback on this series, and I'll send the migration one later.
Anyway, any comments here are more than welcome.
ps: That is a work in terms of my GSoC 2016 project.
Katerina Koukiou (5):
Include criu support in autotools
lxc: make container's init process session leader
lxc: adds checkpoint and restore helper functions
lxc: adjusted libvirt-lxc process to add restore mode to it.
lxc: adds save and restore support
configure.ac | 8 ++
po/POTFILES.in | 1 +
src/Makefile.am | 6 +-
src/lxc/lxc_container.c | 208 ++++++++++++++++++++++++++++++++++--
src/lxc/lxc_container.h | 3 +-
src/lxc/lxc_controller.c | 109 +++++++++++++++++--
src/lxc/lxc_criu.c | 273 +++++++++++++++++++++++++++++++++++++++++++++++
src/lxc/lxc_criu.h | 34 ++++++
src/lxc/lxc_driver.c | 238 ++++++++++++++++++++++++++++++++++++++++-
src/lxc/lxc_process.c | 23 +++-
src/lxc/lxc_process.h | 1 +
11 files changed, 883 insertions(+), 21 deletions(-)
create mode 100644 src/lxc/lxc_criu.c
create mode 100644 src/lxc/lxc_criu.h
--
2.7.3
8 years, 5 months
[libvirt] [PATCH v2] qemuhotplugtest: Add tests for ccw devices
by Tomasz Flendrich
There's a plan to rework the address handling, so testcases
that verify hotplugging ccw devices will help in avoiding
regression.
In this commit, some device files are duplicated because
of the way qemuhotplug.c calculates the expected xml filenames.
I plan on changing that to explicitly stating the basis domain
xml, the device xml, and the expected xml.
---
Changes in v2:
* the target dev in the first attachment is changed from vde2 to hda,
so the device is now something hopefully valid and there are no duplicated
aliases
* the target dev in the second attachment is changed from vde to hdb,
so now it's different than the device that was previously under this address.
I did it to make sure that it's a completely new device.
tests/qemuhotplugtest.c | 37 +++++++++++
.../qemuhotplug-ccw-virtio-1-explicit.xml | 8 +++
.../qemuhotplug-ccw-virtio-1-reverse.xml | 7 +++
.../qemuhotplug-ccw-virtio-2-explicit.xml | 8 +++
.../qemuhotplug-ccw-virtio-2.xml | 8 +++
.../qemuhotplug-ccw-virtio.xml | 8 +++
.../qemuhotplug-base-ccw-live+ccw-virtio.xml | 63 +++++++++++++++++++
...ive-with-2-ccw-virtio+ccw-virtio-1-explicit.xml | 73 ++++++++++++++++++++++
...live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml | 73 ++++++++++++++++++++++
...qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml | 63 +++++++++++++++++++
...-live-with-ccw-virtio+ccw-virtio-2-explicit.xml | 73 ++++++++++++++++++++++
...-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml | 73 ++++++++++++++++++++++
.../qemuhotplug-base-ccw-live-with-ccw-virtio.xml | 63 +++++++++++++++++++
.../qemuhotplug-base-ccw-live.xml | 53 ++++++++++++++++
14 files changed, 610 insertions(+)
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-1-explicit.xml
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-1-reverse.xml
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-2-explicit.xml
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-2.xml
create mode 100644 tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
create mode 100644 tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index f2e7567..0a5f068 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -73,6 +73,7 @@ qemuHotplugCreateObjects(virDomainXMLOptionPtr xmlopt,
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_SCSI);
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_USB_STORAGE);
+ virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW);
if (event)
virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_DEVICE_DEL_EVENT);
@@ -523,6 +524,42 @@ mymain(void)
"device_del", QMP_OK,
"chardev-remove", QMP_OK);
+ DO_TEST_ATTACH("base-ccw-live", "ccw-virtio", false, true,
+ "human-monitor-command", HMP("OK\\r\\n"),
+ "device_add", QMP_OK);
+ DO_TEST_DETACH("base-ccw-live", "ccw-virtio", false, false,
+ "device_del", QMP_OK,
+ "human-monitor-command", HMP(""));
+
+ DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, true,
+ "human-monitor-command", HMP("OK\\r\\n"),
+ "device_add", QMP_OK);
+
+ DO_TEST_DETACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2", false, false,
+ "device_del", QMP_OK,
+ "human-monitor-command", HMP(""));
+
+ DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true,
+ "human-monitor-command", HMP("OK\\r\\n"),
+ "device_add", QMP_OK);
+
+ DO_TEST_DETACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, false,
+ "device_del", QMP_OK,
+ "human-monitor-command", HMP(""));
+
+ /* Attach a second device, then detach the first one. Then attach the first one again. */
+ DO_TEST_ATTACH("base-ccw-live-with-ccw-virtio", "ccw-virtio-2-explicit", false, true,
+ "human-monitor-command", HMP("OK\\r\\n"),
+ "device_add", QMP_OK);
+
+ DO_TEST_DETACH("base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-explicit", false, true,
+ "device_del", QMP_OK,
+ "human-monitor-command", HMP(""));
+
+ DO_TEST_ATTACH("base-ccw-live-with-2-ccw-virtio", "ccw-virtio-1-reverse", false, false,
+ "human-monitor-command", HMP("OK\\r\\n"),
+ "device_add", QMP_OK);
+
qemuTestDriverFree(&driver);
return (ret == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-1-explicit.xml b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-1-explicit.xml
new file mode 100644
index 0000000..74bd6a9
--- /dev/null
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-1-explicit.xml
@@ -0,0 +1,8 @@
+<disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <target dev='vde' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+</disk>
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-1-reverse.xml b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-1-reverse.xml
new file mode 100644
index 0000000..d62e8a4
--- /dev/null
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-1-reverse.xml
@@ -0,0 +1,7 @@
+<disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <target dev='hdb' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+</disk>
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-2-explicit.xml b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-2-explicit.xml
new file mode 100644
index 0000000..93e38e2
--- /dev/null
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-2-explicit.xml
@@ -0,0 +1,8 @@
+<disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <target dev='hda' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+</disk>
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-2.xml b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-2.xml
new file mode 100644
index 0000000..ebcbfa0
--- /dev/null
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio-2.xml
@@ -0,0 +1,8 @@
+<disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <target dev='vde2' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <address type='ccw'/>
+</disk>
diff --git a/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio.xml b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio.xml
new file mode 100644
index 0000000..7cf469e
--- /dev/null
+++ b/tests/qemuhotplugtestdevices/qemuhotplug-ccw-virtio.xml
@@ -0,0 +1,8 @@
+<disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <target dev='vde' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <address type='ccw'/>
+</disk>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
new file mode 100644
index 0000000..2a27e11
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live+ccw-virtio.xml
@@ -0,0 +1,63 @@
+<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='s390x' machine='s390-ccw'>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>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='vde' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk4'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </disk>
+ <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='ide0'/>
+ <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>
+ <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>
+ <panic model='s390'/>
+ </devices>
+ <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
new file mode 100644
index 0000000..1683174
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-explicit.xml
@@ -0,0 +1,73 @@
+<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='s390x' machine='s390-ccw'>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>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='vde' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk4'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='hda' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk0'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </disk>
+ <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='ide0'/>
+ <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>
+ <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>
+ <panic model='s390'/>
+ </devices>
+ <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
new file mode 100644
index 0000000..7d2c3ab
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio+ccw-virtio-1-reverse.xml
@@ -0,0 +1,73 @@
+<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='s390x' machine='s390-ccw'>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>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='hda' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk0'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='hdb' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk1'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </disk>
+ <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='ide0'/>
+ <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>
+ <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>
+ <panic model='s390'/>
+ </devices>
+ <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
new file mode 100644
index 0000000..0821028
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-2-ccw-virtio.xml
@@ -0,0 +1,63 @@
+<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='s390x' machine='s390-ccw'>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>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='hda' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk0'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </disk>
+ <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='ide0'/>
+ <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>
+ <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>
+ <panic model='s390'/>
+ </devices>
+ <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
new file mode 100644
index 0000000..a262b9f
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2-explicit.xml
@@ -0,0 +1,73 @@
+<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='s390x' machine='s390-ccw'>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>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='hda' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk0'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='vde' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk4'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </disk>
+ <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='ide0'/>
+ <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>
+ <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>
+ <panic model='s390'/>
+ </devices>
+ <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
new file mode 100644
index 0000000..ff94b6c
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio+ccw-virtio-2.xml
@@ -0,0 +1,73 @@
+<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='s390x' machine='s390-ccw'>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>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='vde' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk4'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </disk>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='vde2' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk4'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0001'/>
+ </disk>
+ <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='ide0'/>
+ <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>
+ <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>
+ <panic model='s390'/>
+ </devices>
+ <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
new file mode 100644
index 0000000..2a27e11
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live-with-ccw-virtio.xml
@@ -0,0 +1,63 @@
+<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='s390x' machine='s390-ccw'>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>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw' cache='none'/>
+ <source file='/dev/null'/>
+ <backingStore/>
+ <target dev='vde' bus='virtio'/>
+ <readonly/>
+ <shareable/>
+ <alias name='virtio-disk4'/>
+ <address type='ccw' cssid='0xfe' ssid='0x0' devno='0x0000'/>
+ </disk>
+ <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='ide0'/>
+ <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>
+ <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>
+ <panic model='s390'/>
+ </devices>
+ <seclabel type='none' model='none'/>
+</domain>
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
new file mode 100644
index 0000000..17a0dc2
--- /dev/null
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-ccw-live.xml
@@ -0,0 +1,53 @@
+<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='s390x' machine='s390-ccw'>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='ide0'/>
+ <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>
+ <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>
+ <panic model='s390'/>
+ </devices>
+ <seclabel type='none' model='none'/>
+</domain>
--
2.7.4 (Apple Git-66)
8 years, 5 months
[libvirt] [gconfig v6 1/5] gconfig: Add gvir_config_object_has_child
by Zeeshan Ali (Khattak)
From: Christophe Fergeau <cfergeau(a)redhat.com>
---
libvirt-gconfig/libvirt-gconfig-object-private.h | 2 ++
libvirt-gconfig/libvirt-gconfig-object.c | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git a/libvirt-gconfig/libvirt-gconfig-object-private.h b/libvirt-gconfig/libvirt-gconfig-object-private.h
index e91c4ef..7a0d21f 100644
--- a/libvirt-gconfig/libvirt-gconfig-object-private.h
+++ b/libvirt-gconfig/libvirt-gconfig-object-private.h
@@ -117,6 +117,8 @@ GVirConfigObject *gvir_config_object_get_child(GVirConfigObject *object,
GVirConfigObject *gvir_config_object_get_child_with_type(GVirConfigObject *object,
const gchar *child_name,
GType child_type);
+gboolean gvir_config_object_has_child(GVirConfigObject *object,
+ const gchar *child_name);
G_END_DECLS
diff --git a/libvirt-gconfig/libvirt-gconfig-object.c b/libvirt-gconfig/libvirt-gconfig-object.c
index bf328f3..6225de2 100644
--- a/libvirt-gconfig/libvirt-gconfig-object.c
+++ b/libvirt-gconfig/libvirt-gconfig-object.c
@@ -970,3 +970,16 @@ gvir_config_object_get_child(GVirConfigObject *object,
child_name,
GVIR_CONFIG_TYPE_OBJECT);
}
+
+G_GNUC_INTERNAL gboolean
+gvir_config_object_has_child(GVirConfigObject *object, const gchar *child_name)
+{
+ xmlNodePtr node;
+
+ g_return_val_if_fail(GVIR_CONFIG_IS_OBJECT(object), FALSE);
+ g_return_val_if_fail(child_name != NULL, FALSE);
+
+ node = gvir_config_xml_get_element(object->priv->node, child_name, NULL);
+
+ return (node != NULL);
+}
--
2.7.4
8 years, 5 months
[libvirt] [RFC PATCH 0/2] nodeinfo: PPC64: Fix topology and siblings info on capabilities and nodeinfo
by Shivaprasad G Bhat
The nodeinfo output was fixed earlier to reflect the actual cpus available in
KVM mode on PPC64. The earlier fixes covered the aspect of not making a host
look overcommitted when its not. The current fixes are aimed at helping the
users make better decisions on the kind of guest cpu topology that can be
supported on the given sucore_per_core setting of KVM host and also hint the
way to pin the guest vcpus efficiently.
I am planning to add some test cases once the approach is accepted.
With respect to Patch 2:
The second patch adds a new element to the cpus tag and I need your inputs on
if that is okay. Also if there is a better way. I am not sure if the existing
clients have RNG checks that might fail with the approach. Or if the checks
are not enoforced on the elements but only on the tags.
With my approach if the rng checks pass, the new element "capacity" even if
ignored by many clients would have no impact except for PPC64.
To the extent I looked at code, the siblings changes dont affect existing
libvirt functionality. Please do let me know otherwise.
---
Shivaprasad G Bhat (2):
nodeinfo: Reflect guest usable host topology on PPC64
Introduce capacity to virCapsHostNUMACellCPU to help vcpu pinning decisions
src/conf/capabilities.c | 3 +
src/conf/capabilities.h | 1
src/nodeinfo.c | 51 ++++++++++++++++++++++--
tests/vircaps2xmldata/vircaps-basic-4-4-2G.xml | 32 ++++++++-------
tests/vircaps2xmltest.c | 1
5 files changed, 67 insertions(+), 21 deletions(-)
--
Signature
8 years, 5 months
[libvirt] [PATCH] Remove code duplication in domain_addr.c
by Tomasz Flendrich
Two functions, virDomainValidateDevicePCISlotsQ35 and
virDomainValidateDevicePCISlotsPIIX3, had almost exactly the same
code for verifying the PCI address of the primary video device.
The only difference between them was the slot number.
To avoid code duplication, I moved it to a new function:
virDomainValidateVideoDevice.
---
src/conf/domain_addr.c | 218 +++++++++++++++++++++----------------------------
1 file changed, 94 insertions(+), 124 deletions(-)
diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index 7abe44c..9a6f977 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -1391,6 +1391,82 @@ virDomainMachineIsI440FX(const virDomainDef *def)
static int
+virDomainValidateVideoDevice(virDomainDefPtr def,
+ virDomainPCIAddressSetPtr addrs,
+ virDomainPCIConnectFlags flags,
+ bool videoPrimaryEnabled,
+ unsigned int slot)
+{
+ int ret = -1;
+ char *addrStr = NULL;
+ virPCIDeviceAddress tmp_addr;
+
+ if (def->nvideos > 0) {
+ virDomainVideoDefPtr primaryVideo = def->videos[0];
+ if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) {
+ memset(&tmp_addr, 0, sizeof(tmp_addr));
+ tmp_addr.slot = slot;
+
+ if (!(addrStr = virDomainPCIAddressAsString(&tmp_addr)))
+ goto cleanup;
+ if (!virDomainPCIAddressValidate(addrs, &tmp_addr,
+ addrStr, flags, false))
+ goto cleanup;
+
+ if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
+ if (videoPrimaryEnabled) {
+ if (virDomainPCIAddressReserveNextSlot(addrs,
+ &primaryVideo->info,
+ flags) < 0)
+ goto cleanup;
+ } else {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("PCI address 0:0:%u.0 is in use, "
+ "QEMU needs it for primary video"), slot);
+ goto cleanup;
+ }
+ } else {
+ if (virDomainPCIAddressReserveSlot(addrs, &tmp_addr, flags) < 0)
+ goto cleanup;
+ primaryVideo->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
+ primaryVideo->info.addr.pci = tmp_addr;
+ }
+ } else if (!videoPrimaryEnabled) {
+ if (primaryVideo->info.addr.pci.domain != 0 ||
+ primaryVideo->info.addr.pci.bus != 0 ||
+ primaryVideo->info.addr.pci.slot != slot ||
+ primaryVideo->info.addr.pci.function != 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Primary video card must have "
+ "PCI address 0:0:%u.0"), slot);
+ goto cleanup;
+ }
+ /* If TYPE == PCI, then virDomainCollectPCIAddress() function
+ * has already reserved the address, so we must skip */
+ }
+ } else if (addrs->nbuses && !videoPrimaryEnabled) {
+ memset(&tmp_addr, 0, sizeof(tmp_addr));
+ tmp_addr.slot = slot;
+
+ if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
+ VIR_DEBUG("PCI address 0:0:%u.0 in use, future addition of a video"
+ " device will not be possible without manual"
+ " intervention", slot);
+ virResetLastError();
+ } else if (virDomainPCIAddressReserveSlot(addrs, &tmp_addr, flags) < 0) {
+ goto cleanup;
+ }
+ }
+
+ ret = 0;
+
+ cleanup:
+ VIR_FREE(addrStr);
+ return ret;
+}
+
+
+static int
virDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
virDomainPCIAddressSetPtr addrs,
bool videoPrimaryEnabled)
@@ -1398,7 +1474,6 @@ virDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
int ret = -1;
size_t i;
virPCIDeviceAddress tmp_addr;
- char *addrStr = NULL;
virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE
| VIR_PCI_CONNECT_TYPE_PCI_DEVICE);
@@ -1456,69 +1531,17 @@ virDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
goto cleanup;
}
- if (def->nvideos > 0) {
- /* Because the PIIX3 integrated IDE/USB controllers are
- * already at slot 1, when qemu looks for the first free slot
- * to place the VGA controller (which is always the first
- * device added after integrated devices), it *always* ends up
- * at slot 2.
- */
- virDomainVideoDefPtr primaryVideo = def->videos[0];
- if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) {
- memset(&tmp_addr, 0, sizeof(tmp_addr));
- tmp_addr.slot = 2;
-
- if (!(addrStr = virDomainPCIAddressAsString(&tmp_addr)))
- goto cleanup;
- if (!virDomainPCIAddressValidate(addrs, &tmp_addr,
- addrStr, flags, false))
- goto cleanup;
-
- if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
- if (videoPrimaryEnabled) {
- if (virDomainPCIAddressReserveNextSlot(addrs,
- &primaryVideo->info,
- flags) < 0)
- goto cleanup;
- } else {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("PCI address 0:0:2.0 is in use, "
- "QEMU needs it for primary video"));
- goto cleanup;
- }
- } else {
- if (virDomainPCIAddressReserveSlot(addrs, &tmp_addr, flags) < 0)
- goto cleanup;
- primaryVideo->info.addr.pci = tmp_addr;
- primaryVideo->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
- }
- } else if (!videoPrimaryEnabled) {
- if (primaryVideo->info.addr.pci.domain != 0 ||
- primaryVideo->info.addr.pci.bus != 0 ||
- primaryVideo->info.addr.pci.slot != 2 ||
- primaryVideo->info.addr.pci.function != 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Primary video card must have PCI address 0:0:2.0"));
- goto cleanup;
- }
- /* If TYPE == PCI, then virDomainCollectPCIAddress() function
- * has already reserved the address, so we must skip */
- }
- } else if (addrs->nbuses && !videoPrimaryEnabled) {
- memset(&tmp_addr, 0, sizeof(tmp_addr));
- tmp_addr.slot = 2;
-
- if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
- VIR_DEBUG("PCI address 0:0:2.0 in use, future addition of a video"
- " device will not be possible without manual"
- " intervention");
- } else if (virDomainPCIAddressReserveSlot(addrs, &tmp_addr, flags) < 0) {
- goto cleanup;
- }
- }
+ /* Because the PIIX3 integrated IDE/USB controllers are
+ * already at slot 1, when qemu looks for the first free slot
+ * to place the VGA controller (which is always the first
+ * device added after integrated devices), it *always* ends up
+ * at slot 2.
+ */
+ if (virDomainValidateVideoDevice(def, addrs, flags,
+ videoPrimaryEnabled, 2) < 0)
+ goto cleanup;
ret = 0;
cleanup:
- VIR_FREE(addrStr);
return ret;
}
@@ -1531,7 +1554,6 @@ virDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
int ret = -1;
size_t i;
virPCIDeviceAddress tmp_addr;
- char *addrStr = NULL;
virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCIE_DEVICE;
for (i = 0; i < def->ncontrollers; i++) {
@@ -1646,70 +1668,18 @@ virDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
goto cleanup;
}
- if (def->nvideos > 0) {
- /* NB: unlike the pc machinetypes, on q35 machinetypes the
- * integrated devices are at slot 0x1f, so when qemu looks for
- * the first free lot for the first VGA, it will always be at
- * slot 1 (which was used up by the integrated PIIX3 devices
- * on pc machinetypes).
- */
- virDomainVideoDefPtr primaryVideo = def->videos[0];
- if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) {
- memset(&tmp_addr, 0, sizeof(tmp_addr));
- tmp_addr.slot = 1;
-
- if (!(addrStr = virDomainPCIAddressAsString(&tmp_addr)))
- goto cleanup;
- if (!virDomainPCIAddressValidate(addrs, &tmp_addr,
- addrStr, flags, false))
- goto cleanup;
-
- if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
- if (videoPrimaryEnabled) {
- if (virDomainPCIAddressReserveNextSlot(addrs,
- &primaryVideo->info,
- flags) < 0)
- goto cleanup;
- } else {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("PCI address 0:0:1.0 is in use, "
- "QEMU needs it for primary video"));
- goto cleanup;
- }
- } else {
- if (virDomainPCIAddressReserveSlot(addrs, &tmp_addr, flags) < 0)
- goto cleanup;
- primaryVideo->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
- primaryVideo->info.addr.pci = tmp_addr;
- }
- } else if (!videoPrimaryEnabled) {
- if (primaryVideo->info.addr.pci.domain != 0 ||
- primaryVideo->info.addr.pci.bus != 0 ||
- primaryVideo->info.addr.pci.slot != 1 ||
- primaryVideo->info.addr.pci.function != 0) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Primary video card must have PCI address 0:0:1.0"));
- goto cleanup;
- }
- /* If TYPE == PCI, then virDomainCollectPCIAddress() function
- * has already reserved the address, so we must skip */
- }
- } else if (addrs->nbuses && !videoPrimaryEnabled) {
- memset(&tmp_addr, 0, sizeof(tmp_addr));
- tmp_addr.slot = 1;
+ /* NB: unlike the pc machinetypes, on q35 machinetypes the
+ * integrated devices are at slot 0x1f, so when qemu looks for
+ * the first free lot for the first VGA, it will always be at
+ * slot 1 (which was used up by the integrated PIIX3 devices
+ * on pc machinetypes).
+ */
+ if (virDomainValidateVideoDevice(def, addrs, flags,
+ videoPrimaryEnabled, 1) < 0)
+ goto cleanup;
- if (virDomainPCIAddressSlotInUse(addrs, &tmp_addr)) {
- VIR_DEBUG("PCI address 0:0:1.0 in use, future addition of a video"
- " device will not be possible without manual"
- " intervention");
- virResetLastError();
- } else if (virDomainPCIAddressReserveSlot(addrs, &tmp_addr, flags) < 0) {
- goto cleanup;
- }
- }
ret = 0;
cleanup:
- VIR_FREE(addrStr);
return ret;
}
--
2.7.4 (Apple Git-66)
8 years, 5 months
[libvirt] RFC: disk tray opened event and changing media API cooperation
by Nikolay Shirokovskiy
Hi, all.
I want to remove media if disk is ejected from guest. I can leverage tray
opened event for it but this event generated if i change media thru API call
too. Thus I can't just remove media on any such event. However it would be
possible if libvirt do not propagate tray opened event that originates from
qemuDomainUpdateDeviceFlags actions. On this way we need also to close tray
back if it was originally closed so state visible to client is in sync with
actual. I can imagine other cases when closing tray at the end of
qemuDomainUpdateDeviceFlags will be useful. Say implementing a kind of changer
in mgmt layer so that if guest ejects disk mgmt insert next media from some
playlist. In this case tray should be closed so that guest will see that media
is changed.
In short I suggest:
1. close tray at the end of chaning/ejecting media
2. if tray is opened during the operation than mask this event from client
Nikolay
8 years, 5 months
[libvirt] wireshark compilation warning
by Cole Robinson
I'm seeing this compilation warning on Fedora 24, with
wireshark-devel-2.1.0-3.fc24.x86_64 which has the header file fix that was
previously breaking compilation:
CC wireshark/src/wireshark_src_libvirt_la-packet-libvirt.lo
CC wireshark/src/wireshark_src_libvirt_la-plugin.lo
CCLD nss/libnss_libvirt.la
wireshark/src/packet-libvirt.c: In function 'proto_reg_handoff_libvirt':
wireshark/src/packet-libvirt.c:548:46: warning: passing argument 1 of
'create_dissector_handle' from incompatible pointer type
[-Wincompatible-pointer-types]
libvirt_handle = create_dissector_handle(dissect_libvirt, proto_libvirt);
^~~~~~~~~~~~~~~
In file included from wireshark/src/packet-libvirt.c:28:0:
/usr/include/wireshark/epan/packet.h:525:68: note: expected 'dissector_t {aka
int (*)(struct tvbuff *, struct _packet_info *, struct _proto_node *, void
*)}' but argument is of type 'void (*)(tvbuff_t *, packet_info *, proto_tree
*) {aka void (*)(struct tvbuff *, struct _packet_info *, struct _proto_node *)}'
WS_DLL_PUBLIC dissector_handle_t create_dissector_handle(dissector_t dissector,
I can't even find the definition of dissect_libvirt so I assume there's some
weird magic going on here...
Thanks,
Cole
8 years, 5 months
[libvirt] [PATCHv5 0/8] Assign addresses to USB devices
by Ján Tomko
Patches 1-2 from v4 are pushed already.
Patch 5/8 is new, adding new tests.
Patches 6/8 and 8/8 have not been ACKed in the previous version.
Ján Tomko (8):
Introduce virDomainUSBAddressSet
Add functions for adding USB controllers to addrs
Add functions for adding USB hubs to addrs
Reserve existing USB addresses
Add tests for USB address assignment
Assign addresses to USB devices
Assign addresses on USB device hotplug
Auto-add one hub if there are too many USB devices
src/conf/domain_addr.c | 501 +++++++++++++++++++++
src/conf/domain_addr.h | 51 +++
src/libvirt_private.syms | 9 +
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain.h | 1 +
src/qemu/qemu_domain_address.c | 156 ++++++-
src/qemu/qemu_hotplug.c | 27 ++
.../qemuhotplug-base-live+disk-usb.xml | 1 +
.../qemuxml2argvdata/qemuxml2argv-bios-nvram.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-bios.args | 2 +-
.../qemuxml2argv-controller-order.args | 8 +-
.../qemuxml2argv-disk-usb-device-removable.args | 3 +-
.../qemuxml2argv-disk-usb-device.args | 2 +-
.../qemuxml2argv-graphics-spice-timeout.args | 2 +-
.../qemuxml2argv-graphics-spice-usb-redir.args | 2 +-
...muxml2argv-hostdev-usb-address-device-boot.args | 3 +-
.../qemuxml2argv-hostdev-usb-address-device.args | 2 +-
.../qemuxml2argv-hostdev-usb-address.args | 2 +-
.../qemuxml2argv-hugepages-numa.args | 6 +-
.../qemuxml2argv-input-usbmouse.args | 2 +-
.../qemuxml2argv-input-usbtablet.args | 2 +-
.../qemuxml2argv-pseries-usb-kbd.args | 2 +-
.../qemuxml2argv-serial-spiceport.args | 2 +-
.../qemuxml2argv-smartcard-controller.args | 2 +-
.../qemuxml2argv-smartcard-host-certificates.args | 2 +-
.../qemuxml2argv-smartcard-host.args | 2 +-
...emuxml2argv-smartcard-passthrough-spicevmc.args | 2 +-
.../qemuxml2argv-smartcard-passthrough-tcp.args | 2 +-
.../qemuxml2argv-sound-device.args | 2 +-
.../qemuxml2argv-usb-hub-autoadd.args | 28 ++
.../qemuxml2argv-usb-hub-autoadd.xml | 23 +
.../qemuxml2argv-usb-hub-conflict.xml | 22 +
.../qemuxml2argv-usb-ich9-autoassign.args | 32 ++
.../qemuxml2argv-usb-ich9-autoassign.xml | 39 ++
.../qemuxml2argv-usb-port-autoassign.args | 28 ++
.../qemuxml2argv-usb-port-autoassign.xml | 27 ++
.../qemuxml2argv-usb-port-missing.args | 4 +-
.../qemuxml2argv-usb-redir-boot.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-usb-redir.args | 2 +-
.../qemuxml2argv-usb-xhci-autoassign.args | 27 ++
.../qemuxml2argv-usb-xhci-autoassign.xml | 25 +
tests/qemuxml2argvtest.c | 17 +
42 files changed, 1046 insertions(+), 31 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-hub-autoadd.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-hub-autoadd.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-hub-conflict.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-ich9-autoassign.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-port-autoassign.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-usb-xhci-autoassign.xml
--
2.7.3
8 years, 5 months
[libvirt] [PATCH v2 0/5] vz: make vz driver more responsive
by Nikolay Shirokovskiy
diff from original:
========================
1. include patch to check domain status on acquiring job condition
2. add patch to fix domain objects naming (update device patch
series which was created before convention was enstablished
sneak in)
3. squash in all quickfixes
4. rename vzDomainObjIsExist to vzEnsureDomainExists
Nikolay Shirokovskiy (5):
vz: use state variable sdkdom in prlsdkApplyConfig
vz: remove redundant variable in prlsdkHandleVmAddedEvent
vz: keep naming convention for domain objects
vz: make vz driver more responsive
vz: handle gracefully races on undefining domain
src/vz/vz_driver.c | 257 +++++++++++++++++++++++++++++++++++++++--------------
src/vz/vz_sdk.c | 207 ++++++++++++++++++++++++++++--------------
src/vz/vz_utils.c | 50 +++++++++++
src/vz/vz_utils.h | 7 ++
4 files changed, 387 insertions(+), 134 deletions(-)
--
1.8.3.1
8 years, 5 months
[libvirt] [PATCH v2] configure: Check for MSG_NOSIGNAL availability
by Andrea Bolognani
The symbol being missing has been reported as causing build
failures on OS X. Check for its availability before using it.
---
Changes from v1:
* don't unnecessarily check for availability at configure
time (thanks J��n)
src/util/virsystemd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index 969cd68..81ee538 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -482,7 +482,7 @@ int virSystemdTerminateMachine(const char *name)
void
virSystemdNotifyStartup(void)
{
-#ifdef HAVE_SYS_UN_H
+#if defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL)
const char *path;
const char *msg = "READY=1";
int fd;
@@ -526,7 +526,7 @@ virSystemdNotifyStartup(void)
VIR_WARN("Failed to notify systemd");
VIR_FORCE_CLOSE(fd);
-#endif /* HAVE_SYS_UN_H */
+#endif /* defined(HAVE_SYS_UN_H) && defined(MSG_NOSIGNAL) */
}
static int
--
2.7.4
8 years, 5 months