diff --git a/clone.patch b/clone.patch index f2d33cf..5491d2f 100644 --- a/clone.patch +++ b/clone.patch @@ -2,7 +2,7 @@ Index: src/lxc/lxc_container.c =================================================================== --- src/lxc/lxc_container.c.orig +++ src/lxc/lxc_container.c -@@ -813,6 +813,9 @@ int lxcContainerStart(virDomainDefPtr de +@@ -814,6 +814,9 @@ int lxcContainerStart(virDomainDefPtr de lxc_child_argv_t args = { def, nveths, veths, control, ttyPath }; /* allocate a stack for the container */ @@ -12,7 +12,7 @@ Index: src/lxc/lxc_container.c if (VIR_ALLOC_N(stack, stacksize) < 0) { virReportOOMError(NULL); return -1; -@@ -827,7 +830,11 @@ int lxcContainerStart(virDomainDefPtr de +@@ -828,7 +831,11 @@ int lxcContainerStart(virDomainDefPtr de if (def->nets != NULL) flags |= CLONE_NEWNET; @@ -24,7 +24,7 @@ Index: src/lxc/lxc_container.c VIR_FREE(stack); DEBUG("clone() returned, %d", pid); -@@ -853,6 +860,7 @@ int lxcContainerAvailable(int features) +@@ -854,6 +861,7 @@ int lxcContainerAvailable(int features) char *childStack; char *stack; int childStatus; @@ -32,7 +32,7 @@ Index: src/lxc/lxc_container.c if (features & LXC_CONTAINER_FEATURE_USER) flags |= CLONE_NEWUSER; -@@ -860,14 +868,21 @@ int lxcContainerAvailable(int features) +@@ -861,14 +869,21 @@ int lxcContainerAvailable(int features) if (features & LXC_CONTAINER_FEATURE_NET) flags |= CLONE_NEWNET; diff --git a/detach-disk.patch b/detach-disk.patch deleted file mode 100644 index 5ae9775..0000000 --- a/detach-disk.patch +++ /dev/null @@ -1,64 +0,0 @@ -Index: libvirt-0.7.5/src/xen/xend_internal.c -=================================================================== ---- libvirt-0.7.5.orig/src/xen/xend_internal.c -+++ libvirt-0.7.5/src/xen/xend_internal.c -@@ -4123,13 +4123,12 @@ xenDaemonAttachDevice(virDomainPtr domai - - priv = (xenUnifiedPrivatePtr) domain->conn->privateData; - -- /* -- * on older Xen without the inactive guests management -- * avoid doing this on inactive guests -- */ -- if ((domain->id < 0) && (priv->xendConfigVersion < 3)) -+ if (domain->id < 0) { -+ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, -+ "%s", _("cannot attach device on inactive domain")); - return -1; -- -+ } -+ - if (!(def = xenDaemonDomainFetch(domain->conn, - domain->id, - domain->name, -@@ -4229,12 +4228,11 @@ xenDaemonDetachDevice(virDomainPtr domai - - priv = (xenUnifiedPrivatePtr) domain->conn->privateData; - -- /* -- * on older Xen without the inactive guests management -- * avoid doing this on inactive guests -- */ -- if ((domain->id < 0) && (priv->xendConfigVersion < 3)) -+ if (domain->id < 0) { -+ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, -+ "%s", _("cannot detach device on inactive domain")); - return -1; -+ } - - if (!(def = xenDaemonDomainFetch(domain->conn, - domain->id, -Index: libvirt-0.7.5/src/libvirt.c -=================================================================== ---- libvirt-0.7.5.orig/src/libvirt.c -+++ libvirt-0.7.5/src/libvirt.c -@@ -5066,7 +5066,8 @@ error: - * @domain: pointer to domain object - * @xml: pointer to XML description of one device - * -- * Create a virtual device attachment to backend. -+ * Create a virtual device attachment to backend. This function, having -+ * hotplug semantics, is only allowed on an active domain. - * - * Returns 0 in case of success, -1 in case of failure. - */ -@@ -5109,7 +5110,8 @@ error: - * @domain: pointer to domain object - * @xml: pointer to XML description of one device - * -- * Destroy a virtual device attachment to backend. -+ * Destroy a virtual device attachment to backend. This function, having -+ * hot-unplug semantics, is only allowed on an active domain. - * - * Returns 0 in case of success, -1 in case of failure. - */ diff --git a/devflag-01.patch b/devflag-01.patch new file mode 100644 index 0000000..1a63d60 --- /dev/null +++ b/devflag-01.patch @@ -0,0 +1,37 @@ +commit d8ec244c6513b7c44956a547e56c228a4c38fbbe +Author: Jim Fehlig +Date: Wed Jan 13 18:24:51 2010 -0700 + + doc: restrict virDomain{Attach,Detach}Device to active domains + + virDomain{Attach,Detach}Device is now only permitted on active + domains. Explicitly state this restriction in the API + documentation. + + V2: Only change doc, dropping the hunk that forced the restriction + in libvirt frontend. + +Index: libvirt-0.7.6/src/libvirt.c +=================================================================== +--- libvirt-0.7.6.orig/src/libvirt.c ++++ libvirt-0.7.6/src/libvirt.c +@@ -5121,7 +5121,8 @@ error: + * @domain: pointer to domain object + * @xml: pointer to XML description of one device + * +- * Create a virtual device attachment to backend. ++ * Create a virtual device attachment to backend. This function, ++ * having hotplug semantics, is only allowed on an active domain. + * + * Returns 0 in case of success, -1 in case of failure. + */ +@@ -5164,7 +5165,8 @@ error: + * @domain: pointer to domain object + * @xml: pointer to XML description of one device + * +- * Destroy a virtual device attachment to backend. ++ * Destroy a virtual device attachment to backend. This function, ++ * having hot-unplug semantics, is only allowed on an active domain. + * + * Returns 0 in case of success, -1 in case of failure. + */ diff --git a/devflag-02.patch b/devflag-02.patch new file mode 100644 index 0000000..e2a72b9 --- /dev/null +++ b/devflag-02.patch @@ -0,0 +1,50 @@ +commit 7269ec07ba4f298adab64ea66ac528ef66cf9ba0 +Author: Jim Fehlig +Date: Wed Jan 13 18:29:16 2010 -0700 + + Public API + + Definition of public API for virDomain{Attach,Detach}DeviceFlags. + +diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in +index f192fb1..99a5c45 100644 +--- a/include/libvirt/libvirt.h.in ++++ b/include/libvirt/libvirt.h.in +@@ -845,9 +845,22 @@ int virDomainGetVcpus (virDomainPtr domain, + */ + #define VIR_GET_CPUMAP(cpumaps,maplen,vcpu) &(cpumaps[(vcpu)*(maplen)]) + ++ ++typedef enum { ++ ++ VIR_DOMAIN_DEVICE_MODIFY_CURRENT = 0, /* Modify device allocation based on current domain state */ ++ VIR_DOMAIN_DEVICE_MODIFY_LIVE = (1 << 0), /* Modify live device allocation */ ++ VIR_DOMAIN_DEVICE_MODIFY_CONFIG = (1 << 1), /* Modify persisted device allocation */ ++} virDomainDeviceModifyFlags; ++ + int virDomainAttachDevice(virDomainPtr domain, const char *xml); + int virDomainDetachDevice(virDomainPtr domain, const char *xml); + ++int virDomainAttachDeviceFlags(virDomainPtr domain, ++ const char *xml, unsigned int flags); ++int virDomainDetachDeviceFlags(virDomainPtr domain, ++ const char *xml, unsigned int flags); ++ + /* + * NUMA support + */ +diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms +index 0521158..e190d83 100644 +--- a/src/libvirt_public.syms ++++ b/src/libvirt_public.syms +@@ -349,4 +349,10 @@ LIBVIRT_0.7.5 { + virDomainMemoryStats; + } LIBVIRT_0.7.3; + ++LIBVIRT_0.7.6 { ++ global: ++ virDomainAttachDeviceFlags; ++ virDomainDetachDeviceFlags; ++} LIBVIRT_0.7.5; ++ + # .... define new API here using predicted next version number .... diff --git a/devflag-03.patch b/devflag-03.patch new file mode 100644 index 0000000..62df1a2 --- /dev/null +++ b/devflag-03.patch @@ -0,0 +1,40 @@ +commit 5ebd48c5f4e424e0db663bf5930935b1c04d4998 +Author: Jim Fehlig +Date: Wed Jan 13 18:31:14 2010 -0700 + + Internal API + + Definition of internal API for virDomain{Attach,Detach}DeviceFlags. + +diff --git a/src/driver.h b/src/driver.h +index c7e4fbf..08fe816 100644 +--- a/src/driver.h ++++ b/src/driver.h +@@ -192,9 +192,17 @@ typedef int + (*virDrvDomainAttachDevice) (virDomainPtr domain, + const char *xml); + typedef int ++ (*virDrvDomainAttachDeviceFlags) (virDomainPtr domain, ++ const char *xml, ++ unsigned int flags); ++typedef int + (*virDrvDomainDetachDevice) (virDomainPtr domain, + const char *xml); + typedef int ++ (*virDrvDomainDetachDeviceFlags) (virDomainPtr domain, ++ const char *xml, ++ unsigned int flags); ++typedef int + (*virDrvDomainGetAutostart) (virDomainPtr domain, + int *autostart); + typedef int +@@ -419,7 +427,9 @@ struct _virDriver { + virDrvDomainDefineXML domainDefineXML; + virDrvDomainUndefine domainUndefine; + virDrvDomainAttachDevice domainAttachDevice; ++ virDrvDomainAttachDeviceFlags domainAttachDeviceFlags; + virDrvDomainDetachDevice domainDetachDevice; ++ virDrvDomainDetachDeviceFlags domainDetachDeviceFlags; + virDrvDomainGetAutostart domainGetAutostart; + virDrvDomainSetAutostart domainSetAutostart; + virDrvDomainGetSchedulerType domainGetSchedulerType; diff --git a/devflag-04.patch b/devflag-04.patch new file mode 100644 index 0000000..9f232ec --- /dev/null +++ b/devflag-04.patch @@ -0,0 +1,155 @@ +commit 487b2434403d520027957ed623354b398984af31 +Author: Jim Fehlig +Date: Wed Jan 13 18:34:23 2010 -0700 + + Public API Implementation + + Implementation of public API for virDomain{Attach,Detach}DeviceFlags. + + V2: Don't break remote compatibility with older libvirtd + +Index: libvirt-0.7.6/src/libvirt.c +=================================================================== +--- libvirt-0.7.6.orig/src/libvirt.c ++++ libvirt-0.7.6/src/libvirt.c +@@ -5146,14 +5146,69 @@ virDomainAttachDevice(virDomainPtr domai + conn = domain->conn; + + if (conn->driver->domainAttachDevice) { ++ int ret; ++ ret = conn->driver->domainAttachDevice (domain, xml); ++ if (ret < 0) ++ goto error; ++ return ret; ++ } ++ ++ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); ++ ++error: ++ virDispatchError(domain->conn); ++ return -1; ++} ++ ++/** ++ * virDomainAttachDeviceFlags: ++ * @domain: pointer to domain object ++ * @xml: pointer to XML description of one device ++ * @flags: an OR'ed set of virDomainDeviceModifyFlags ++ * ++ * Attach a virtual device to a domain, using the flags parameter ++ * to control how the device is attached. VIR_DOMAIN_DEVICE_MODIFY_CURRENT ++ * specifies that the device allocation is made based on current domain ++ * state. VIR_DOMAIN_DEVICE_MODIFY_LIVE specifies that the device shall be ++ * allocated to the active domain instance only and is not added to the ++ * persisted domain configuration. VIR_DOMAIN_DEVICE_MODIFY_CONFIG ++ * specifies that the device shall be allocated to the persisted domain ++ * configuration only. Note that the target hypervisor must return an ++ * error if unable to satisfy flags. E.g. the hypervisor driver will ++ * return failure if LIVE is specified but it only supports modifying the ++ * persisted device allocation. ++ * ++ * Returns 0 in case of success, -1 in case of failure. ++ */ ++int ++virDomainAttachDeviceFlags(virDomainPtr domain, ++ const char *xml, unsigned int flags) ++{ ++ virConnectPtr conn; ++ DEBUG("domain=%p, xml=%s, flags=%d", domain, xml, flags); ++ ++ virResetLastError(); ++ ++ if (!VIR_IS_CONNECTED_DOMAIN(domain)) { ++ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); ++ virDispatchError(NULL); ++ return (-1); ++ } ++ if (domain->conn->flags & VIR_CONNECT_RO) { ++ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__); ++ goto error; ++ } ++ conn = domain->conn; ++ ++ if (conn->driver->domainAttachDeviceFlags) { + int ret; +- ret = conn->driver->domainAttachDevice (domain, xml); ++ ret = conn->driver->domainAttachDeviceFlags(domain, xml, flags); + if (ret < 0) + goto error; + return ret; + } + +- virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); ++ virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); + + error: + virDispatchError(domain->conn); +@@ -5192,12 +5247,67 @@ virDomainDetachDevice(virDomainPtr domai + if (conn->driver->domainDetachDevice) { + int ret; + ret = conn->driver->domainDetachDevice (domain, xml); ++ if (ret < 0) ++ goto error; ++ return ret; ++ } ++ ++ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); ++ ++error: ++ virDispatchError(domain->conn); ++ return -1; ++} ++ ++/** ++ * virDomainDetachDeviceFlags: ++ * @domain: pointer to domain object ++ * @xml: pointer to XML description of one device ++ * @flags: an OR'ed set of virDomainDeviceModifyFlags ++ * ++ * Detach a virtual device from a domain, using the flags parameter ++ * to control how the device is detached. VIR_DOMAIN_DEVICE_MODIFY_CURRENT ++ * specifies that the device allocation is removed based on current domain ++ * state. VIR_DOMAIN_DEVICE_MODIFY_LIVE specifies that the device shall be ++ * deallocated from the active domain instance only and is not from the ++ * persisted domain configuration. VIR_DOMAIN_DEVICE_MODIFY_CONFIG ++ * specifies that the device shall be deallocated from the persisted domain ++ * configuration only. Note that the target hypervisor must return an ++ * error if unable to satisfy flags. E.g. the hypervisor driver will ++ * return failure if LIVE is specified but it only supports removing the ++ * persisted device allocation. ++ * ++ * Returns 0 in case of success, -1 in case of failure. ++ */ ++int ++virDomainDetachDeviceFlags(virDomainPtr domain, ++ const char *xml, unsigned int flags) ++{ ++ virConnectPtr conn; ++ DEBUG("domain=%p, xml=%s, flags=%d", domain, xml, flags); ++ ++ virResetLastError(); ++ ++ if (!VIR_IS_CONNECTED_DOMAIN(domain)) { ++ virLibDomainError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__); ++ virDispatchError(NULL); ++ return (-1); ++ } ++ if (domain->conn->flags & VIR_CONNECT_RO) { ++ virLibDomainError(domain, VIR_ERR_OPERATION_DENIED, __FUNCTION__); ++ goto error; ++ } ++ conn = domain->conn; ++ ++ if (conn->driver->domainDetachDeviceFlags) { ++ int ret; ++ ret = conn->driver->domainDetachDeviceFlags(domain, xml, flags); + if (ret < 0) + goto error; + return ret; + } + +- virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); ++ virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__); + + error: + virDispatchError(domain->conn); diff --git a/devflag-05.patch b/devflag-05.patch new file mode 100644 index 0000000..0080715 --- /dev/null +++ b/devflag-05.patch @@ -0,0 +1,49 @@ +commit 5ef6d92292f5c9dd27c7db2bf56f8f24b13c681b +Author: Jim Fehlig +Date: Wed Jan 13 18:39:35 2010 -0700 + + Wire protocol format + + Definition of wire protocol format for + virDomain{Attach,Detach}DeviceFlags. + +diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x +index bed3940..98953a9 100644 +--- a/src/remote/remote_protocol.x ++++ b/src/remote/remote_protocol.x +@@ -708,11 +708,23 @@ struct remote_domain_attach_device_args { + remote_nonnull_string xml; + }; + ++struct remote_domain_attach_device_flags_args { ++ remote_nonnull_domain dom; ++ remote_nonnull_string xml; ++ unsigned int flags; ++}; ++ + struct remote_domain_detach_device_args { + remote_nonnull_domain dom; + remote_nonnull_string xml; + }; + ++struct remote_domain_detach_device_flags_args { ++ remote_nonnull_domain dom; ++ remote_nonnull_string xml; ++ unsigned int flags; ++}; ++ + struct remote_domain_get_autostart_args { + remote_nonnull_domain dom; + }; +@@ -1641,7 +1653,10 @@ enum remote_procedure { + REMOTE_PROC_INTERFACE_IS_ACTIVE = 156, + REMOTE_PROC_GET_LIB_VERSION = 157, + REMOTE_PROC_CPU_COMPARE = 158, +- REMOTE_PROC_DOMAIN_MEMORY_STATS = 159 ++ REMOTE_PROC_DOMAIN_MEMORY_STATS = 159, ++ REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS = 160, ++ ++ REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS = 161 + + /* + * Notice how the entries are grouped in sets of 10 ? diff --git a/devflag-06.patch b/devflag-06.patch new file mode 100644 index 0000000..6183641 --- /dev/null +++ b/devflag-06.patch @@ -0,0 +1,88 @@ +commit 80bfb087ae4d92b271eadaee6e08b5ea2d1b68a6 +Author: Jim Fehlig +Date: Wed Jan 13 18:41:13 2010 -0700 + + Remote driver + + Implementation of Domain{Attach,Detach}DeviceFlags in remote driver. + +diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c +index d6f5fce..eb16f62 100644 +--- a/src/remote/remote_driver.c ++++ b/src/remote/remote_driver.c +@@ -3057,6 +3057,32 @@ done: + } + + static int ++remoteDomainAttachDeviceFlags (virDomainPtr domain, const char *xml, ++ unsigned int flags) ++{ ++ int rv = -1; ++ remote_domain_attach_device_flags_args args; ++ struct private_data *priv = domain->conn->privateData; ++ ++ remoteDriverLock(priv); ++ ++ make_nonnull_domain (&args.dom, domain); ++ args.xml = (char *) xml; ++ args.flags = flags; ++ ++ if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_ATTACH_DEVICE_FLAGS, ++ (xdrproc_t) xdr_remote_domain_attach_device_flags_args, (char *) &args, ++ (xdrproc_t) xdr_void, (char *) NULL) == -1) ++ goto done; ++ ++ rv = 0; ++ ++done: ++ remoteDriverUnlock(priv); ++ return rv; ++} ++ ++static int + remoteDomainDetachDevice (virDomainPtr domain, const char *xml) + { + int rv = -1; +@@ -3081,6 +3107,32 @@ done: + } + + static int ++remoteDomainDetachDeviceFlags (virDomainPtr domain, const char *xml, ++ unsigned int flags) ++{ ++ int rv = -1; ++ remote_domain_detach_device_flags_args args; ++ struct private_data *priv = domain->conn->privateData; ++ ++ remoteDriverLock(priv); ++ ++ make_nonnull_domain (&args.dom, domain); ++ args.xml = (char *) xml; ++ args.flags = flags; ++ ++ if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_DETACH_DEVICE_FLAGS, ++ (xdrproc_t) xdr_remote_domain_detach_device_flags_args, (char *) &args, ++ (xdrproc_t) xdr_void, (char *) NULL) == -1) ++ goto done; ++ ++ rv = 0; ++ ++done: ++ remoteDriverUnlock(priv); ++ return rv; ++} ++ ++static int + remoteDomainGetAutostart (virDomainPtr domain, int *autostart) + { + int rv = -1; +@@ -8894,7 +8946,9 @@ static virDriver remote_driver = { + remoteDomainDefineXML, /* domainDefineXML */ + remoteDomainUndefine, /* domainUndefine */ + remoteDomainAttachDevice, /* domainAttachDevice */ ++ remoteDomainAttachDeviceFlags, /* domainAttachDeviceFlags */ + remoteDomainDetachDevice, /* domainDetachDevice */ ++ remoteDomainDetachDeviceFlags, /* domainDetachDeviceFlags */ + remoteDomainGetAutostart, /* domainGetAutostart */ + remoteDomainSetAutostart, /* domainSetAutostart */ + remoteDomainGetSchedulerType, /* domainGetSchedulerType */ diff --git a/devflag-07.patch b/devflag-07.patch new file mode 100644 index 0000000..f934e9c --- /dev/null +++ b/devflag-07.patch @@ -0,0 +1,79 @@ +commit 5b724a365e67d1cc2649ded76dea03836a067921 +Author: Jim Fehlig +Date: Wed Jan 13 18:42:28 2010 -0700 + + Server side dispatcher + + Server side dispatcher for Domain{Attach,Detach}DeviceFlags. + +diff --git a/daemon/remote.c b/daemon/remote.c +index 299f971..bf156e4 100644 +--- a/daemon/remote.c ++++ b/daemon/remote.c +@@ -890,6 +890,32 @@ remoteDispatchDomainAttachDevice (struct qemud_server *server ATTRIBUTE_UNUSED, + } + + static int ++remoteDispatchDomainAttachDeviceFlags (struct qemud_server *server ATTRIBUTE_UNUSED, ++ struct qemud_client *client ATTRIBUTE_UNUSED, ++ virConnectPtr conn, ++ remote_message_header *hdr ATTRIBUTE_UNUSED, ++ remote_error *rerr, ++ remote_domain_attach_device_flags_args *args, ++ void *ret ATTRIBUTE_UNUSED) ++{ ++ virDomainPtr dom; ++ ++ dom = get_nonnull_domain (conn, args->dom); ++ if (dom == NULL) { ++ remoteDispatchConnError(rerr, conn); ++ return -1; ++ } ++ ++ if (virDomainAttachDeviceFlags (dom, args->xml, args->flags) == -1) { ++ virDomainFree(dom); ++ remoteDispatchConnError(rerr, conn); ++ return -1; ++ } ++ virDomainFree(dom); ++ return 0; ++} ++ ++static int + remoteDispatchDomainCreate (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, +@@ -1015,6 +1041,33 @@ remoteDispatchDomainDetachDevice (struct qemud_server *server ATTRIBUTE_UNUSED, + } + + static int ++remoteDispatchDomainDetachDeviceFlags (struct qemud_server *server ATTRIBUTE_UNUSED, ++ struct qemud_client *client ATTRIBUTE_UNUSED, ++ virConnectPtr conn, ++ remote_message_header *hdr ATTRIBUTE_UNUSED, ++ remote_error *rerr, ++ remote_domain_detach_device_flags_args *args, ++ void *ret ATTRIBUTE_UNUSED) ++{ ++ virDomainPtr dom; ++ ++ dom = get_nonnull_domain (conn, args->dom); ++ if (dom == NULL) { ++ remoteDispatchConnError(rerr, conn); ++ return -1; ++ } ++ ++ if (virDomainDetachDeviceFlags (dom, args->xml, args->flags) == -1) { ++ virDomainFree(dom); ++ remoteDispatchConnError(rerr, conn); ++ return -1; ++ } ++ ++ virDomainFree(dom); ++ return 0; ++} ++ ++static int + remoteDispatchDomainDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED, + struct qemud_client *client ATTRIBUTE_UNUSED, + virConnectPtr conn, diff --git a/devflag-08.patch b/devflag-08.patch new file mode 100644 index 0000000..b1593cf --- /dev/null +++ b/devflag-08.patch @@ -0,0 +1,609 @@ +commit ff9fce67120771b0ec1e21a98afc96360a7bbb36 +Author: Jim Fehlig +Date: Wed Jan 13 18:44:26 2010 -0700 + + domain{Attach,Detach}DeviceFlags handler for drivers + + Implementation of domain{Attach,Detach}DeviceFlags handlers + in the drivers. + +Index: libvirt-0.7.6/src/esx/esx_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/esx/esx_driver.c ++++ libvirt-0.7.6/src/esx/esx_driver.c +@@ -3372,7 +3372,9 @@ static virDriver esxDriver = { + esxDomainDefineXML, /* domainDefineXML */ + esxDomainUndefine, /* domainUndefine */ + NULL, /* domainAttachDevice */ ++ NULL, /* domainAttachDeviceFlags */ + NULL, /* domainDetachDevice */ ++ NULL, /* domainDetachDeviceFlags */ + NULL, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + esxDomainGetSchedulerType, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/lxc/lxc_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/lxc/lxc_driver.c ++++ libvirt-0.7.6/src/lxc/lxc_driver.c +@@ -2427,7 +2427,9 @@ static virDriver lxcDriver = { + lxcDomainDefine, /* domainDefineXML */ + lxcDomainUndefine, /* domainUndefine */ + NULL, /* domainAttachDevice */ ++ NULL, /* domainAttachDeviceFlags */ + NULL, /* domainDetachDevice */ ++ NULL, /* domainDetachDeviceFlags */ + lxcDomainGetAutostart, /* domainGetAutostart */ + lxcDomainSetAutostart, /* domainSetAutostart */ + lxcGetSchedulerType, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/opennebula/one_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/opennebula/one_driver.c ++++ libvirt-0.7.6/src/opennebula/one_driver.c +@@ -754,7 +754,9 @@ static virDriver oneDriver = { + oneDomainDefine, /* domainDefineXML */ + oneDomainUndefine, /* domainUndefine */ + NULL, /* domainAttachDevice */ ++ NULL, /* domainAttachDeviceFlags */ + NULL, /* domainDetachDevice */ ++ NULL, /* domainDetachDeviceFlags */ + oneGetAutostart, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/openvz/openvz_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/openvz/openvz_driver.c ++++ libvirt-0.7.6/src/openvz/openvz_driver.c +@@ -1506,7 +1506,9 @@ static virDriver openvzDriver = { + openvzDomainDefineXML, /* domainDefineXML */ + openvzDomainUndefine, /* domainUndefine */ + NULL, /* domainAttachDevice */ ++ NULL, /* domainAttachDeviceFlags */ + NULL, /* domainDetachDevice */ ++ NULL, /* domainDetachDeviceFlags */ + openvzDomainGetAutostart, /* domainGetAutostart */ + openvzDomainSetAutostart, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/phyp/phyp_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/phyp/phyp_driver.c ++++ libvirt-0.7.6/src/phyp/phyp_driver.c +@@ -1622,7 +1622,9 @@ virDriver phypDriver = { + NULL, /* domainDefineXML */ + NULL, /* domainUndefine */ + NULL, /* domainAttachDevice */ ++ NULL, /* domainAttachDeviceFlags */ + NULL, /* domainDetachDevice */ ++ NULL, /* domainDetachDeviceFlags */ + NULL, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/qemu/qemu_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/qemu/qemu_driver.c ++++ libvirt-0.7.6/src/qemu/qemu_driver.c +@@ -6057,6 +6057,18 @@ cleanup: + return ret; + } + ++static int qemudDomainAttachDeviceFlags(virDomainPtr dom, ++ const char *xml, ++ unsigned int flags) { ++ if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { ++ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, ++ "%s", _("cannot modify the persistent configuration of a domain")); ++ return -1; ++ } ++ ++ return qemudDomainAttachDevice(dom, xml); ++} ++ + static int qemudDomainDetachPciDiskDevice(virConnectPtr conn, + struct qemud_driver *driver, + virDomainObjPtr vm, +@@ -6464,6 +6476,18 @@ cleanup: + return ret; + } + ++static int qemudDomainDetachDeviceFlags(virDomainPtr dom, ++ const char *xml, ++ unsigned int flags) { ++ if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { ++ qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, ++ "%s", _("cannot modify the persistent configuration of a domain")); ++ return -1; ++ } ++ ++ return qemudDomainDetachDevice(dom, xml); ++} ++ + static int qemudDomainGetAutostart(virDomainPtr dom, + int *autostart) { + struct qemud_driver *driver = dom->conn->privateData; +@@ -8577,7 +8601,9 @@ static virDriver qemuDriver = { + qemudDomainDefine, /* domainDefineXML */ + qemudDomainUndefine, /* domainUndefine */ + qemudDomainAttachDevice, /* domainAttachDevice */ ++ qemudDomainAttachDeviceFlags, /* domainAttachDeviceFlags */ + qemudDomainDetachDevice, /* domainDetachDevice */ ++ qemudDomainDetachDeviceFlags, /* domainDetachDeviceFlags */ + qemudDomainGetAutostart, /* domainGetAutostart */ + qemudDomainSetAutostart, /* domainSetAutostart */ + qemuGetSchedulerType, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/test/test_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/test/test_driver.c ++++ libvirt-0.7.6/src/test/test_driver.c +@@ -5209,7 +5209,9 @@ static virDriver testDriver = { + testDomainDefineXML, /* domainDefineXML */ + testDomainUndefine, /* domainUndefine */ + NULL, /* domainAttachDevice */ ++ NULL, /* domainAttachDeviceFlags */ + NULL, /* domainDetachDevice */ ++ NULL, /* domainDetachDeviceFlags */ + testDomainGetAutostart, /* domainGetAutostart */ + testDomainSetAutostart, /* domainSetAutostart */ + testDomainGetSchedulerType, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/uml/uml_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/uml/uml_driver.c ++++ libvirt-0.7.6/src/uml/uml_driver.c +@@ -1895,7 +1895,9 @@ static virDriver umlDriver = { + umlDomainDefine, /* domainDefineXML */ + umlDomainUndefine, /* domainUndefine */ + NULL, /* domainAttachDevice */ ++ NULL, /* domainAttachDeviceFlags */ + NULL, /* domainDetachDevice */ ++ NULL, /* domainDetachDeviceFlags */ + umlDomainGetAutostart, /* domainGetAutostart */ + umlDomainSetAutostart, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/vbox/vbox_tmpl.c +=================================================================== +--- libvirt-0.7.6.orig/src/vbox/vbox_tmpl.c ++++ libvirt-0.7.6/src/vbox/vbox_tmpl.c +@@ -4835,6 +4835,17 @@ cleanup: + return ret; + } + ++static int vboxDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, ++ unsigned int flags) { ++ if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { ++ vboxError(dom->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("cannot modify the persistent configuration of a domain")); ++ return -1; ++ } ++ ++ return vboxDomainAttachDevice(dom, xml); ++} ++ + static int vboxDomainDetachDevice(virDomainPtr dom, const char *xml) { + VBOX_OBJECT_CHECK(dom->conn, int, -1); + IMachine *machine = NULL; +@@ -4965,6 +4976,17 @@ cleanup: + return ret; + } + ++static int vboxDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, ++ unsigned int flags) { ++ if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) { ++ vboxError(dom->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("cannot modify the persistent configuration of a domain")); ++ return -1; ++ } ++ ++ return vboxDomainDetachDevice(dom, xml); ++} ++ + #if VBOX_API_VERSION == 2002 + /* No Callback support for VirtualBox 2.2.* series */ + #else /* !(VBOX_API_VERSION == 2002) */ +@@ -7001,7 +7023,9 @@ virDriver NAME(Driver) = { + vboxDomainDefineXML, /* domainDefineXML */ + vboxDomainUndefine, /* domainUndefine */ + vboxDomainAttachDevice, /* domainAttachDevice */ ++ vboxDomainAttachDeviceFlags, /* domainAttachDeviceFlags */ + vboxDomainDetachDevice, /* domainDetachDevice */ ++ vboxDomainDetachDeviceFlags, /* domainDetachDeviceFlags */ + NULL, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/xen/proxy_internal.c +=================================================================== +--- libvirt-0.7.6.orig/src/xen/proxy_internal.c ++++ libvirt-0.7.6/src/xen/proxy_internal.c +@@ -76,8 +76,8 @@ struct xenUnifiedDriver xenProxyDriver = + NULL, /* domainCreate */ + NULL, /* domainDefineXML */ + NULL, /* domainUndefine */ +- NULL, /* domainAttachDevice */ +- NULL, /* domainDetachDevice */ ++ NULL, /* domainAttachDeviceFlags */ ++ NULL, /* domainDetachDeviceFlags */ + NULL, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/xen/xen_driver.c +=================================================================== +--- libvirt-0.7.6.orig/src/xen/xen_driver.c ++++ libvirt-0.7.6/src/xen/xen_driver.c +@@ -1428,10 +1428,29 @@ xenUnifiedDomainAttachDevice (virDomainP + { + GET_PRIVATE(dom->conn); + int i; ++ unsigned int flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; ++ ++ if (dom->id >= 0) ++ flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; ++ ++ for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) ++ if (priv->opened[i] && drivers[i]->domainAttachDeviceFlags && ++ drivers[i]->domainAttachDeviceFlags(dom, xml, flags) == 0) ++ return 0; ++ ++ return -1; ++} ++ ++static int ++xenUnifiedDomainAttachDeviceFlags (virDomainPtr dom, const char *xml, ++ unsigned int flags) ++{ ++ GET_PRIVATE(dom->conn); ++ int i; + + for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) +- if (priv->opened[i] && drivers[i]->domainAttachDevice && +- drivers[i]->domainAttachDevice (dom, xml) == 0) ++ if (priv->opened[i] && drivers[i]->domainAttachDeviceFlags && ++ drivers[i]->domainAttachDeviceFlags(dom, xml, flags) == 0) + return 0; + + return -1; +@@ -1442,10 +1461,29 @@ xenUnifiedDomainDetachDevice (virDomainP + { + GET_PRIVATE(dom->conn); + int i; ++ unsigned int flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; ++ ++ if (dom->id >= 0) ++ flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; ++ ++ for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) ++ if (priv->opened[i] && drivers[i]->domainDetachDeviceFlags && ++ drivers[i]->domainDetachDeviceFlags(dom, xml, flags) == 0) ++ return 0; ++ ++ return -1; ++} ++ ++static int ++xenUnifiedDomainDetachDeviceFlags (virDomainPtr dom, const char *xml, ++ unsigned int flags) ++{ ++ GET_PRIVATE(dom->conn); ++ int i; + + for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) +- if (priv->opened[i] && drivers[i]->domainDetachDevice && +- drivers[i]->domainDetachDevice (dom, xml) == 0) ++ if (priv->opened[i] && drivers[i]->domainDetachDeviceFlags && ++ drivers[i]->domainDetachDeviceFlags(dom, xml, flags) == 0) + return 0; + + return -1; +@@ -1835,7 +1873,9 @@ static virDriver xenUnifiedDriver = { + xenUnifiedDomainDefineXML, /* domainDefineXML */ + xenUnifiedDomainUndefine, /* domainUndefine */ + xenUnifiedDomainAttachDevice, /* domainAttachDevice */ ++ xenUnifiedDomainAttachDeviceFlags, /* domainAttachDeviceFlags */ + xenUnifiedDomainDetachDevice, /* domainDetachDevice */ ++ xenUnifiedDomainDetachDeviceFlags, /* domainDetachDeviceFlags */ + xenUnifiedDomainGetAutostart, /* domainGetAutostart */ + xenUnifiedDomainSetAutostart, /* domainSetAutostart */ + xenUnifiedDomainGetSchedulerType, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/xen/xen_driver.h +=================================================================== +--- libvirt-0.7.6.orig/src/xen/xen_driver.h ++++ libvirt-0.7.6/src/xen/xen_driver.h +@@ -93,8 +93,8 @@ struct xenUnifiedDriver { + virDrvDomainCreate domainCreate; + virDrvDomainDefineXML domainDefineXML; + virDrvDomainUndefine domainUndefine; +- virDrvDomainAttachDevice domainAttachDevice; +- virDrvDomainDetachDevice domainDetachDevice; ++ virDrvDomainAttachDeviceFlags domainAttachDeviceFlags; ++ virDrvDomainDetachDeviceFlags domainDetachDeviceFlags; + virDrvDomainGetAutostart domainGetAutostart; + virDrvDomainSetAutostart domainSetAutostart; + virDrvDomainGetSchedulerType domainGetSchedulerType; +Index: libvirt-0.7.6/src/xen/xen_hypervisor.c +=================================================================== +--- libvirt-0.7.6.orig/src/xen/xen_hypervisor.c ++++ libvirt-0.7.6/src/xen/xen_hypervisor.c +@@ -793,8 +793,8 @@ struct xenUnifiedDriver xenHypervisorDri + NULL, /* domainCreate */ + NULL, /* domainDefineXML */ + NULL, /* domainUndefine */ +- NULL, /* domainAttachDevice */ +- NULL, /* domainDetachDevice */ ++ NULL, /* domainAttachDeviceFlags */ ++ NULL, /* domainDetachDeviceFlags */ + NULL, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + xenHypervisorGetSchedulerType, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/xen/xen_inotify.c +=================================================================== +--- libvirt-0.7.6.orig/src/xen/xen_inotify.c ++++ libvirt-0.7.6/src/xen/xen_inotify.c +@@ -79,8 +79,8 @@ struct xenUnifiedDriver xenInotifyDriver + NULL, /* domainCreate */ + NULL, /* domainDefineXML */ + NULL, /* domainUndefine */ +- NULL, /* domainAttachDevice */ +- NULL, /* domainDetachDevice */ ++ NULL, /* domainAttachDeviceFlags */ ++ NULL, /* domainDetachDeviceFlags */ + NULL, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/xen/xend_internal.c +=================================================================== +--- libvirt-0.7.6.orig/src/xen/xend_internal.c ++++ libvirt-0.7.6/src/xen/xend_internal.c +@@ -4096,9 +4096,10 @@ xenDaemonCreateXML(virConnectPtr conn, c + } + + /** +- * xenDaemonAttachDevice: ++ * xenDaemonAttachDeviceFlags: + * @domain: pointer to domain object + * @xml: pointer to XML description of device ++ * @flags: an OR'ed set of virDomainDeviceModifyFlags + * + * Create a virtual device attachment to backend. + * XML description is translated into S-expression. +@@ -4106,7 +4107,8 @@ xenDaemonCreateXML(virConnectPtr conn, c + * Returns 0 in case of success, -1 in case of failure. + */ + static int +-xenDaemonAttachDevice(virDomainPtr domain, const char *xml) ++xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml, ++ unsigned int flags) + { + xenUnifiedPrivatePtr priv; + char *sexpr = NULL; +@@ -4124,12 +4126,41 @@ xenDaemonAttachDevice(virDomainPtr domai + + priv = (xenUnifiedPrivatePtr) domain->conn->privateData; + +- /* +- * on older Xen without the inactive guests management +- * avoid doing this on inactive guests +- */ +- if ((domain->id < 0) && (priv->xendConfigVersion < 3)) +- return -1; ++ if (domain->id < 0) { ++ /* If xendConfigVersion < 3 only live config can be changed */ ++ if (priv->xendConfigVersion < 3) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("Xend version does not support modifying " ++ "persisted config")); ++ return -1; ++ } ++ /* Cannot modify live config if domain is inactive */ ++ if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("Cannot modify live config if domain is inactive")); ++ return -1; ++ } ++ } else { ++ /* Only live config can be changed if xendConfigVersion < 3 */ ++ if (priv->xendConfigVersion < 3 && ++ (flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT || ++ flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("Xend version does not support modifying " ++ "persisted config")); ++ return -1; ++ } ++ /* Xen only supports modifying both live and persisted config if ++ * xendConfigVersion >= 3 ++ */ ++ if (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE | ++ VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("Xend only supports modifying both live and " ++ "persisted config")); ++ return -1; ++ } ++ } + + if (!(def = xenDaemonDomainFetch(domain->conn, + domain->id, +@@ -4203,16 +4234,18 @@ cleanup: + } + + /** +- * xenDaemonDetachDevice: ++ * xenDaemonDetachDeviceFlags: + * @domain: pointer to domain object + * @xml: pointer to XML description of device ++ * @flags: an OR'ed set of virDomainDeviceModifyFlags + * + * Destroy a virtual device attachment to backend. + * + * Returns 0 in case of success, -1 in case of failure. + */ + static int +-xenDaemonDetachDevice(virDomainPtr domain, const char *xml) ++xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml, ++ unsigned int flags) + { + xenUnifiedPrivatePtr priv; + char class[8], ref[80]; +@@ -4230,12 +4263,41 @@ xenDaemonDetachDevice(virDomainPtr domai + + priv = (xenUnifiedPrivatePtr) domain->conn->privateData; + +- /* +- * on older Xen without the inactive guests management +- * avoid doing this on inactive guests +- */ +- if ((domain->id < 0) && (priv->xendConfigVersion < 3)) +- return -1; ++ if (domain->id < 0) { ++ /* If xendConfigVersion < 3 only live config can be changed */ ++ if (priv->xendConfigVersion < 3) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("Xend version does not support modifying " ++ "persisted config")); ++ return -1; ++ } ++ /* Cannot modify live config if domain is inactive */ ++ if (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("Cannot modify live config if domain is inactive")); ++ return -1; ++ } ++ } else { ++ /* Only live config can be changed if xendConfigVersion < 3 */ ++ if (priv->xendConfigVersion < 3 && ++ (flags != VIR_DOMAIN_DEVICE_MODIFY_CURRENT || ++ flags != VIR_DOMAIN_DEVICE_MODIFY_LIVE)) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("Xend version does not support modifying " ++ "persisted config")); ++ return -1; ++ } ++ /* Xen only supports modifying both live and persisted config if ++ * xendConfigVersion >= 3 ++ */ ++ if (flags != (VIR_DOMAIN_DEVICE_MODIFY_LIVE | ++ VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) { ++ virXendError(domain->conn, VIR_ERR_OPERATION_INVALID, "%s", ++ _("Xend only supports modifying both live and " ++ "persisted config")); ++ return -1; ++ } ++ } + + if (!(def = xenDaemonDomainFetch(domain->conn, + domain->id, +@@ -5165,8 +5227,8 @@ struct xenUnifiedDriver xenDaemonDriver + xenDaemonDomainCreate, /* domainCreate */ + xenDaemonDomainDefineXML, /* domainDefineXML */ + xenDaemonDomainUndefine, /* domainUndefine */ +- xenDaemonAttachDevice, /* domainAttachDevice */ +- xenDaemonDetachDevice, /* domainDetachDevice */ ++ xenDaemonAttachDeviceFlags, /* domainAttachDeviceFlags */ ++ xenDaemonDetachDeviceFlags, /* domainDetachDeviceFlags */ + xenDaemonDomainGetAutostart, /* domainGetAutostart */ + xenDaemonDomainSetAutostart, /* domainSetAutostart */ + xenDaemonGetSchedulerType, /* domainGetSchedulerType */ +Index: libvirt-0.7.6/src/xen/xm_internal.c +=================================================================== +--- libvirt-0.7.6.orig/src/xen/xm_internal.c ++++ libvirt-0.7.6/src/xen/xm_internal.c +@@ -65,8 +65,10 @@ + static int xenXMConfigSetString(virConfPtr conf, const char *setting, + const char *str); + char * xenXMAutoAssignMac(void); +-static int xenXMDomainAttachDevice(virDomainPtr domain, const char *xml); +-static int xenXMDomainDetachDevice(virDomainPtr domain, const char *xml); ++static int xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml, ++ unsigned int flags); ++static int xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml, ++ unsigned int flags); + + #define XM_REFRESH_INTERVAL 10 + +@@ -109,8 +111,8 @@ struct xenUnifiedDriver xenXMDriver = { + xenXMDomainCreate, /* domainCreate */ + xenXMDomainDefineXML, /* domainDefineXML */ + xenXMDomainUndefine, /* domainUndefine */ +- xenXMDomainAttachDevice, /* domainAttachDevice */ +- xenXMDomainDetachDevice, /* domainDetachDevice */ ++ xenXMDomainAttachDeviceFlags, /* domainAttachDeviceFlags */ ++ xenXMDomainDetachDeviceFlags, /* domainDetachDeviceFlags */ + NULL, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ +@@ -2914,17 +2916,21 @@ cleanup: + + + /** +- * xenXMDomainAttachDevice: ++ * xenXMDomainAttachDeviceFlags: + * @domain: pointer to domain object + * @xml: pointer to XML description of device ++ * @flags: an OR'ed set of virDomainDeviceModifyFlags + * + * Create a virtual device attachment to backend. + * XML description is translated into config file. ++ * This driver only supports device allocation to ++ * persisted config. + * + * Returns 0 in case of success, -1 in case of failure. + */ + static int +-xenXMDomainAttachDevice(virDomainPtr domain, const char *xml) { ++xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml, ++ unsigned int flags) { + const char *filename = NULL; + xenXMConfCachePtr entry = NULL; + int ret = -1; +@@ -2940,7 +2946,7 @@ xenXMDomainAttachDevice(virDomainPtr dom + + if (domain->conn->flags & VIR_CONNECT_RO) + return -1; +- if (domain->id != -1) ++ if (domain->id != -1 && !(flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) + return -1; + + priv = (xenUnifiedPrivatePtr) domain->conn->privateData; +@@ -3002,16 +3008,20 @@ xenXMDomainAttachDevice(virDomainPtr dom + + + /** +- * xenXMDomainDetachDevice: ++ * xenXMDomainDetachDeviceFlags: + * @domain: pointer to domain object + * @xml: pointer to XML description of device ++ * @flags: an OR'ed set of virDomainDeviceModifyFlags + * + * Destroy a virtual device attachment to backend. ++ * This driver only supports device deallocation from ++ * persisted config. + * + * Returns 0 in case of success, -1 in case of failure. + */ + static int +-xenXMDomainDetachDevice(virDomainPtr domain, const char *xml) { ++xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml, ++ unsigned int flags) { + const char *filename = NULL; + xenXMConfCachePtr entry = NULL; + virDomainDeviceDefPtr dev = NULL; +@@ -3029,7 +3039,7 @@ xenXMDomainDetachDevice(virDomainPtr dom + + if (domain->conn->flags & VIR_CONNECT_RO) + return -1; +- if (domain->id != -1) ++ if (domain->id != -1 && !(flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG)) + return -1; + + priv = (xenUnifiedPrivatePtr) domain->conn->privateData; +Index: libvirt-0.7.6/src/xen/xs_internal.c +=================================================================== +--- libvirt-0.7.6.orig/src/xen/xs_internal.c ++++ libvirt-0.7.6/src/xen/xs_internal.c +@@ -76,8 +76,8 @@ struct xenUnifiedDriver xenStoreDriver = + NULL, /* domainCreate */ + NULL, /* domainDefineXML */ + NULL, /* domainUndefine */ +- NULL, /* domainAttachDevice */ +- NULL, /* domainDetachDevice */ ++ NULL, /* domainAttachDeviceFlags */ ++ NULL, /* domainDetachDeviceFlags */ + NULL, /* domainGetAutostart */ + NULL, /* domainSetAutostart */ + NULL, /* domainGetSchedulerType */ diff --git a/devflag-09.patch b/devflag-09.patch new file mode 100644 index 0000000..fe69544 --- /dev/null +++ b/devflag-09.patch @@ -0,0 +1,253 @@ +commit 3a9b2b900c5dac18c9c48c40ec2dbeaa7c306a0e +Author: Jim Fehlig +Date: Wed Jan 13 18:54:58 2010 -0700 + + Modify virsh commands + + Change all virsh commands that invoke virDomain{Attach,Detach}Device() + to use virDomain{Attach,Detach}DeviceFlags() instead. + + Add a "--persistent" flag to these virsh commands, allowing user to + specify that the domain persisted config be modified as well. + + V2: Only invoke virDomain{Attach,Detach}DeviceFlags() if + "--persistent" flag is specified. Otherwise invoke + virDomain{Attach,Detach}Device() to retain current behavior. + +Index: libvirt-0.7.6/tools/virsh.c +=================================================================== +--- libvirt-0.7.6.orig/tools/virsh.c ++++ libvirt-0.7.6/tools/virsh.c +@@ -6285,6 +6285,7 @@ static const vshCmdInfo info_attach_devi + static const vshCmdOptDef opts_attach_device[] = { + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")}, + {"file", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("XML file")}, ++ {"persistent", VSH_OT_BOOL, 0, gettext_noop("persist device attachment")}, + {NULL, 0, 0, NULL} + }; + +@@ -6296,6 +6297,7 @@ cmdAttachDevice(vshControl *ctl, const v + char *buffer; + int ret = TRUE; + int found; ++ unsigned int flags; + + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) + return FALSE; +@@ -6315,7 +6317,14 @@ cmdAttachDevice(vshControl *ctl, const v + return FALSE; + } + +- ret = virDomainAttachDevice(dom, buffer); ++ if (vshCommandOptBool(cmd, "persistent")) { ++ flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; ++ if (virDomainIsActive(dom) == 1) ++ flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; ++ ret = virDomainAttachDeviceFlags(dom, buffer, flags); ++ } else { ++ ret = virDomainAttachDevice(dom, buffer); ++ } + VIR_FREE(buffer); + + if (ret < 0) { +@@ -6343,6 +6352,7 @@ static const vshCmdInfo info_detach_devi + static const vshCmdOptDef opts_detach_device[] = { + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")}, + {"file", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("XML file")}, ++ {"persistent", VSH_OT_BOOL, 0, gettext_noop("persist device detachment")}, + {NULL, 0, 0, NULL} + }; + +@@ -6354,6 +6364,7 @@ cmdDetachDevice(vshControl *ctl, const v + char *buffer; + int ret = TRUE; + int found; ++ unsigned int flags; + + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) + return FALSE; +@@ -6373,7 +6384,14 @@ cmdDetachDevice(vshControl *ctl, const v + return FALSE; + } + +- ret = virDomainDetachDevice(dom, buffer); ++ if (vshCommandOptBool(cmd, "persistent")) { ++ flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; ++ if (virDomainIsActive(dom) == 1) ++ flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; ++ ret = virDomainDetachDeviceFlags(dom, buffer, flags); ++ } else { ++ ret = virDomainDetachDevice(dom, buffer); ++ } + VIR_FREE(buffer); + + if (ret < 0) { +@@ -6405,6 +6423,7 @@ static const vshCmdOptDef opts_attach_in + {"target", VSH_OT_DATA, 0, gettext_noop("target network name")}, + {"mac", VSH_OT_DATA, 0, gettext_noop("MAC address")}, + {"script", VSH_OT_DATA, 0, gettext_noop("script used to bridge network interface")}, ++ {"persistent", VSH_OT_BOOL, 0, gettext_noop("persist interface attachment")}, + {NULL, 0, 0, NULL} + }; + +@@ -6415,6 +6434,7 @@ cmdAttachInterface(vshControl *ctl, cons + char *mac, *target, *script, *type, *source; + int typ, ret = FALSE; + char *buf = NULL, *tmp = NULL; ++ unsigned int flags; + + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) + goto cleanup; +@@ -6489,13 +6509,22 @@ cmdAttachInterface(vshControl *ctl, cons + if (!buf) goto cleanup; + strcat(buf, " \n"); + +- if (virDomainAttachDevice(dom, buf)) { +- goto cleanup; ++ if (vshCommandOptBool(cmd, "persistent")) { ++ flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; ++ if (virDomainIsActive(dom) == 1) ++ flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; ++ ret = virDomainAttachDeviceFlags(dom, buf, flags); + } else { +- vshPrint(ctl, "%s", _("Interface attached successfully\n")); ++ ret = virDomainAttachDevice(dom, buf); + } + +- ret = TRUE; ++ if (ret != 0) { ++ vshError(ctl, _("Failed to attach interface")); ++ ret = FALSE; ++ } else { ++ vshPrint(ctl, "%s", _("Interface attached successfully\n")); ++ ret = TRUE; ++ } + + cleanup: + if (dom) +@@ -6518,6 +6547,7 @@ static const vshCmdOptDef opts_detach_in + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")}, + {"type", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("network interface type")}, + {"mac", VSH_OT_STRING, 0, gettext_noop("MAC address")}, ++ {"persistent", VSH_OT_BOOL, 0, gettext_noop("persist interface detachment")}, + {NULL, 0, 0, NULL} + }; + +@@ -6534,6 +6564,7 @@ cmdDetachInterface(vshControl *ctl, cons + char *doc, *mac =NULL, *type; + char buf[64]; + int i = 0, diff_mac, ret = FALSE; ++ unsigned int flags; + + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) + goto cleanup; +@@ -6605,10 +6636,21 @@ cmdDetachInterface(vshControl *ctl, cons + goto cleanup; + } + +- ret = virDomainDetachDevice(dom, (char *)xmlBufferContent(xml_buf)); +- if (ret != 0) ++ if (vshCommandOptBool(cmd, "persistent")) { ++ flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; ++ if (virDomainIsActive(dom) == 1) ++ flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; ++ ret = virDomainDetachDeviceFlags(dom, ++ (char *)xmlBufferContent(xml_buf), ++ flags); ++ } else { ++ ret = virDomainDetachDevice(dom, (char *)xmlBufferContent(xml_buf)); ++ } ++ ++ if (ret != 0) { ++ vshError(ctl, _("Failed to detach interface")); + ret = FALSE; +- else { ++ } else { + vshPrint(ctl, "%s", _("Interface detached successfully\n")); + ret = TRUE; + } +@@ -6642,6 +6684,7 @@ static const vshCmdOptDef opts_attach_di + {"subdriver", VSH_OT_STRING, 0, gettext_noop("subdriver of disk device")}, + {"type", VSH_OT_STRING, 0, gettext_noop("target device type")}, + {"mode", VSH_OT_STRING, 0, gettext_noop("mode of device reading and writing")}, ++ {"persistent", VSH_OT_BOOL, 0, gettext_noop("persist disk attachment")}, + {NULL, 0, 0, NULL} + }; + +@@ -6652,6 +6695,7 @@ cmdAttachDisk(vshControl *ctl, const vsh + char *source, *target, *driver, *subdriver, *type, *mode; + int isFile = 0, ret = FALSE; + char *buf = NULL, *tmp = NULL; ++ unsigned int flags; + + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) + goto cleanup; +@@ -6767,12 +6811,22 @@ cmdAttachDisk(vshControl *ctl, const vsh + if (!buf) goto cleanup; + strcat(buf, " \n"); + +- if (virDomainAttachDevice(dom, buf)) +- goto cleanup; +- else +- vshPrint(ctl, "%s", _("Disk attached successfully\n")); ++ if (vshCommandOptBool(cmd, "persistent")) { ++ flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; ++ if (virDomainIsActive(dom) == 1) ++ flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; ++ ret = virDomainAttachDeviceFlags(dom, buf, flags); ++ } else { ++ ret = virDomainAttachDevice(dom, buf); ++ } + +- ret = TRUE; ++ if (ret != 0) { ++ vshError(ctl, _("Failed to attach disk")); ++ ret = FALSE; ++ } else { ++ vshPrint(ctl, "%s", _("Disk attached successfully\n")); ++ ret = TRUE; ++ } + + cleanup: + if (dom) +@@ -6794,6 +6848,7 @@ static const vshCmdInfo info_detach_disk + static const vshCmdOptDef opts_detach_disk[] = { + {"domain", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("domain name, id or uuid")}, + {"target", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("target of disk device")}, ++ {"persistent", VSH_OT_BOOL, 0, gettext_noop("persist disk detachment")}, + {NULL, 0, 0, NULL} + }; + +@@ -6809,6 +6864,7 @@ cmdDetachDisk(vshControl *ctl, const vsh + virDomainPtr dom = NULL; + char *doc, *target; + int i = 0, diff_tgt, ret = FALSE; ++ unsigned int flags; + + if (!vshConnectionUsability(ctl, ctl->conn, TRUE)) + goto cleanup; +@@ -6874,10 +6930,21 @@ cmdDetachDisk(vshControl *ctl, const vsh + goto cleanup; + } + +- ret = virDomainDetachDevice(dom, (char *)xmlBufferContent(xml_buf)); +- if (ret != 0) ++ if (vshCommandOptBool(cmd, "persistent")) { ++ flags = VIR_DOMAIN_DEVICE_MODIFY_CONFIG; ++ if (virDomainIsActive(dom) == 1) ++ flags |= VIR_DOMAIN_DEVICE_MODIFY_LIVE; ++ ret = virDomainDetachDeviceFlags(dom, ++ (char *)xmlBufferContent(xml_buf), ++ flags); ++ } else { ++ ret = virDomainDetachDevice(dom, (char *)xmlBufferContent(xml_buf)); ++ } ++ ++ if (ret != 0) { ++ vshError(ctl, _("Failed to detach disk")); + ret = FALSE; +- else { ++ } else { + vshPrint(ctl, "%s", _("Disk detached successfully\n")); + ret = TRUE; + } diff --git a/libvirt-0.7.5.tar.bz2 b/libvirt-0.7.5.tar.bz2 deleted file mode 100644 index fbb1fb3..0000000 --- a/libvirt-0.7.5.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0763b11fc054a82d47cce8566173e589e08f34cd7adab46c9c3de80b6eacc4c7 -size 5997827 diff --git a/libvirt-0.7.6.tar.bz2 b/libvirt-0.7.6.tar.bz2 new file mode 100644 index 0000000..258ee40 --- /dev/null +++ b/libvirt-0.7.6.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0977f5e00922b2b3c5eca9c7f7e01ff9aee117f24853c53286fea7a010c86495 +size 6280159 diff --git a/libvirt.changes b/libvirt.changes index 8303ac2..4e6678b 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,33 @@ +------------------------------------------------------------------- +Thu Feb 4 12:36:48 MST 2010 - jfehlig@novell.com + +- Updated to version 0.7.6 + - Implement support for multi IQN + - Implement CPU topology support for QEMU driver + - Use QEmu new device adressing when possible + - Implement SCSI controller hotplug/unplug for QEMU + - lots of improvements and bug fixes + +------------------------------------------------------------------- +Wed Jan 27 17:48:18 MST 2010 - jfehlig@novell.com + +- Support new XEN_SYSCTL_INTERFACE_VERSION 7 in libvirt + bnc#574124 + xen-sysctl-v7.patch +- Add upstream patches as prelude to fixing various device + attach/detach issues + devflag-0[1-9].patch +- Fix attaching/detaching disk device from inactive Xen guest + bnc#500586 and bnc#573748 + +------------------------------------------------------------------- +Tue Jan 12 12:36:15 MST 2010 - jfehlig@novell.com + +- Fix migration with Xen4.0 + bnc#569598 + Add xen-migration-params.patch + Remove migrate-params.patch + ------------------------------------------------------------------- Wed Jan 6 18:02:00 MST 2010 - jfehlig@novell.com diff --git a/libvirt.spec b/libvirt.spec index eca333d..a01cbd6 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -1,5 +1,5 @@ # -# spec file for package libvirt (Version 0.7.5) +# spec file for package libvirt (Version 0.7.6) # # Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # @@ -111,7 +111,7 @@ Url: http://libvirt.org/ License: LGPLv2.1+ Group: Development/Libraries/C and C++ AutoReqProv: yes -Version: 0.7.5 +Version: 0.7.6 Release: 1 Summary: A C toolkit to interract with the virtualization capabilities of Linux # The client side, i.e. shared libs and virsh are in a subpackage @@ -123,7 +123,6 @@ Requires: parted Requires: virt-utils Recommends: logrotate Requires: dnsmasq -Requires: PolicyKit >= 0.6 Requires: open-iscsi Requires: nfs-client %if %{with_hal} @@ -137,14 +136,20 @@ Requires: PolicyKit >= 0.6 Source0: %{name}-%{version}.tar.bz2 Source1: libvirtd.init # Upstream patches -Patch0: detach-disk.patch -Patch1: xen-shr-pages.patch -Patch2: node-dev-free.patch +Patch0: devflag-01.patch +Patch1: devflag-02.patch +Patch2: devflag-03.patch +Patch3: devflag-04.patch +Patch4: devflag-05.patch +Patch5: devflag-06.patch +Patch6: devflag-07.patch +Patch7: devflag-08.patch +Patch8: devflag-09.patch +Patch9: xen-name-for-devid.patch # Need to go upstream Patch100: socat.patch Patch101: clone.patch -Patch102: migrate-params.patch -Patch103: xen-pv-cdrom.patch +Patch102: xen-pv-cdrom.patch # Our patches Patch200: libvirtd-defaults.patch Patch201: suse-network.patch @@ -255,10 +260,16 @@ Authors: %patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 %patch100 -p1 %patch101 %patch102 -p1 -%patch103 -p1 %patch200 -p1 %patch201 -p1 %patch202 -p1 diff --git a/migrate-params.patch b/migrate-params.patch deleted file mode 100644 index 70585c9..0000000 --- a/migrate-params.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: libvirt-0.7.5/src/xen/xend_internal.c -=================================================================== ---- libvirt-0.7.5.orig/src/xen/xend_internal.c -+++ libvirt-0.7.5/src/xen/xend_internal.c -@@ -4559,6 +4559,8 @@ xenDaemonDomainMigratePerform (virDomain - "node", "-1", - "ssl", "0", - "resource", "0", /* required, xend ignores it */ -+ "node", "-1", /* numa node, xen c/s 17753 */ -+ "ssl", "0", /* ssl migration, xen c/s 17709 */ - NULL); - VIR_FREE (hostname); - diff --git a/node-dev-free.patch b/node-dev-free.patch deleted file mode 100644 index e2700ee..0000000 --- a/node-dev-free.patch +++ /dev/null @@ -1,29 +0,0 @@ -This invalid free results in heap corruption. Some symptoms I saw -because of this were libvirtd crashing and virt-manager hanging -while trying to enumerate devices. ---- - src/node_device/node_device_driver.c | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -Index: libvirt-0.7.5/src/node_device/node_device_driver.c -=================================================================== ---- libvirt-0.7.5.orig/src/node_device/node_device_driver.c -+++ libvirt-0.7.5/src/node_device/node_device_driver.c -@@ -78,7 +78,7 @@ static int update_driver_name(virConnect - virNodeDeviceObjPtr dev) - { - char *driver_link = NULL; -- char *devpath; -+ char *devpath = NULL; - char *p; - int ret = -1; - -@@ -114,7 +114,7 @@ static int update_driver_name(virConnect - - cleanup: - VIR_FREE(driver_link); -- free(devpath); -+ VIR_FREE(devpath); - return ret; - } - #else diff --git a/snapshots.patch b/snapshots.patch index b6ba9da..4cf4041 100644 --- a/snapshots.patch +++ b/snapshots.patch @@ -1,7 +1,7 @@ -Index: libvirt-0.7.5/include/libvirt/libvirt.h.in +Index: libvirt-0.7.6/include/libvirt/libvirt.h.in =================================================================== ---- libvirt-0.7.5.orig/include/libvirt/libvirt.h.in -+++ libvirt-0.7.5/include/libvirt/libvirt.h.in +--- libvirt-0.7.6.orig/include/libvirt/libvirt.h.in ++++ libvirt-0.7.6/include/libvirt/libvirt.h.in @@ -621,6 +621,21 @@ int virDomainRestore const char *from); @@ -24,11 +24,11 @@ Index: libvirt-0.7.5/include/libvirt/libvirt.h.in * Domain core dump */ int virDomainCoreDump (virDomainPtr domain, -Index: libvirt-0.7.5/src/libvirt.c +Index: libvirt-0.7.6/src/libvirt.c =================================================================== ---- libvirt-0.7.5.orig/src/libvirt.c -+++ libvirt-0.7.5/src/libvirt.c -@@ -2339,6 +2339,166 @@ error: +--- libvirt-0.7.6.orig/src/libvirt.c ++++ libvirt-0.7.6/src/libvirt.c +@@ -2379,6 +2379,166 @@ error: } /** @@ -195,10 +195,10 @@ Index: libvirt-0.7.5/src/libvirt.c * virDomainCoreDump: * @domain: a domain object * @to: path for the core file -Index: libvirt-0.7.5/src/driver.h +Index: libvirt-0.7.6/src/driver.h =================================================================== ---- libvirt-0.7.5.orig/src/driver.h -+++ libvirt-0.7.5/src/driver.h +--- libvirt-0.7.6.orig/src/driver.h ++++ libvirt-0.7.6/src/driver.h @@ -136,6 +136,21 @@ typedef int (*virDrvDomainRestore) (virConnectPtr conn, const char *from); @@ -221,7 +221,7 @@ Index: libvirt-0.7.5/src/driver.h (*virDrvDomainCoreDump) (virDomainPtr domain, const char *to, int flags); -@@ -448,6 +463,11 @@ struct _virDriver { +@@ -458,6 +473,11 @@ struct _virDriver { virDrvDomainIsActive domainIsActive; virDrvDomainIsPersistent domainIsPersistent; virDrvCPUCompare cpuCompare; @@ -233,10 +233,10 @@ Index: libvirt-0.7.5/src/driver.h }; typedef int -Index: libvirt-0.7.5/src/xen/xen_driver.c +Index: libvirt-0.7.6/src/xen/xen_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/xen/xen_driver.c -+++ libvirt-0.7.5/src/xen/xen_driver.c +--- libvirt-0.7.6.orig/src/xen/xen_driver.c ++++ libvirt-0.7.6/src/xen/xen_driver.c @@ -1052,6 +1052,81 @@ xenUnifiedDomainRestore (virConnectPtr c } @@ -319,7 +319,7 @@ Index: libvirt-0.7.5/src/xen/xen_driver.c xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, int flags) { GET_PRIVATE(dom->conn); -@@ -1862,6 +1937,11 @@ static virDriver xenUnifiedDriver = { +@@ -1904,6 +1979,11 @@ static virDriver xenUnifiedDriver = { xenUnifiedDomainIsActive, xenUnifiedDomainisPersistent, NULL, /* cpuCompare */ @@ -331,10 +331,10 @@ Index: libvirt-0.7.5/src/xen/xen_driver.c }; /** -Index: libvirt-0.7.5/src/xen/xen_driver.h +Index: libvirt-0.7.6/src/xen/xen_driver.h =================================================================== ---- libvirt-0.7.5.orig/src/xen/xen_driver.h -+++ libvirt-0.7.5/src/xen/xen_driver.h +--- libvirt-0.7.6.orig/src/xen/xen_driver.h ++++ libvirt-0.7.6/src/xen/xen_driver.h @@ -100,6 +100,11 @@ struct xenUnifiedDriver { virDrvDomainGetSchedulerType domainGetSchedulerType; virDrvDomainGetSchedulerParameters domainGetSchedulerParameters; @@ -347,10 +347,10 @@ Index: libvirt-0.7.5/src/xen/xen_driver.h }; typedef struct xenXMConfCache *xenXMConfCachePtr; -Index: libvirt-0.7.5/src/xen/xend_internal.c +Index: libvirt-0.7.6/src/xen/xend_internal.c =================================================================== ---- libvirt-0.7.5.orig/src/xen/xend_internal.c -+++ libvirt-0.7.5/src/xen/xend_internal.c +--- libvirt-0.7.6.orig/src/xen/xend_internal.c ++++ libvirt-0.7.6/src/xen/xend_internal.c @@ -53,6 +53,12 @@ #ifndef PROXY @@ -364,7 +364,7 @@ Index: libvirt-0.7.5/src/xen/xend_internal.c /* * The number of Xen scheduler parameters */ -@@ -3282,6 +3288,87 @@ xenDaemonDomainRestore(virConnectPtr con +@@ -3284,6 +3290,87 @@ xenDaemonDomainRestore(virConnectPtr con } return xend_op(conn, "", "op", "restore", "file", filename, NULL); } @@ -452,7 +452,7 @@ Index: libvirt-0.7.5/src/xen/xend_internal.c #endif /* !PROXY */ /** -@@ -5165,6 +5252,11 @@ struct xenUnifiedDriver xenDaemonDriver +@@ -5235,6 +5322,11 @@ struct xenUnifiedDriver xenDaemonDriver xenDaemonGetSchedulerType, /* domainGetSchedulerType */ xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */ xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */ @@ -464,10 +464,10 @@ Index: libvirt-0.7.5/src/xen/xend_internal.c }; /************************************************************************ -Index: libvirt-0.7.5/src/xen/proxy_internal.c +Index: libvirt-0.7.6/src/xen/proxy_internal.c =================================================================== ---- libvirt-0.7.5.orig/src/xen/proxy_internal.c -+++ libvirt-0.7.5/src/xen/proxy_internal.c +--- libvirt-0.7.6.orig/src/xen/proxy_internal.c ++++ libvirt-0.7.6/src/xen/proxy_internal.c @@ -83,6 +83,11 @@ struct xenUnifiedDriver xenProxyDriver = NULL, /* domainGetSchedulerType */ NULL, /* domainGetSchedulerParameters */ @@ -480,10 +480,10 @@ Index: libvirt-0.7.5/src/xen/proxy_internal.c }; -Index: libvirt-0.7.5/src/xen/xen_hypervisor.c +Index: libvirt-0.7.6/src/xen/xen_hypervisor.c =================================================================== ---- libvirt-0.7.5.orig/src/xen/xen_hypervisor.c -+++ libvirt-0.7.5/src/xen/xen_hypervisor.c +--- libvirt-0.7.6.orig/src/xen/xen_hypervisor.c ++++ libvirt-0.7.6/src/xen/xen_hypervisor.c @@ -800,6 +800,11 @@ struct xenUnifiedDriver xenHypervisorDri xenHypervisorGetSchedulerType, /* domainGetSchedulerType */ xenHypervisorGetSchedulerParameters, /* domainGetSchedulerParameters */ @@ -496,11 +496,11 @@ Index: libvirt-0.7.5/src/xen/xen_hypervisor.c }; #endif /* !PROXY */ -Index: libvirt-0.7.5/src/xen/xm_internal.c +Index: libvirt-0.7.6/src/xen/xm_internal.c =================================================================== ---- libvirt-0.7.5.orig/src/xen/xm_internal.c -+++ libvirt-0.7.5/src/xen/xm_internal.c -@@ -116,6 +116,11 @@ struct xenUnifiedDriver xenXMDriver = { +--- libvirt-0.7.6.orig/src/xen/xm_internal.c ++++ libvirt-0.7.6/src/xen/xm_internal.c +@@ -118,6 +118,11 @@ struct xenUnifiedDriver xenXMDriver = { NULL, /* domainGetSchedulerType */ NULL, /* domainGetSchedulerParameters */ NULL, /* domainSetSchedulerParameters */ @@ -512,10 +512,10 @@ Index: libvirt-0.7.5/src/xen/xm_internal.c }; #define xenXMError(conn, code, fmt...) \ -Index: libvirt-0.7.5/src/xen/xs_internal.c +Index: libvirt-0.7.6/src/xen/xs_internal.c =================================================================== ---- libvirt-0.7.5.orig/src/xen/xs_internal.c -+++ libvirt-0.7.5/src/xen/xs_internal.c +--- libvirt-0.7.6.orig/src/xen/xs_internal.c ++++ libvirt-0.7.6/src/xen/xs_internal.c @@ -83,6 +83,11 @@ struct xenUnifiedDriver xenStoreDriver = NULL, /* domainGetSchedulerType */ NULL, /* domainGetSchedulerParameters */ @@ -528,11 +528,11 @@ Index: libvirt-0.7.5/src/xen/xs_internal.c }; #endif /* ! PROXY */ -Index: libvirt-0.7.5/tools/virsh.c +Index: libvirt-0.7.6/tools/virsh.c =================================================================== ---- libvirt-0.7.5.orig/tools/virsh.c -+++ libvirt-0.7.5/tools/virsh.c -@@ -1233,6 +1233,188 @@ cmdSave(vshControl *ctl, const vshCmd *c +--- libvirt-0.7.6.orig/tools/virsh.c ++++ libvirt-0.7.6/tools/virsh.c +@@ -1237,6 +1237,188 @@ cmdSave(vshControl *ctl, const vshCmd *c } /* @@ -721,7 +721,7 @@ Index: libvirt-0.7.5/tools/virsh.c * "schedinfo" command */ static const vshCmdInfo info_schedinfo[] = { -@@ -7431,6 +7613,12 @@ static const vshCmdDef commands[] = { +@@ -7502,6 +7684,12 @@ static const vshCmdDef commands[] = { {"undefine", cmdUndefine, opts_undefine, info_undefine}, {"uri", cmdURI, NULL, info_uri}, @@ -734,11 +734,11 @@ Index: libvirt-0.7.5/tools/virsh.c {"vol-create", cmdVolCreate, opts_vol_create, info_vol_create}, {"vol-create-from", cmdVolCreateFrom, opts_vol_create_from, info_vol_create_from}, {"vol-create-as", cmdVolCreateAs, opts_vol_create_as, info_vol_create_as}, -Index: libvirt-0.7.5/src/lxc/lxc_driver.c +Index: libvirt-0.7.6/src/lxc/lxc_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/lxc/lxc_driver.c -+++ libvirt-0.7.5/src/lxc/lxc_driver.c -@@ -2456,6 +2456,11 @@ static virDriver lxcDriver = { +--- libvirt-0.7.6.orig/src/lxc/lxc_driver.c ++++ libvirt-0.7.6/src/lxc/lxc_driver.c +@@ -2458,6 +2458,11 @@ static virDriver lxcDriver = { lxcDomainIsActive, lxcDomainIsPersistent, NULL, /* cpuCompare */ @@ -750,11 +750,11 @@ Index: libvirt-0.7.5/src/lxc/lxc_driver.c }; static virStateDriver lxcStateDriver = { -Index: libvirt-0.7.5/src/openvz/openvz_driver.c +Index: libvirt-0.7.6/src/openvz/openvz_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/openvz/openvz_driver.c -+++ libvirt-0.7.5/src/openvz/openvz_driver.c -@@ -1535,6 +1535,11 @@ static virDriver openvzDriver = { +--- libvirt-0.7.6.orig/src/openvz/openvz_driver.c ++++ libvirt-0.7.6/src/openvz/openvz_driver.c +@@ -1537,6 +1537,11 @@ static virDriver openvzDriver = { openvzDomainIsActive, openvzDomainIsPersistent, NULL, /* cpuCompare */ @@ -766,11 +766,11 @@ Index: libvirt-0.7.5/src/openvz/openvz_driver.c }; int openvzRegister(void) { -Index: libvirt-0.7.5/src/qemu/qemu_driver.c +Index: libvirt-0.7.6/src/qemu/qemu_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/qemu/qemu_driver.c -+++ libvirt-0.7.5/src/qemu/qemu_driver.c -@@ -7990,6 +7990,11 @@ static virDriver qemuDriver = { +--- libvirt-0.7.6.orig/src/qemu/qemu_driver.c ++++ libvirt-0.7.6/src/qemu/qemu_driver.c +@@ -8632,6 +8632,11 @@ static virDriver qemuDriver = { qemuDomainIsActive, qemuDomainIsPersistent, qemuCPUCompare, /* cpuCompare */ @@ -782,11 +782,11 @@ Index: libvirt-0.7.5/src/qemu/qemu_driver.c }; -Index: libvirt-0.7.5/src/esx/esx_driver.c +Index: libvirt-0.7.6/src/esx/esx_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/esx/esx_driver.c -+++ libvirt-0.7.5/src/esx/esx_driver.c -@@ -3455,6 +3455,11 @@ static virDriver esxDriver = { +--- libvirt-0.7.6.orig/src/esx/esx_driver.c ++++ libvirt-0.7.6/src/esx/esx_driver.c +@@ -3403,6 +3403,11 @@ static virDriver esxDriver = { esxDomainIsActive, /* domainIsActive */ esxDomainIsPersistent, /* domainIsPersistent */ NULL, /* cpuCompare */ @@ -798,11 +798,11 @@ Index: libvirt-0.7.5/src/esx/esx_driver.c }; -Index: libvirt-0.7.5/src/test/test_driver.c +Index: libvirt-0.7.6/src/test/test_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/test/test_driver.c -+++ libvirt-0.7.5/src/test/test_driver.c -@@ -5238,6 +5238,11 @@ static virDriver testDriver = { +--- libvirt-0.7.6.orig/src/test/test_driver.c ++++ libvirt-0.7.6/src/test/test_driver.c +@@ -5240,6 +5240,11 @@ static virDriver testDriver = { testDomainIsActive, /* domainIsActive */ testDomainIsPersistent, /* domainIsPersistent */ NULL, /* cpuCompare */ @@ -814,11 +814,11 @@ Index: libvirt-0.7.5/src/test/test_driver.c }; static virNetworkDriver testNetworkDriver = { -Index: libvirt-0.7.5/src/uml/uml_driver.c +Index: libvirt-0.7.6/src/uml/uml_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/uml/uml_driver.c -+++ libvirt-0.7.5/src/uml/uml_driver.c -@@ -1924,6 +1924,11 @@ static virDriver umlDriver = { +--- libvirt-0.7.6.orig/src/uml/uml_driver.c ++++ libvirt-0.7.6/src/uml/uml_driver.c +@@ -1926,6 +1926,11 @@ static virDriver umlDriver = { umlDomainIsActive, umlDomainIsPersistent, NULL, /* cpuCompare */ @@ -830,11 +830,11 @@ Index: libvirt-0.7.5/src/uml/uml_driver.c }; -Index: libvirt-0.7.5/src/vbox/vbox_tmpl.c +Index: libvirt-0.7.6/src/vbox/vbox_tmpl.c =================================================================== ---- libvirt-0.7.5.orig/src/vbox/vbox_tmpl.c -+++ libvirt-0.7.5/src/vbox/vbox_tmpl.c -@@ -7051,6 +7051,11 @@ virDriver NAME(Driver) = { +--- libvirt-0.7.6.orig/src/vbox/vbox_tmpl.c ++++ libvirt-0.7.6/src/vbox/vbox_tmpl.c +@@ -7059,6 +7059,11 @@ virDriver NAME(Driver) = { vboxDomainIsActive, vboxDomainIsPersistent, NULL, /* cpuCompare */ @@ -846,11 +846,11 @@ Index: libvirt-0.7.5/src/vbox/vbox_tmpl.c }; virNetworkDriver NAME(NetworkDriver) = { -Index: libvirt-0.7.5/src/opennebula/one_driver.c +Index: libvirt-0.7.6/src/opennebula/one_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/opennebula/one_driver.c -+++ libvirt-0.7.5/src/opennebula/one_driver.c -@@ -783,6 +783,11 @@ static virDriver oneDriver = { +--- libvirt-0.7.6.orig/src/opennebula/one_driver.c ++++ libvirt-0.7.6/src/opennebula/one_driver.c +@@ -785,6 +785,11 @@ static virDriver oneDriver = { NULL, /* domainIsActive */ NULL, /* domainIsPersistent */ NULL, /* cpuCompare */ @@ -862,11 +862,11 @@ Index: libvirt-0.7.5/src/opennebula/one_driver.c }; static virStateDriver oneStateDriver = { -Index: libvirt-0.7.5/src/phyp/phyp_driver.c +Index: libvirt-0.7.6/src/phyp/phyp_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/phyp/phyp_driver.c -+++ libvirt-0.7.5/src/phyp/phyp_driver.c -@@ -1651,6 +1651,11 @@ virDriver phypDriver = { +--- libvirt-0.7.6.orig/src/phyp/phyp_driver.c ++++ libvirt-0.7.6/src/phyp/phyp_driver.c +@@ -1653,6 +1653,11 @@ virDriver phypDriver = { NULL, /* domainIsActive */ NULL, /* domainIsPersistent */ NULL, /* cpuCompare */ @@ -878,11 +878,11 @@ Index: libvirt-0.7.5/src/phyp/phyp_driver.c }; int -Index: libvirt-0.7.5/src/remote/remote_driver.c +Index: libvirt-0.7.6/src/remote/remote_driver.c =================================================================== ---- libvirt-0.7.5.orig/src/remote/remote_driver.c -+++ libvirt-0.7.5/src/remote/remote_driver.c -@@ -8940,6 +8940,11 @@ static virDriver remote_driver = { +--- libvirt-0.7.6.orig/src/remote/remote_driver.c ++++ libvirt-0.7.6/src/remote/remote_driver.c +@@ -8994,6 +8994,11 @@ static virDriver remote_driver = { remoteDomainIsActive, /* domainIsActive */ remoteDomainIsPersistent, /* domainIsPersistent */ remoteCPUCompare, /* cpuCompare */ @@ -894,10 +894,10 @@ Index: libvirt-0.7.5/src/remote/remote_driver.c }; static virNetworkDriver network_driver = { -Index: libvirt-0.7.5/docs/libvirt-api.xml +Index: libvirt-0.7.6/docs/libvirt-api.xml =================================================================== ---- libvirt-0.7.5.orig/docs/libvirt-api.xml -+++ libvirt-0.7.5/docs/libvirt-api.xml +--- libvirt-0.7.6.orig/docs/libvirt-api.xml ++++ libvirt-0.7.6/docs/libvirt-api.xml @@ -293,6 +293,11 @@ @@ -947,10 +947,10 @@ Index: libvirt-0.7.5/docs/libvirt-api.xml -Index: libvirt-0.7.5/src/libvirt_public.syms +Index: libvirt-0.7.6/src/libvirt_public.syms =================================================================== ---- libvirt-0.7.5.orig/src/libvirt_public.syms -+++ libvirt-0.7.5/src/libvirt_public.syms +--- libvirt-0.7.6.orig/src/libvirt_public.syms ++++ libvirt-0.7.6/src/libvirt_public.syms @@ -215,6 +215,11 @@ LIBVIRT_0.4.2 { LIBVIRT_0.4.5 { global: @@ -963,11 +963,11 @@ Index: libvirt-0.7.5/src/libvirt_public.syms } LIBVIRT_0.4.2; LIBVIRT_0.5.0 { -Index: libvirt-0.7.5/python/generator.py +Index: libvirt-0.7.6/python/generator.py =================================================================== ---- libvirt-0.7.5.orig/python/generator.py -+++ libvirt-0.7.5/python/generator.py -@@ -288,6 +288,7 @@ skip_impl = ( +--- libvirt-0.7.6.orig/python/generator.py ++++ libvirt-0.7.6/python/generator.py +@@ -289,6 +289,7 @@ skip_impl = ( 'virDomainSetSchedulerParameters', 'virDomainGetVcpus', 'virDomainPinVcpu', @@ -975,11 +975,11 @@ Index: libvirt-0.7.5/python/generator.py 'virSecretGetValue', 'virSecretSetValue', 'virSecretGetUUID', -Index: libvirt-0.7.5/python/libvirt-override.c +Index: libvirt-0.7.6/python/libvirt-override.c =================================================================== ---- libvirt-0.7.5.orig/python/libvirt-override.c -+++ libvirt-0.7.5/python/libvirt-override.c -@@ -1516,6 +1516,34 @@ libvirt_virStoragePoolGetInfo(PyObject * +--- libvirt-0.7.6.orig/python/libvirt-override.c ++++ libvirt-0.7.6/python/libvirt-override.c +@@ -1542,6 +1542,34 @@ libvirt_virStoragePoolGetInfo(PyObject * return(py_retval); } @@ -1014,7 +1014,7 @@ Index: libvirt-0.7.5/python/libvirt-override.c static PyObject * libvirt_virStorageVolGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { -@@ -2690,6 +2718,7 @@ static PyMethodDef libvirtMethods[] = { +@@ -2717,6 +2745,7 @@ static PyMethodDef libvirtMethods[] = { {(char *) "virStoragePoolGetAutostart", libvirt_virStoragePoolGetAutostart, METH_VARARGS, NULL}, {(char *) "virStoragePoolListVolumes", libvirt_virStoragePoolListVolumes, METH_VARARGS, NULL}, {(char *) "virStoragePoolGetInfo", libvirt_virStoragePoolGetInfo, METH_VARARGS, NULL}, @@ -1022,11 +1022,11 @@ Index: libvirt-0.7.5/python/libvirt-override.c {(char *) "virStorageVolGetInfo", libvirt_virStorageVolGetInfo, METH_VARARGS, NULL}, {(char *) "virStoragePoolGetUUID", libvirt_virStoragePoolGetUUID, METH_VARARGS, NULL}, {(char *) "virStoragePoolGetUUIDString", libvirt_virStoragePoolGetUUIDString, METH_VARARGS, NULL}, -Index: libvirt-0.7.5/python/libvirt-override-api.xml +Index: libvirt-0.7.6/python/libvirt-override-api.xml =================================================================== ---- libvirt-0.7.5.orig/python/libvirt-override-api.xml -+++ libvirt-0.7.5/python/libvirt-override-api.xml -@@ -145,6 +145,11 @@ +--- libvirt-0.7.6.orig/python/libvirt-override-api.xml ++++ libvirt-0.7.6/python/libvirt-override-api.xml +@@ -150,6 +150,11 @@ @@ -1038,10 +1038,10 @@ Index: libvirt-0.7.5/python/libvirt-override-api.xml list the storage pools, stores the pointers to the names in @names -Index: libvirt-0.7.5/src/xen/xen_inotify.c +Index: libvirt-0.7.6/src/xen/xen_inotify.c =================================================================== ---- libvirt-0.7.5.orig/src/xen/xen_inotify.c -+++ libvirt-0.7.5/src/xen/xen_inotify.c +--- libvirt-0.7.6.orig/src/xen/xen_inotify.c ++++ libvirt-0.7.6/src/xen/xen_inotify.c @@ -86,6 +86,11 @@ struct xenUnifiedDriver xenInotifyDriver NULL, /* domainGetSchedulerType */ NULL, /* domainGetSchedulerParameters */ diff --git a/xen-name-for-devid.patch b/xen-name-for-devid.patch new file mode 100644 index 0000000..b766375 --- /dev/null +++ b/xen-name-for-devid.patch @@ -0,0 +1,100 @@ +commit 7906a668fa8d5c21cc729db8a13b08e3dd1d241f +Author: Jim Fehlig +Date: Wed Jan 27 16:11:41 2010 -0700 + + Do not search xenstore for disk device IDs + + Disk 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 the disk device. Instead, + search the disks contained in the domain definition and use the + disk's target name if found. + + This approach allows removing a disk when domain is inactive. We + obviously can't search xenstore when the domain is inactive. + +Index: libvirt-0.7.6/src/xen/xend_internal.c +=================================================================== +--- libvirt-0.7.6.orig/src/xen/xend_internal.c ++++ libvirt-0.7.6/src/xen/xend_internal.c +@@ -93,6 +93,7 @@ xenDaemonFormatSxprOnePCI(virConnectPtr + + static int + virDomainXMLDevID(virDomainPtr domain, ++ virDomainDefPtr domDef, + virDomainDeviceDefPtr dev, + char *class, + char *ref, +@@ -4215,7 +4216,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr + + sexpr = virBufferContentAndReset(&buf); + +- if (virDomainXMLDevID(domain, dev, class, ref, sizeof(ref))) { ++ if (virDomainXMLDevID(domain, def, dev, class, ref, sizeof(ref))) { + /* device doesn't exist, define it */ + ret = xend_op(domain->conn, domain->name, "op", "device_create", + "config", sexpr, NULL); +@@ -4310,7 +4311,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr + def, xml, VIR_DOMAIN_XML_INACTIVE))) + goto cleanup; + +- if (virDomainXMLDevID(domain, dev, class, ref, sizeof(ref))) ++ if (virDomainXMLDevID(domain, def, dev, class, ref, sizeof(ref))) + goto cleanup; + + if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) { +@@ -6052,6 +6053,7 @@ error: + */ + static int + virDomainXMLDevID(virDomainPtr domain, ++ virDomainDefPtr domDef, + virDomainDeviceDefPtr dev, + char *class, + char *ref, +@@ -6060,27 +6062,33 @@ virDomainXMLDevID(virDomainPtr domain, + xenUnifiedPrivatePtr priv = domain->conn->privateData; + char *xref; + char *tmp; ++ unsigned int i; ++ virDomainDiskDefPtr disk; + + 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"); + else + strcpy(class, "vbd"); + +- if (dev->data.disk->dst == NULL) +- return -1; +- xenUnifiedLock(priv); +- xref = xenStoreDomainGetDiskID(domain->conn, domain->id, +- 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; ++ /* For disks, the device name can be used directly. ++ * If disk device exists in domain definintion, ++ * copy it to ref and return success. ++ */ ++ for (i = 0; i < domDef->ndisks; i++) { ++ disk = domDef->disks[i]; ++ if (STREQ(dev->data.disk->dst, disk->dst)) { ++ tmp = virStrcpy(ref, disk->dst, ref_len); ++ if (tmp == NULL) ++ return -1; ++ else ++ return 0; ++ } ++ } ++ return -1; + } else if (dev->type == VIR_DOMAIN_DEVICE_NET) { + char mac[30]; + virDomainNetDefPtr def = dev->data.net; diff --git a/xen-pv-cdrom.patch b/xen-pv-cdrom.patch index b174db7..e00be6d 100644 --- a/xen-pv-cdrom.patch +++ b/xen-pv-cdrom.patch @@ -1,8 +1,8 @@ -Index: libvirt-0.7.5/src/xen/xend_internal.c +Index: libvirt-0.7.6/src/xen/xend_internal.c =================================================================== ---- libvirt-0.7.5.orig/src/xen/xend_internal.c -+++ libvirt-0.7.5/src/xen/xend_internal.c -@@ -5409,7 +5409,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co +--- libvirt-0.7.6.orig/src/xen/xend_internal.c ++++ libvirt-0.7.6/src/xen/xend_internal.c +@@ -5479,7 +5479,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co } else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { virBufferVSprintf(buf, "(dev '%s:cdrom')", def->dst); } else { diff --git a/xen-shr-pages.patch b/xen-shr-pages.patch deleted file mode 100644 index ed5afb9..0000000 --- a/xen-shr-pages.patch +++ /dev/null @@ -1,248 +0,0 @@ -Index: libvirt-0.7.5/src/xen/xen_hypervisor.c -=================================================================== ---- libvirt-0.7.5.orig/src/xen/xen_hypervisor.c -+++ libvirt-0.7.5/src/xen/xen_hypervisor.c -@@ -215,10 +215,26 @@ struct xen_v2d5_getdomaininfo { - }; - typedef struct xen_v2d5_getdomaininfo xen_v2d5_getdomaininfo; - -+struct xen_v2d6_getdomaininfo { -+ domid_t domain; /* the domain number */ -+ uint32_t flags; /* flags, see before */ -+ uint64_t tot_pages ALIGN_64; /* total number of pages used */ -+ uint64_t max_pages ALIGN_64; /* maximum number of pages allowed */ -+ uint64_t shr_pages ALIGN_64; /* number of shared pages */ -+ uint64_t shared_info_frame ALIGN_64; /* MFN of shared_info struct */ -+ uint64_t cpu_time ALIGN_64; /* CPU time used */ -+ uint32_t nr_online_vcpus; /* Number of VCPUs currently online. */ -+ uint32_t max_vcpu_id; /* Maximum VCPUID in use by this domain. */ -+ uint32_t ssidref; -+ xen_domain_handle_t handle; -+}; -+typedef struct xen_v2d6_getdomaininfo xen_v2d6_getdomaininfo; -+ - union xen_getdomaininfo { - struct xen_v0_getdomaininfo v0; - struct xen_v2_getdomaininfo v2; - struct xen_v2d5_getdomaininfo v2d5; -+ struct xen_v2d6_getdomaininfo v2d6; - }; - typedef union xen_getdomaininfo xen_getdomaininfo; - -@@ -226,6 +242,7 @@ union xen_getdomaininfolist { - struct xen_v0_getdomaininfo *v0; - struct xen_v2_getdomaininfo *v2; - struct xen_v2d5_getdomaininfo *v2d5; -+ struct xen_v2d6_getdomaininfo *v2d6; - }; - typedef union xen_getdomaininfolist xen_getdomaininfolist; - -@@ -263,114 +280,147 @@ typedef struct xen_v2s5_availheap xen_v - #define XEN_GETDOMAININFOLIST_ALLOC(domlist, size) \ - (hypervisor_version < 2 ? \ - (VIR_ALLOC_N(domlist.v0, (size)) == 0) : \ -- (dom_interface_version < 5 ? \ -- (VIR_ALLOC_N(domlist.v2, (size)) == 0) : \ -- (VIR_ALLOC_N(domlist.v2d5, (size)) == 0))) -+ (dom_interface_version >= 6 ? \ -+ (VIR_ALLOC_N(domlist.v2d6, (size)) == 0) : \ -+ (dom_interface_version == 5 ? \ -+ (VIR_ALLOC_N(domlist.v2d5, (size)) == 0) : \ -+ (VIR_ALLOC_N(domlist.v2, (size)) == 0)))) - - #define XEN_GETDOMAININFOLIST_FREE(domlist) \ - (hypervisor_version < 2 ? \ - VIR_FREE(domlist.v0) : \ -- (dom_interface_version < 5 ? \ -- VIR_FREE(domlist.v2) : \ -- VIR_FREE(domlist.v2d5))) -+ (dom_interface_version >= 6 ? \ -+ VIR_FREE(domlist.v2d6) : \ -+ (dom_interface_version == 5 ? \ -+ VIR_FREE(domlist.v2d5) : \ -+ VIR_FREE(domlist.v2)))) - - #define XEN_GETDOMAININFOLIST_CLEAR(domlist, size) \ - (hypervisor_version < 2 ? \ - memset(domlist.v0, 0, sizeof(*domlist.v0) * size) : \ -- (dom_interface_version < 5 ? \ -- memset(domlist.v2, 0, sizeof(*domlist.v2) * size) : \ -- memset(domlist.v2d5, 0, sizeof(*domlist.v2d5) * size))) -+ (dom_interface_version >= 6 ? \ -+ memset(domlist.v2d6, 0, sizeof(*domlist.v2d6) * size) : \ -+ (dom_interface_version == 5 ? \ -+ memset(domlist.v2d5, 0, sizeof(*domlist.v2d5) * size) : \ -+ memset(domlist.v2, 0, sizeof(*domlist.v2) * size)))) - - #define XEN_GETDOMAININFOLIST_DOMAIN(domlist, n) \ - (hypervisor_version < 2 ? \ - domlist.v0[n].domain : \ -- (dom_interface_version < 5 ? \ -- domlist.v2[n].domain : \ -- domlist.v2d5[n].domain)) -+ (dom_interface_version >= 6 ? \ -+ domlist.v2d6[n].domain : \ -+ (dom_interface_version == 5 ? \ -+ domlist.v2d5[n].domain : \ -+ domlist.v2[n].domain))) - - #define XEN_GETDOMAININFOLIST_UUID(domlist, n) \ - (hypervisor_version < 2 ? \ - domlist.v0[n].handle : \ -- (dom_interface_version < 5 ? \ -- domlist.v2[n].handle : \ -- domlist.v2d5[n].handle)) -+ (dom_interface_version >= 6 ? \ -+ domlist.v2d6[n].handle : \ -+ (dom_interface_version == 5 ? \ -+ domlist.v2d5[n].handle : \ -+ domlist.v2[n].handle))) - - #define XEN_GETDOMAININFOLIST_DATA(domlist) \ - (hypervisor_version < 2 ? \ - (void*)(domlist->v0) : \ -- (dom_interface_version < 5 ? \ -- (void*)(domlist->v2) : \ -- (void*)(domlist->v2d5))) -+ (dom_interface_version >= 6 ? \ -+ (void*)(domlist->v2d6) : \ -+ (dom_interface_version == 5 ? \ -+ (void*)(domlist->v2d5) : \ -+ (void*)(domlist->v2)))) - - #define XEN_GETDOMAININFO_SIZE \ - (hypervisor_version < 2 ? \ - sizeof(xen_v0_getdomaininfo) : \ -- (dom_interface_version < 5 ? \ -- sizeof(xen_v2_getdomaininfo) : \ -- sizeof(xen_v2d5_getdomaininfo))) -+ (dom_interface_version >= 6 ? \ -+ sizeof(xen_v2d6_getdomaininfo) : \ -+ (dom_interface_version == 5 ? \ -+ sizeof(xen_v2d5_getdomaininfo) : \ -+ sizeof(xen_v2_getdomaininfo)))) - - #define XEN_GETDOMAININFO_CLEAR(dominfo) \ - (hypervisor_version < 2 ? \ - memset(&(dominfo.v0), 0, sizeof(xen_v0_getdomaininfo)) : \ -- (dom_interface_version < 5 ? \ -- memset(&(dominfo.v2), 0, sizeof(xen_v2_getdomaininfo)) : \ -- memset(&(dominfo.v2d5), 0, sizeof(xen_v2d5_getdomaininfo)))) -+ (dom_interface_version >= 6 ? \ -+ memset(&(dominfo.v2d6), 0, sizeof(xen_v2d6_getdomaininfo)) : \ -+ (dom_interface_version == 5 ? \ -+ memset(&(dominfo.v2d5), 0, sizeof(xen_v2d5_getdomaininfo)) : \ -+ memset(&(dominfo.v2), 0, sizeof(xen_v2_getdomaininfo))))) - - #define XEN_GETDOMAININFO_DOMAIN(dominfo) \ - (hypervisor_version < 2 ? \ - dominfo.v0.domain : \ -- (dom_interface_version < 5 ? \ -- dominfo.v2.domain : \ -- dominfo.v2d5.domain)) -+ (dom_interface_version >= 6 ? \ -+ dominfo.v2d6.domain : \ -+ (dom_interface_version == 5 ? \ -+ dominfo.v2d5.domain : \ -+ dominfo.v2.domain))) - - #define XEN_GETDOMAININFO_CPUTIME(dominfo) \ - (hypervisor_version < 2 ? \ - dominfo.v0.cpu_time : \ -- (dom_interface_version < 5 ? \ -- dominfo.v2.cpu_time : \ -- dominfo.v2d5.cpu_time)) -+ (dom_interface_version >= 6 ? \ -+ dominfo.v2d6.cpu_time : \ -+ (dom_interface_version == 5 ? \ -+ dominfo.v2d5.cpu_time : \ -+ dominfo.v2.cpu_time))) -+ - - #define XEN_GETDOMAININFO_CPUCOUNT(dominfo) \ - (hypervisor_version < 2 ? \ - dominfo.v0.nr_online_vcpus : \ -- (dom_interface_version < 5 ? \ -- dominfo.v2.nr_online_vcpus : \ -- dominfo.v2d5.nr_online_vcpus)) -+ (dom_interface_version >= 6 ? \ -+ dominfo.v2d6.nr_online_vcpus : \ -+ (dom_interface_version == 5 ? \ -+ dominfo.v2d5.nr_online_vcpus : \ -+ dominfo.v2.nr_online_vcpus))) - - #define XEN_GETDOMAININFO_MAXCPUID(dominfo) \ - (hypervisor_version < 2 ? \ - dominfo.v0.max_vcpu_id : \ -- (dom_interface_version < 5 ? \ -- dominfo.v2.max_vcpu_id : \ -- dominfo.v2d5.max_vcpu_id)) -+ (dom_interface_version >= 6 ? \ -+ dominfo.v2d6.max_vcpu_id : \ -+ (dom_interface_version == 5 ? \ -+ dominfo.v2d5.max_vcpu_id : \ -+ dominfo.v2.max_vcpu_id))) - - #define XEN_GETDOMAININFO_FLAGS(dominfo) \ - (hypervisor_version < 2 ? \ - dominfo.v0.flags : \ -- (dom_interface_version < 5 ? \ -- dominfo.v2.flags : \ -- dominfo.v2d5.flags)) -+ (dom_interface_version >= 6 ? \ -+ dominfo.v2d6.flags : \ -+ (dom_interface_version == 5 ? \ -+ dominfo.v2d5.flags : \ -+ dominfo.v2.flags))) - - #define XEN_GETDOMAININFO_TOT_PAGES(dominfo) \ - (hypervisor_version < 2 ? \ - dominfo.v0.tot_pages : \ -- (dom_interface_version < 5 ? \ -- dominfo.v2.tot_pages : \ -- dominfo.v2d5.tot_pages)) -+ (dom_interface_version >= 6 ? \ -+ dominfo.v2d6.tot_pages : \ -+ (dom_interface_version == 5 ? \ -+ dominfo.v2d5.tot_pages : \ -+ dominfo.v2.tot_pages))) - - #define XEN_GETDOMAININFO_MAX_PAGES(dominfo) \ - (hypervisor_version < 2 ? \ - dominfo.v0.max_pages : \ -- (dom_interface_version < 5 ? \ -- dominfo.v2.max_pages : \ -- dominfo.v2d5.max_pages)) -+ (dom_interface_version >= 6 ? \ -+ dominfo.v2d6.max_pages : \ -+ (dom_interface_version == 5 ? \ -+ dominfo.v2d5.max_pages : \ -+ dominfo.v2.max_pages))) - - #define XEN_GETDOMAININFO_UUID(dominfo) \ - (hypervisor_version < 2 ? \ - dominfo.v0.handle : \ -- (dom_interface_version < 5 ? \ -- dominfo.v2.handle : \ -- dominfo.v2d5.handle)) -+ (dom_interface_version >= 6 ? \ -+ dominfo.v2d6.handle : \ -+ (dom_interface_version == 5 ? \ -+ dominfo.v2d5.handle : \ -+ dominfo.v2.handle))) - - - static int -@@ -2050,6 +2100,12 @@ xenHypervisorInit(void) - DEBUG0("Using hypervisor call v2, sys ver6 dom ver5\n"); - goto done; - } -+ /* Xen 4.0 */ -+ dom_interface_version = 6; /* XEN_DOMCTL_INTERFACE_VERSION */ -+ if (virXen_getvcpusinfo(fd, 0, 0, ipt, NULL, 0) == 0){ -+ DEBUG0("Using hypervisor call v2, sys ver6 dom ver6\n"); -+ goto done; -+ } - } - - hypervisor_version = 1;