2013-02-25 22:55:36 +01:00
|
|
|
Do not search xenstore for disk/network/PCI device IDs
|
2010-01-28 02:07:11 +01:00
|
|
|
|
2013-02-25 22:55:36 +01:00
|
|
|
Disk, network, and PCI devices can be referenced by name in Xen,
|
|
|
|
e.g. when modifying their configuration or remvoving them. As such,
|
|
|
|
don't search xenstore for a device ID corresponding to these devices.
|
|
|
|
Instead, search the devices contained in the domain definition and use
|
|
|
|
the devices's target name if found.
|
|
|
|
|
|
|
|
Note that for network devices, the mac address is used for the device
|
|
|
|
name. For PCI devices, the bdf (bus:dev:fun) specifier is used for
|
|
|
|
the device name.
|
2010-01-28 02:07:11 +01:00
|
|
|
|
2013-02-25 22:55:36 +01:00
|
|
|
This approach allows removing a disk/network/PCI device when domain
|
|
|
|
is inactive. We obviously can't search xenstore when the domain is
|
|
|
|
inactive.
|
2010-01-28 02:07:11 +01:00
|
|
|
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
Index: libvirt-1.1.4/src/xen/xend_internal.c
|
2010-01-28 02:07:11 +01:00
|
|
|
===================================================================
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
--- libvirt-1.1.4.orig/src/xen/xend_internal.c
|
|
|
|
+++ libvirt-1.1.4/src/xen/xend_internal.c
|
2013-06-05 00:48:46 +02:00
|
|
|
@@ -70,7 +70,7 @@
|
2013-03-06 05:40:21 +01:00
|
|
|
#define XEND_RCV_BUF_MAX_LEN (256 * 1024)
|
2010-01-28 02:07:11 +01:00
|
|
|
|
|
|
|
static int
|
2013-06-05 00:48:46 +02:00
|
|
|
-virDomainXMLDevID(virConnectPtr conn, virDomainDefPtr domain,
|
|
|
|
+virDomainXMLDevID(virConnectPtr conn ATTRIBUTE_UNUSED, virDomainDefPtr domain,
|
|
|
|
virDomainDeviceDefPtr dev, char *class,
|
|
|
|
char *ref, int ref_len);
|
2013-03-06 05:40:21 +01:00
|
|
|
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -3316,18 +3316,18 @@ xenDaemonDomainBlockPeek(virConnectPtr c
|
2013-02-25 22:55:36 +01:00
|
|
|
* Returns 0 in case of success, -1 in case of failure.
|
2010-01-28 02:07:11 +01:00
|
|
|
*/
|
|
|
|
static int
|
2013-06-05 00:48:46 +02:00
|
|
|
-virDomainXMLDevID(virConnectPtr conn,
|
|
|
|
+virDomainXMLDevID(virConnectPtr conn ATTRIBUTE_UNUSED,
|
|
|
|
virDomainDefPtr def,
|
2010-01-28 02:07:11 +01:00
|
|
|
virDomainDeviceDefPtr dev,
|
|
|
|
char *class,
|
|
|
|
char *ref,
|
2013-05-02 21:17:46 +02:00
|
|
|
int ref_len)
|
2013-02-25 22:55:36 +01:00
|
|
|
{
|
2013-06-05 00:48:46 +02:00
|
|
|
- xenUnifiedPrivatePtr priv = conn->privateData;
|
2013-05-02 21:17:46 +02:00
|
|
|
- char *xref;
|
2013-02-25 22:55:36 +01:00
|
|
|
- char *tmp;
|
2010-01-28 02:07:11 +01:00
|
|
|
+ unsigned int i;
|
|
|
|
|
|
|
|
if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
|
|
|
+ if (dev->data.disk->dst == NULL)
|
|
|
|
+ return -1;
|
|
|
|
if (dev->data.disk->driverName &&
|
|
|
|
STREQ(dev->data.disk->driverName, "tap"))
|
|
|
|
strcpy(class, "tap");
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -3337,19 +3337,17 @@ virDomainXMLDevID(virConnectPtr conn,
|
2010-01-28 02:07:11 +01:00
|
|
|
else
|
|
|
|
strcpy(class, "vbd");
|
|
|
|
|
|
|
|
- if (dev->data.disk->dst == NULL)
|
|
|
|
- return -1;
|
|
|
|
- xenUnifiedLock(priv);
|
2013-06-05 00:48:46 +02:00
|
|
|
- xref = xenStoreDomainGetDiskID(conn, def->id,
|
2010-01-28 02:07:11 +01:00
|
|
|
- dev->data.disk->dst);
|
|
|
|
- xenUnifiedUnlock(priv);
|
|
|
|
- if (xref == NULL)
|
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- tmp = virStrcpy(ref, xref, ref_len);
|
|
|
|
- VIR_FREE(xref);
|
|
|
|
- if (tmp == NULL)
|
|
|
|
- return -1;
|
2013-02-25 22:55:36 +01:00
|
|
|
+ /* For disks, the device name can be used directly. */
|
2013-06-05 00:48:46 +02:00
|
|
|
+ for (i = 0; i < def->ndisks; i++) {
|
|
|
|
+ virDomainDiskDefPtr disk = def->disks[i];
|
2010-01-28 02:07:11 +01:00
|
|
|
+ if (STREQ(dev->data.disk->dst, disk->dst)) {
|
2013-02-25 22:55:36 +01:00
|
|
|
+ if (virStrcpy(ref, disk->dst, ref_len) == NULL)
|
2010-01-28 02:07:11 +01:00
|
|
|
+ return -1;
|
|
|
|
+ else
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return -1;
|
|
|
|
} else if (dev->type == VIR_DOMAIN_DEVICE_NET) {
|
2013-05-02 21:17:46 +02:00
|
|
|
char mac[VIR_MAC_STRING_BUFLEN];
|
2013-06-05 00:48:46 +02:00
|
|
|
virDomainNetDefPtr netdef = dev->data.net;
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -3357,16 +3355,22 @@ virDomainXMLDevID(virConnectPtr conn,
|
2013-02-25 22:55:36 +01:00
|
|
|
|
|
|
|
strcpy(class, "vif");
|
|
|
|
|
|
|
|
- xenUnifiedLock(priv);
|
2013-06-05 00:48:46 +02:00
|
|
|
- xref = xenStoreDomainGetNetworkID(conn, def->id, mac);
|
2013-02-25 22:55:36 +01:00
|
|
|
- xenUnifiedUnlock(priv);
|
|
|
|
- if (xref == NULL)
|
|
|
|
- return -1;
|
|
|
|
-
|
|
|
|
- tmp = virStrcpy(ref, xref, ref_len);
|
|
|
|
- VIR_FREE(xref);
|
|
|
|
- if (tmp == NULL)
|
|
|
|
- return -1;
|
|
|
|
+ /* For nics, the mac address can be used directly. */
|
2013-06-05 00:48:46 +02:00
|
|
|
+ for (i = 0; i < def->nnets; i++) {
|
2013-02-25 22:55:36 +01:00
|
|
|
+ char dst_mac[30];
|
2013-06-05 00:48:46 +02:00
|
|
|
+ virDomainNetDefPtr dst_net = def->nets[i];
|
2013-02-25 22:55:36 +01:00
|
|
|
+ snprintf(dst_mac, sizeof(dst_mac), "%02x:%02x:%02x:%02x:%02x:%02x",
|
|
|
|
+ dst_net->mac.addr[0], dst_net->mac.addr[1],
|
|
|
|
+ dst_net->mac.addr[2], dst_net->mac.addr[3],
|
|
|
|
+ dst_net->mac.addr[4], dst_net->mac.addr[5]);
|
|
|
|
+ if (STREQ(mac, dst_mac)) {
|
|
|
|
+ if (virStrcpy(ref, dst_mac, ref_len) == NULL)
|
|
|
|
+ return -1;
|
|
|
|
+ else
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return -1;
|
|
|
|
} else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV &&
|
|
|
|
dev->data.hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
|
|
|
|
dev->data.hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
|
- Update to libvirt 1.1.4
- Add support for AArch64 architecture
- Various improvements on test code and test driver
- Don't link virt-login-shell against libvirt.so
- Close all non-stdio FDs in virt-login-shell
- Only allow 'stderr' log output when running setuid
- Fix perms for virConnectDomainXML{To,From}Native
- Many incremental improvements and bug fixes, see
http://libvirt.org/news.html
- Drop upstream patches: e7f400a1-CVE-2013-4296.patch,
2dba0323-CVE-2013-4297.patch, db7a5688-CVE-2013-4311.patch,
e65667c0-CVE-2013-4311.patch, 922b7fda-CVE-2013-4311.patch,
e4697b92-CVE-2013-4311.patch, 8294aa0c-CVE-2013-4399.patch,
484cc321-fix-spice-migration.patch,
79552754-libvirtd-chardev-crash.patch,
57687fd6-CVE-2013-4401.patch, ae53e5d1-CVE-2013-4400.patch,
8c3586ea-CVE-2013-4400.patch, b7fcc799a-CVE-2013-4400.patch,
3e2f27e1-CVE-2013-4400.patch, 5a0ea4b7-CVE-2013-4400.patch,
843bdb2f-CVE-2013-4400.patch,
bd773e74-lxc-terminate-machine.patch,
e350826c-python-fix-fd-passing.patch
OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=329
2013-11-20 21:02:26 +01:00
|
|
|
@@ -3382,17 +3386,44 @@ virDomainXMLDevID(virConnectPtr conn,
|
2013-02-25 22:55:36 +01:00
|
|
|
|
|
|
|
strcpy(class, "pci");
|
|
|
|
|
|
|
|
- xenUnifiedLock(priv);
|
2013-06-05 00:48:46 +02:00
|
|
|
- xref = xenStoreDomainGetPCIID(conn, def->id, bdf);
|
2013-02-25 22:55:36 +01:00
|
|
|
- xenUnifiedUnlock(priv);
|
|
|
|
- VIR_FREE(bdf);
|
|
|
|
- if (xref == NULL)
|
|
|
|
- return -1;
|
|
|
|
+ /* For PCI devices, the device BFD can be used directly. */
|
2013-06-05 00:48:46 +02:00
|
|
|
+ for (i = 0 ; i < def->nhostdevs ; i++) {
|
2013-02-25 22:55:36 +01:00
|
|
|
+ char *dst_bdf;
|
2013-06-05 00:48:46 +02:00
|
|
|
+ virDomainHostdevDefPtr hostdev = def->hostdevs[i];
|
2013-02-25 22:55:36 +01:00
|
|
|
+
|
|
|
|
+ if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
|
|
|
|
+ continue;
|
|
|
|
+ if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
|
|
|
|
+ continue;
|
|
|
|
+
|
|
|
|
+ if (virAsprintf(&dst_bdf, "%04x:%02x:%02x.%0x",
|
2013-05-02 21:17:46 +02:00
|
|
|
+ hostdev->source.subsys.u.pci.addr.domain,
|
|
|
|
+ hostdev->source.subsys.u.pci.addr.bus,
|
|
|
|
+ hostdev->source.subsys.u.pci.addr.slot,
|
|
|
|
+ hostdev->source.subsys.u.pci.addr.function) < 0) {
|
2013-02-25 22:55:36 +01:00
|
|
|
+ virReportOOMError();
|
|
|
|
+ VIR_FREE(bdf);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- tmp = virStrcpy(ref, xref, ref_len);
|
|
|
|
- VIR_FREE(xref);
|
|
|
|
- if (tmp == NULL)
|
|
|
|
- return -1;
|
|
|
|
+ if (STREQ(bdf, dst_bdf)) {
|
|
|
|
+ if (virStrcpy(ref, dst_bdf, ref_len) == NULL) {
|
|
|
|
+ virReportOOMError();
|
|
|
|
+ VIR_FREE(dst_bdf);
|
|
|
|
+ VIR_FREE(bdf);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ VIR_FREE(dst_bdf);
|
|
|
|
+ VIR_FREE(bdf);
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ VIR_FREE(dst_bdf);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ VIR_FREE(bdf);
|
|
|
|
+ return -1;
|
|
|
|
} else {
|
|
|
|
virReportError(VIR_ERR_OPERATION_INVALID,
|
|
|
|
"%s", _("hotplug of device type not supported"));
|