Accepting request 398051 from Virtualization
Yet nother bug fix for the Factory and SLE12 SP2 libvirt package. - libxl: add domainInterfaceAddresses API ba566428-libxl-dom-iface-addrs.patch bsc#979425 - libxl: default to qemu driver for network disks a1c9a81a-libxl-rbd-fix.patch boo#981094 OBS-URL: https://build.opensuse.org/request/show/398051 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libvirt?expand=0&rev=205
This commit is contained in:
commit
b4cfa20c43
70
a1c9a81a-libxl-rbd-fix.patch
Normal file
70
a1c9a81a-libxl-rbd-fix.patch
Normal file
@ -0,0 +1,70 @@
|
||||
commit a1c9a81a318f3cd558faed7fc4c4933f95c07a07
|
||||
Author: Jim Fehlig <jfehlig@suse.com>
|
||||
Date: Mon May 23 15:56:01 2016 -0600
|
||||
|
||||
libxl: default to qemu driver for network disks
|
||||
|
||||
Xen only supports network-based disks with the qemu (aka qdisk) driver.
|
||||
Set the driverName to 'qemu' in libxlDomainDeviceDefPostParse() if
|
||||
not already set. When starting a domain with network-based disks,
|
||||
ensure the driverName is 'qemu'.
|
||||
|
||||
Resolves: https://bugzilla.opensuse.org/show_bug.cgi?id=981094
|
||||
|
||||
Index: libvirt-1.3.4/src/libxl/libxl_conf.c
|
||||
===================================================================
|
||||
--- libvirt-1.3.4.orig/src/libxl/libxl_conf.c
|
||||
+++ libvirt-1.3.4/src/libxl/libxl_conf.c
|
||||
@@ -1055,13 +1055,18 @@ libxlMakeNetworkDiskSrc(virStorageSource
|
||||
int
|
||||
libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
|
||||
{
|
||||
- const char *driver;
|
||||
- int format;
|
||||
+ const char *driver = virDomainDiskGetDriver(l_disk);
|
||||
+ int format = virDomainDiskGetFormat(l_disk);
|
||||
int actual_type = virStorageSourceGetActualType(l_disk->src);
|
||||
|
||||
libxl_device_disk_init(x_disk);
|
||||
|
||||
if (actual_type == VIR_STORAGE_TYPE_NETWORK) {
|
||||
+ if (STRNEQ_NULLABLE(driver, "qemu")) {
|
||||
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("only the 'qemu' driver can be used with network disks"));
|
||||
+ return -1;
|
||||
+ }
|
||||
if (libxlMakeNetworkDiskSrc(l_disk->src, &x_disk->pdev_path) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
@@ -1072,8 +1077,6 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
|
||||
if (VIR_STRDUP(x_disk->vdev, l_disk->dst) < 0)
|
||||
return -1;
|
||||
|
||||
- driver = virDomainDiskGetDriver(l_disk);
|
||||
- format = virDomainDiskGetFormat(l_disk);
|
||||
if (driver) {
|
||||
if (STREQ(driver, "tap") || STREQ(driver, "tap2")) {
|
||||
switch (format) {
|
||||
Index: libvirt-1.3.4/src/libxl/libxl_domain.c
|
||||
===================================================================
|
||||
--- libvirt-1.3.4.orig/src/libxl/libxl_domain.c
|
||||
+++ libvirt-1.3.4/src/libxl/libxl_domain.c
|
||||
@@ -364,6 +364,18 @@ libxlDomainDeviceDefPostParse(virDomainD
|
||||
}
|
||||
}
|
||||
|
||||
+ /* for network-based disks, set 'qemu' as the default driver */
|
||||
+ if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
|
||||
+ virDomainDiskDefPtr disk = dev->data.disk;
|
||||
+ int actual_type = virStorageSourceGetActualType(disk->src);
|
||||
+
|
||||
+ if (actual_type == VIR_STORAGE_TYPE_NETWORK) {
|
||||
+ if (!virDomainDiskGetDriver(disk) &&
|
||||
+ virDomainDiskSetDriver(disk, "qemu") < 0)
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
170
ba566428-libxl-dom-iface-addrs.patch
Normal file
170
ba566428-libxl-dom-iface-addrs.patch
Normal file
@ -0,0 +1,170 @@
|
||||
commit ba5664288553b046018fa84fd3b9a851ee0032e7
|
||||
Author: Chunyan Liu <cyliu@suse.com>
|
||||
Date: Fri May 13 14:21:23 2016 +0800
|
||||
|
||||
libxl: add .domainInterfaceAddresses
|
||||
|
||||
Add .domainInterfaceAddresses so that user can have a way to
|
||||
get domain interface address by 'virsh domifaddr'. Currently
|
||||
it only supports '--source lease'.
|
||||
|
||||
Signed-off: Chunyan Liu <cyliu@suse.com>
|
||||
|
||||
Index: libvirt-1.3.4/src/libxl/libxl_driver.c
|
||||
===================================================================
|
||||
--- libvirt-1.3.4.orig/src/libxl/libxl_driver.c
|
||||
+++ libvirt-1.3.4/src/libxl/libxl_driver.c
|
||||
@@ -5425,6 +5425,145 @@ static int libxlNodeGetSecurityModel(vir
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int
|
||||
+libxlGetDHCPInterfaces(virDomainPtr dom,
|
||||
+ virDomainObjPtr vm,
|
||||
+ virDomainInterfacePtr **ifaces)
|
||||
+{
|
||||
+ int rv = -1;
|
||||
+ int n_leases = 0;
|
||||
+ size_t i, j;
|
||||
+ size_t ifaces_count = 0;
|
||||
+ virNetworkPtr network = NULL;
|
||||
+ char macaddr[VIR_MAC_STRING_BUFLEN];
|
||||
+ virDomainInterfacePtr iface = NULL;
|
||||
+ virNetworkDHCPLeasePtr *leases = NULL;
|
||||
+ virDomainInterfacePtr *ifaces_ret = NULL;
|
||||
+
|
||||
+ if (!dom->conn->networkDriver ||
|
||||
+ !dom->conn->networkDriver->networkGetDHCPLeases) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("Network driver does not support DHCP lease query"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < vm->def->nnets; i++) {
|
||||
+ if (vm->def->nets[i]->type != VIR_DOMAIN_NET_TYPE_NETWORK)
|
||||
+ continue;
|
||||
+
|
||||
+ virMacAddrFormat(&(vm->def->nets[i]->mac), macaddr);
|
||||
+ virObjectUnref(network);
|
||||
+ network = virNetworkLookupByName(dom->conn,
|
||||
+ vm->def->nets[i]->data.network.name);
|
||||
+
|
||||
+ if ((n_leases = virNetworkGetDHCPLeases(network, macaddr,
|
||||
+ &leases, 0)) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ if (n_leases) {
|
||||
+ if (VIR_EXPAND_N(ifaces_ret, ifaces_count, 1) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ if (VIR_ALLOC(ifaces_ret[ifaces_count - 1]) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ iface = ifaces_ret[ifaces_count - 1];
|
||||
+ /* Assuming each lease corresponds to a separate IP */
|
||||
+ iface->naddrs = n_leases;
|
||||
+
|
||||
+ if (VIR_ALLOC_N(iface->addrs, iface->naddrs) < 0)
|
||||
+ goto error;
|
||||
+
|
||||
+ if (VIR_STRDUP(iface->name, vm->def->nets[i]->ifname) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (VIR_STRDUP(iface->hwaddr, macaddr) < 0)
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ for (j = 0; j < n_leases; j++) {
|
||||
+ virNetworkDHCPLeasePtr lease = leases[j];
|
||||
+ virDomainIPAddressPtr ip_addr = &iface->addrs[j];
|
||||
+
|
||||
+ if (VIR_STRDUP(ip_addr->addr, lease->ipaddr) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ ip_addr->type = lease->type;
|
||||
+ ip_addr->prefix = lease->prefix;
|
||||
+ }
|
||||
+
|
||||
+ for (j = 0; j < n_leases; j++)
|
||||
+ virNetworkDHCPLeaseFree(leases[j]);
|
||||
+
|
||||
+ VIR_FREE(leases);
|
||||
+ }
|
||||
+
|
||||
+ *ifaces = ifaces_ret;
|
||||
+ ifaces_ret = NULL;
|
||||
+ rv = ifaces_count;
|
||||
+
|
||||
+ cleanup:
|
||||
+ virObjectUnref(network);
|
||||
+ if (leases) {
|
||||
+ for (i = 0; i < n_leases; i++)
|
||||
+ virNetworkDHCPLeaseFree(leases[i]);
|
||||
+ }
|
||||
+ VIR_FREE(leases);
|
||||
+
|
||||
+ return rv;
|
||||
+
|
||||
+ error:
|
||||
+ if (ifaces_ret) {
|
||||
+ for (i = 0; i < ifaces_count; i++)
|
||||
+ virDomainInterfaceFree(ifaces_ret[i]);
|
||||
+ }
|
||||
+ VIR_FREE(ifaces_ret);
|
||||
+
|
||||
+ goto cleanup;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+libxlDomainInterfaceAddresses(virDomainPtr dom,
|
||||
+ virDomainInterfacePtr **ifaces,
|
||||
+ unsigned int source,
|
||||
+ unsigned int flags)
|
||||
+{
|
||||
+ virDomainObjPtr vm = NULL;
|
||||
+ int ret = -1;
|
||||
+
|
||||
+ virCheckFlags(0, -1);
|
||||
+
|
||||
+ if (!(vm = libxlDomObjFromDomain(dom)))
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (virDomainInterfaceAddressesEnsureACL(dom->conn, vm->def) < 0)
|
||||
+ goto cleanup;
|
||||
+
|
||||
+ if (!virDomainObjIsActive(vm)) {
|
||||
+ virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
+ _("domain is not running"));
|
||||
+ goto cleanup;
|
||||
+ }
|
||||
+
|
||||
+ switch (source) {
|
||||
+ case VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE:
|
||||
+ ret = libxlGetDHCPInterfaces(dom, vm, ifaces);
|
||||
+ break;
|
||||
+
|
||||
+ default:
|
||||
+ virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
|
||||
+ _("Unsupported IP address data source %d"),
|
||||
+ source);
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ cleanup:
|
||||
+ virDomainObjEndAPI(&vm);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static virHypervisorDriver libxlHypervisorDriver = {
|
||||
.name = LIBXL_DRIVER_NAME,
|
||||
.connectOpen = libxlConnectOpen, /* 0.9.0 */
|
||||
@@ -5525,6 +5664,7 @@ static virHypervisorDriver libxlHypervis
|
||||
.domainMigrateFinish3Params = libxlDomainMigrateFinish3Params, /* 1.2.6 */
|
||||
.domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */
|
||||
.nodeGetSecurityModel = libxlNodeGetSecurityModel, /* 1.2.16 */
|
||||
+ .domainInterfaceAddresses = libxlDomainInterfaceAddresses, /* 1.3.5 */
|
||||
};
|
||||
|
||||
static virConnectDriver libxlConnectDriver = {
|
@ -1,3 +1,17 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed May 25 16:41:11 UTC 2016 - jfehlig@suse.com
|
||||
|
||||
- libxl: add domainInterfaceAddresses API
|
||||
ba566428-libxl-dom-iface-addrs.patch
|
||||
bsc#979425
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed May 25 14:55:16 UTC 2016 - jfehlig@suse.com
|
||||
|
||||
- libxl: default to qemu driver for network disks
|
||||
a1c9a81a-libxl-rbd-fix.patch
|
||||
boo#981094
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed May 18 04:55:22 UTC 2016 - jfehlig@suse.com
|
||||
|
||||
|
@ -467,6 +467,8 @@ Patch5: b90c4b5f-tests-use-qemu-xen.patch
|
||||
Patch6: fccf2725-libxl-API-4.4.patch
|
||||
Patch7: 5325123d-libxl-migv2-save-restore.patch
|
||||
Patch8: f9edcfa4-libxl-migv2-migration.patch
|
||||
Patch9: a1c9a81a-libxl-rbd-fix.patch
|
||||
Patch10: ba566428-libxl-dom-iface-addrs.patch
|
||||
# Patches pending upstream review
|
||||
# Need to go upstream
|
||||
Patch150: xen-pv-cdrom.patch
|
||||
@ -999,6 +1001,8 @@ libvirt plugin for NSS for translating domain names into IP addresses.
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch150 -p1
|
||||
%patch151 -p1
|
||||
%patch152 -p1
|
||||
|
@ -42,10 +42,10 @@ Index: libvirt-1.3.4/src/libxl/libxl_conf.c
|
||||
libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
|
||||
{
|
||||
+ const char *src = virDomainDiskGetSource(l_disk);
|
||||
const char *driver;
|
||||
int format;
|
||||
const char *driver = virDomainDiskGetDriver(l_disk);
|
||||
int format = virDomainDiskGetFormat(l_disk);
|
||||
int actual_type = virStorageSourceGetActualType(l_disk->src);
|
||||
@@ -1065,7 +1085,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
|
||||
@@ -1070,7 +1090,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
|
||||
if (libxlMakeNetworkDiskSrc(l_disk->src, &x_disk->pdev_path) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
@ -54,7 +54,7 @@ Index: libvirt-1.3.4/src/libxl/libxl_conf.c
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1174,6 +1194,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
|
||||
@@ -1177,6 +1197,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
|
||||
x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
|
||||
if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user