From df9dc08811f44626c5dc00fe7bb33a3c1929d76a431a9f841cdd549817a46710 Mon Sep 17 00:00:00 2001
From: James Fehlig
++ Similar to the functionality of a standard <hostdev> device,
++ when managed
is "yes", it is detached from the host
++ before being passed on to the guest, and reattached to the host
++ after the guest exits. If managed
is omitted or "no",
++ the user is responsible to call virNodeDeviceDettach
++ (or virsh nodedev-dettach
) before starting the guest
++ or hot-plugging the device, and virNodeDeviceReAttach
++ (or virsh nodedev-reattach
) after hot-unplug or
++ stopping the guest.
++
+ ... + <devices> +- <interface type='hostdev'> ++ <interface type='hostdev' managed='yes'> + <driver name='vfio'/> + <source> + <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> diff --git a/fd43d1f8-libxl-iface-hostdev.patch b/fd43d1f8-libxl-iface-hostdev.patch new file mode 100644 index 0000000..24cf066 --- /dev/null +++ b/fd43d1f8-libxl-iface-hostdev.patch @@ -0,0 +1,55 @@ +commit fd43d1f8bd3e8381d266f7c2a7e701568b29e2aa +Author: Chunyan Liu+Date: Thu May 8 14:44:04 2014 +0800 + + libxl: fix support for syntax + + A VIR_DOMAIN_NET_TYPE_HOSTDEV interface device is really a hostdev + device, which is created by the libxl driver in libxlMakePCIList(). + There is no need to create a libxl_device_nic for such hostdev + devices, so skip interfaces of type VIR_DOMAIN_NET_TYPE_HOSTDEV in + libxlMakeNicList(). + + Signed-off-by: Chunyan Liu + +Index: libvirt-1.2.4/src/libxl/libxl_conf.c +=================================================================== +--- libvirt-1.2.4.orig/src/libxl/libxl_conf.c ++++ libvirt-1.2.4/src/libxl/libxl_conf.c +@@ -921,25 +921,31 @@ static int + libxlMakeNicList(virDomainDefPtr def, libxl_domain_config *d_config) + { + virDomainNetDefPtr *l_nics = def->nets; +- int nnics = def->nnets; ++ size_t nnics = def->nnets; + libxl_device_nic *x_nics; +- size_t i; ++ size_t i, nvnics = 0; + + if (VIR_ALLOC_N(x_nics, nnics) < 0) + return -1; + + for (i = 0; i < nnics; i++) { +- if (libxlMakeNic(def, l_nics[i], &x_nics[i])) ++ if (l_nics[i]->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) ++ continue; ++ ++ if (libxlMakeNic(def, l_nics[i], &x_nics[nvnics])) + goto error; + /* + * The devid (at least right now) will not get initialized by + * libxl in the setup case but is required for starting the + * device-model. + */ +- if (x_nics[i].devid < 0) +- x_nics[i].devid = i; ++ if (x_nics[nvnics].devid < 0) ++ x_nics[nvnics].devid = nvnics; ++ ++ nvnics++; + } + ++ VIR_SHRINK_N(x_nics, nnics, nnics - nvnics); + d_config->nics = x_nics; + d_config->num_nics = nnics; + diff --git a/libvirt.changes b/libvirt.changes index 3150849..886c5bc 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon May 12 15:22:08 MDT 2014 - jfehlig@suse.com + +- libxl: Fix syntax for SR-IOV devices + fd43d1f8-libxl-iface-hostdev.patch, + 99f50208-managed-hostdev-iface.patch + ------------------------------------------------------------------- Tue May 6 11:53:14 MDT 2014 - jfehlig@suse.com diff --git a/libvirt.spec b/libvirt.spec index 1d246d5..4b934af 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -432,6 +432,8 @@ Patch0: b98bf811-add-paravirt-shutdown-flag.patch Patch1: c4fe29f8-use-shutdown-flag.patch Patch2: da744120-use-reboot-flag.patch Patch3: d6b27d3e-CVE-2014-0179.patch +Patch4: fd43d1f8-libxl-iface-hostdev.patch +Patch5: 99f50208-managed-hostdev-iface.patch # Need to go upstream Patch100: xen-name-for-devid.patch Patch101: ia64-clone.patch @@ -954,6 +956,8 @@ namespaces. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 +%patch5 -p1 %patch100 -p1 %patch101 -p1 %patch102 -p1 From c01fd79075258dde3266cd4c0f276a9ee8b21e750230e63305baab5c2f555f8d Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Mon, 12 May 2014 21:34:48 +0000 Subject: [PATCH 2/2] Remove upstream patches OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=373 --- 0e0c1a74-domid-fix.patch | 272 ------------------------------- 7a1452f5-libxl-empty-cdrom.patch | 31 ---- 2 files changed, 303 deletions(-) delete mode 100644 0e0c1a74-domid-fix.patch delete mode 100644 7a1452f5-libxl-empty-cdrom.patch diff --git a/0e0c1a74-domid-fix.patch b/0e0c1a74-domid-fix.patch deleted file mode 100644 index c083892..0000000 --- a/0e0c1a74-domid-fix.patch +++ /dev/null @@ -1,272 +0,0 @@ -commit 0e0c1a7489a6a04c5060d0fe7fad6337ed98ec01 -Author: Stefan Bader -Date: Thu Mar 27 17:55:02 2014 +0100 - - libxl: Use id from virDomainObj inside the driver - - There is a domain id in the virDomain structure as well as in the - virDomainObj structure. While the former can become stale the latter - is kept up to date. So it is safer to always (virDomainObjPtr)->def->id - internally. - - This will fix issues seen when managing Xen guests through libvirt from - virt-manager (not being able to get domain info after define or reboot). - This was caused both though libxlDomainGetInfo() only but there were - a lot of places that might potentially cause issues, too. - - Signed-off-by: Stefan Bader - -Index: libvirt-1.2.3/src/libxl/libxl_driver.c -=================================================================== ---- libvirt-1.2.3.orig/src/libxl/libxl_driver.c -+++ libvirt-1.2.3/src/libxl/libxl_driver.c -@@ -770,10 +770,10 @@ libxlDomainSuspend(virDomainPtr dom) - priv = vm->privateData; - - if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_PAUSED) { -- if (libxl_domain_pause(priv->ctx, dom->id) != 0) { -+ if (libxl_domain_pause(priv->ctx, vm->def->id) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to suspend domain '%d' with libxenlight"), -- dom->id); -+ vm->def->id); - goto endjob; - } - -@@ -829,10 +829,10 @@ libxlDomainResume(virDomainPtr dom) - priv = vm->privateData; - - if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_PAUSED) { -- if (libxl_domain_unpause(priv->ctx, dom->id) != 0) { -+ if (libxl_domain_unpause(priv->ctx, vm->def->id) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to resume domain '%d' with libxenlight"), -- dom->id); -+ vm->def->id); - goto endjob; - } - -@@ -883,10 +883,10 @@ libxlDomainShutdownFlags(virDomainPtr do - } - - priv = vm->privateData; -- if (libxl_domain_shutdown(priv->ctx, dom->id) != 0) { -+ if (libxl_domain_shutdown(priv->ctx, vm->def->id) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to shutdown domain '%d' with libxenlight"), -- dom->id); -+ vm->def->id); - goto cleanup; - } - -@@ -930,10 +930,10 @@ libxlDomainReboot(virDomainPtr dom, unsi - } - - priv = vm->privateData; -- if (libxl_domain_reboot(priv->ctx, dom->id) != 0) { -+ if (libxl_domain_reboot(priv->ctx, vm->def->id) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to reboot domain '%d' with libxenlight"), -- dom->id); -+ vm->def->id); - goto cleanup; - } - ret = 0; -@@ -974,7 +974,7 @@ libxlDomainDestroyFlags(virDomainPtr dom - priv = vm->privateData; - if (libxl_domain_destroy(priv->ctx, vm->def->id, NULL) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Failed to destroy domain '%d'"), dom->id); -+ _("Failed to destroy domain '%d'"), vm->def->id); - goto cleanup; - } - -@@ -1105,10 +1105,10 @@ libxlDomainSetMemoryFlags(virDomainPtr d - - if (flags & VIR_DOMAIN_MEM_LIVE) { - priv = vm->privateData; -- if (libxl_domain_setmaxmem(priv->ctx, dom->id, newmem) < 0) { -+ if (libxl_domain_setmaxmem(priv->ctx, vm->def->id, newmem) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set maximum memory for domain '%d'" -- " with libxenlight"), dom->id); -+ " with libxenlight"), vm->def->id); - goto endjob; - } - } -@@ -1138,13 +1138,13 @@ libxlDomainSetMemoryFlags(virDomainPtr d - priv = vm->privateData; - /* Unlock virDomainObj while ballooning memory */ - virObjectUnlock(vm); -- res = libxl_set_memory_target(priv->ctx, dom->id, newmem, 0, -+ res = libxl_set_memory_target(priv->ctx, vm->def->id, newmem, 0, - /* force */ 1); - virObjectLock(vm); - if (res < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set memory for domain '%d'" -- " with libxenlight"), dom->id); -+ " with libxenlight"), vm->def->id); - goto endjob; - } - } -@@ -1202,9 +1202,10 @@ libxlDomainGetInfo(virDomainPtr dom, vir - info->memory = vm->def->mem.cur_balloon; - info->maxMem = vm->def->mem.max_balloon; - } else { -- if (libxl_domain_info(priv->ctx, &d_info, dom->id) != 0) { -+ if (libxl_domain_info(priv->ctx, &d_info, vm->def->id) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("libxl_domain_info failed for domain '%d'"), dom->id); -+ _("libxl_domain_info failed for domain '%d'"), -+ vm->def->id); - goto cleanup; - } - info->cpuTime = d_info.cpu_time; -@@ -1483,11 +1484,11 @@ libxlDomainCoreDump(virDomainPtr dom, co - - if (!(flags & VIR_DUMP_LIVE) && - virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) { -- if (libxl_domain_pause(priv->ctx, dom->id) != 0) { -+ if (libxl_domain_pause(priv->ctx, vm->def->id) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Before dumping core, failed to suspend domain '%d'" - " with libxenlight"), -- dom->id); -+ vm->def->id); - goto endjob; - } - virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_DUMP); -@@ -1496,20 +1497,20 @@ libxlDomainCoreDump(virDomainPtr dom, co - - /* Unlock virDomainObj while dumping core */ - virObjectUnlock(vm); -- ret = libxl_domain_core_dump(priv->ctx, dom->id, to, NULL); -+ ret = libxl_domain_core_dump(priv->ctx, vm->def->id, to, NULL); - virObjectLock(vm); - if (ret != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to dump core of domain '%d' with libxenlight"), -- dom->id); -+ vm->def->id); - ret = -1; - goto unpause; - } - - if (flags & VIR_DUMP_CRASH) { -- if (libxl_domain_destroy(priv->ctx, dom->id, NULL) < 0) { -+ if (libxl_domain_destroy(priv->ctx, vm->def->id, NULL) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, -- _("Failed to destroy domain '%d'"), dom->id); -+ _("Failed to destroy domain '%d'"), vm->def->id); - goto unpause; - } - -@@ -1524,10 +1525,10 @@ libxlDomainCoreDump(virDomainPtr dom, co - - unpause: - if (virDomainObjIsActive(vm) && paused) { -- if (libxl_domain_unpause(priv->ctx, dom->id) != 0) { -+ if (libxl_domain_unpause(priv->ctx, vm->def->id) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("After dumping core, failed to resume domain '%d' with" -- " libxenlight"), dom->id); -+ " libxenlight"), vm->def->id); - } else { - virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, - VIR_DOMAIN_RUNNING_UNPAUSED); -@@ -1786,19 +1787,19 @@ libxlDomainSetVcpusFlags(virDomainPtr do - break; - - case VIR_DOMAIN_VCPU_LIVE: -- if (libxl_set_vcpuonline(priv->ctx, dom->id, &map) != 0) { -+ if (libxl_set_vcpuonline(priv->ctx, vm->def->id, &map) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set vcpus for domain '%d'" -- " with libxenlight"), dom->id); -+ " with libxenlight"), vm->def->id); - goto endjob; - } - break; - - case VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_CONFIG: -- if (libxl_set_vcpuonline(priv->ctx, dom->id, &map) != 0) { -+ if (libxl_set_vcpuonline(priv->ctx, vm->def->id, &map) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set vcpus for domain '%d'" -- " with libxenlight"), dom->id); -+ " with libxenlight"), vm->def->id); - goto endjob; - } - def->vcpus = nvcpus; -@@ -1934,7 +1935,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom - libxlDomainObjPrivatePtr priv; - - priv = vm->privateData; -- if (libxl_set_vcpuaffinity(priv->ctx, dom->id, vcpu, &map) != 0) { -+ if (libxl_set_vcpuaffinity(priv->ctx, vm->def->id, vcpu, &map) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to pin vcpu '%d' with libxenlight"), - vcpu); -@@ -2099,11 +2100,11 @@ libxlDomainGetVcpus(virDomainPtr dom, vi - } - - priv = vm->privateData; -- if ((vcpuinfo = libxl_list_vcpu(priv->ctx, dom->id, &maxcpu, -+ if ((vcpuinfo = libxl_list_vcpu(priv->ctx, vm->def->id, &maxcpu, - &hostcpus)) == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to list vcpus for domain '%d' with libxenlight"), -- dom->id); -+ vm->def->id); - goto cleanup; - } - -@@ -3608,7 +3609,7 @@ libxlDomainGetSchedulerType(virDomainPtr - default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get scheduler id for domain '%d'" -- " with libxenlight"), dom->id); -+ " with libxenlight"), vm->def->id); - goto cleanup; - } - -@@ -3659,10 +3660,10 @@ libxlDomainGetSchedulerParametersFlags(v - goto cleanup; - } - -- if (libxl_domain_sched_params_get(priv->ctx, dom->id, &sc_info) != 0) { -+ if (libxl_domain_sched_params_get(priv->ctx, vm->def->id, &sc_info) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get scheduler parameters for domain '%d'" -- " with libxenlight"), dom->id); -+ " with libxenlight"), vm->def->id); - goto cleanup; - } - -@@ -3740,10 +3741,10 @@ libxlDomainSetSchedulerParametersFlags(v - goto endjob; - } - -- if (libxl_domain_sched_params_get(priv->ctx, dom->id, &sc_info) != 0) { -+ if (libxl_domain_sched_params_get(priv->ctx, vm->def->id, &sc_info) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to get scheduler parameters for domain '%d'" -- " with libxenlight"), dom->id); -+ " with libxenlight"), vm->def->id); - goto endjob; - } - -@@ -3756,10 +3757,10 @@ libxlDomainSetSchedulerParametersFlags(v - sc_info.cap = params[i].value.ui; - } - -- if (libxl_domain_sched_params_set(priv->ctx, dom->id, &sc_info) != 0) { -+ if (libxl_domain_sched_params_set(priv->ctx, vm->def->id, &sc_info) != 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to set scheduler parameters for domain '%d'" -- " with libxenlight"), dom->id); -+ " with libxenlight"), vm->def->id); - goto endjob; - } - diff --git a/7a1452f5-libxl-empty-cdrom.patch b/7a1452f5-libxl-empty-cdrom.patch deleted file mode 100644 index 1aa2638..0000000 --- a/7a1452f5-libxl-empty-cdrom.patch +++ /dev/null @@ -1,31 +0,0 @@ -commit 7a1452f5334f98680187ae6d11fe2a49c1b38548 -Author: Stefan Bader -Date: Thu Mar 27 17:55:03 2014 +0100 - - libxl: Set disk format for empty cdrom device - - The XML config for a CDROM device can be without a source path, - indicating that there is no media present. Without this change - the libxl driver fails to start a guest in that case because - the libxl library checks for the LIBXL_DISK_FORMAT_EMPTY format - type and tries to stat the NULL pointer that gets passed on. - - > libxl: error: libxl_device.c:265:libxl__device_disk_set_backend: - > Disk vdev=hdc failed to stat: (null): Bad address - - Signed-off-by: Stefan Bader - -Index: libvirt-1.2.3/src/libxl/libxl_conf.c -=================================================================== ---- libvirt-1.2.3.orig/src/libxl/libxl_conf.c -+++ libvirt-1.2.3/src/libxl/libxl_conf.c -@@ -827,6 +827,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk - x_disk->removable = 1; - x_disk->readwrite = !l_disk->readonly; - x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0; -+ /* An empty CDROM must have the empty format, otherwise libxl fails. */ -+ if (x_disk->is_cdrom && !x_disk->pdev_path) -+ x_disk->format = LIBXL_DISK_FORMAT_EMPTY; - if (l_disk->transient) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("libxenlight does not support transient disks"));