SHA256
1
0
forked from pool/libvirt

Updating link to change in openSUSE:Factory/libvirt revision 51.0

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=766ff1bf43414a75837b5752121ab7f0
This commit is contained in:
OBS User buildservice-autocommit 2010-03-22 16:06:05 +00:00 committed by Git OBS Bridge
parent 294e25f47e
commit 642dcc0690
22 changed files with 467 additions and 1619 deletions

View File

@ -2,7 +2,7 @@ Index: src/lxc/lxc_container.c
===================================================================
--- src/lxc/lxc_container.c.orig
+++ src/lxc/lxc_container.c
@@ -814,6 +814,9 @@ int lxcContainerStart(virDomainDefPtr de
@@ -828,6 +828,9 @@ int lxcContainerStart(virDomainDefPtr de
lxc_child_argv_t args = { def, nveths, veths, control, ttyPath };
/* allocate a stack for the container */
@ -10,11 +10,11 @@ Index: src/lxc/lxc_container.c
+ stacksize *= 2;
+#endif
if (VIR_ALLOC_N(stack, stacksize) < 0) {
virReportOOMError(NULL);
virReportOOMError();
return -1;
@@ -828,7 +831,11 @@ int lxcContainerStart(virDomainDefPtr de
if (def->nets != NULL)
@@ -846,7 +849,11 @@ int lxcContainerStart(virDomainDefPtr de
flags |= CLONE_NEWNET;
}
+#ifdef __ia64__
+ pid = __clone2(lxcContainerChild, stack, stacksize, flags, &args);
@ -22,9 +22,9 @@ Index: src/lxc/lxc_container.c
pid = clone(lxcContainerChild, stacktop, flags, &args);
+#endif
VIR_FREE(stack);
DEBUG("clone() returned, %d", pid);
DEBUG("clone() completed, new container PID is %d", pid);
@@ -854,6 +861,7 @@ int lxcContainerAvailable(int features)
@@ -872,6 +879,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;
@@ -861,14 +869,21 @@ int lxcContainerAvailable(int features)
@@ -879,14 +887,21 @@ int lxcContainerAvailable(int features)
if (features & LXC_CONTAINER_FEATURE_NET)
flags |= CLONE_NEWNET;

View File

@ -1,37 +0,0 @@
commit d8ec244c6513b7c44956a547e56c228a4c38fbbe
Author: Jim Fehlig <jfehlig@novell.com>
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.
*/

View File

@ -1,50 +0,0 @@
commit 7269ec07ba4f298adab64ea66ac528ef66cf9ba0
Author: Jim Fehlig <jfehlig@novell.com>
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 ....

View File

@ -1,40 +0,0 @@
commit 5ebd48c5f4e424e0db663bf5930935b1c04d4998
Author: Jim Fehlig <jfehlig@novell.com>
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;

View File

@ -1,155 +0,0 @@
commit 487b2434403d520027957ed623354b398984af31
Author: Jim Fehlig <jfehlig@novell.com>
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);

View File

@ -1,49 +0,0 @@
commit 5ef6d92292f5c9dd27c7db2bf56f8f24b13c681b
Author: Jim Fehlig <jfehlig@novell.com>
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 ?

View File

@ -1,88 +0,0 @@
commit 80bfb087ae4d92b271eadaee6e08b5ea2d1b68a6
Author: Jim Fehlig <jfehlig@novell.com>
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 */

View File

@ -1,79 +0,0 @@
commit 5b724a365e67d1cc2649ded76dea03836a067921
Author: Jim Fehlig <jfehlig@novell.com>
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,

View File

@ -1,609 +0,0 @@
commit ff9fce67120771b0ec1e21a98afc96360a7bbb36
Author: Jim Fehlig <jfehlig@novell.com>
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 */

View File

@ -1,253 +0,0 @@
commit 3a9b2b900c5dac18c9c48c40ec2dbeaa7c306a0e
Author: Jim Fehlig <jfehlig@novell.com>
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, " </interface>\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, " </disk>\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;
}

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0977f5e00922b2b3c5eca9c7f7e01ff9aee117f24853c53286fea7a010c86495
size 6280159

3
libvirt-0.7.7.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f91e7437893aa66fa7f2bace9ec57967ee66ac80be5cb6bbfba0acce78eb708
size 6512919

View File

@ -1,3 +1,38 @@
-------------------------------------------------------------------
Sun Mar 21 21:20:17 MST 2010 - jfehlig@novell.com
- Updated to version 0.7.7
- Introduce public API for domain async job handling
- macvtap support
- Add QEMU support for virtio channel
- Add persistence of PCI addresses to QEMU
- Functions for computing baseline CPU from a set of host CPUs
- Public API for virDomain{Attach,Detach}DeviceFlags
- lots of improvements and bug fixes
-------------------------------------------------------------------
Tue Mar 9 10:40:49 MST 2010 - jfehlig@novell.com
- Ensure yast-created bridges are not manipulated by libvirt
bnc#584757
Modified suse-network.patch
-------------------------------------------------------------------
Wed Mar 3 19:03:03 MST 2010 - jfehlig@novell.com
- Fix ordering of xen disks to preserve 'bootable' flag
bnc#474738
xend-disk-order.patch
- Add support for blktap2 disks
xen-tap2-support.patch
-------------------------------------------------------------------
Mon Mar 1 15:48:51 MST 2010 - jfehlig@novell.com
- Fix listing of yast-created bridges
bnc#583754
Modified suse-network.patch
-------------------------------------------------------------------
Mon Feb 22 11:05:41 MST 2010 - jfehlig@novell.com

View File

@ -1,5 +1,5 @@
#
# spec file for package libvirt (Version 0.7.6)
# spec file for package libvirt (Version 0.7.7)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
@ -113,8 +113,8 @@ Url: http://libvirt.org/
License: LGPLv2.1+
Group: Development/Libraries/C and C++
AutoReqProv: yes
Version: 0.7.6
Release: 2
Version: 0.7.7
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
Requires: libvirt-client = %{version}-%{release}
@ -138,21 +138,15 @@ Requires: PolicyKit >= 0.6
Source0: %{name}-%{version}.tar.bz2
Source1: libvirtd.init
# Upstream patches
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
Patch0: xen-name-for-devid.patch
Patch1: lxc-cgroup.patch
# Need to go upstream
Patch100: socat.patch
Patch101: clone.patch
Patch102: xen-pv-cdrom.patch
Patch103: xen-domctl-ver7.patch
Patch104: xen-tap2-support.patch
Patch105: xend-disk-order.patch
# Our patches
Patch200: libvirtd-defaults.patch
Patch201: suse-network.patch
@ -262,18 +256,12 @@ Authors:
%setup -q
%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
%patch104 -p1
%patch105 -p1
%patch200 -p1
%patch201 -p1
%patch202 -p1

45
lxc-cgroup.patch Normal file
View File

@ -0,0 +1,45 @@
commit f034c0bfd7089ba3400b7a44b97540c4a8785e35
Author: Jim Fehlig <jfehlig@novell.com>
Date: Sun Mar 21 19:59:13 2010 -0600
Avoid libvirtd crash when cgroups is not configured on host
Invoking virDomainSetMemory() on lxc driver results in libvirtd
segfault when cgroups has not been configured on the host.
Ensure driver->cgroup is non-null before invoking
virCgroupForDomain(). To prevent similar segfaults in the future,
ensure driver parameter to virCgroupForDomain() is non-null before
dereferencing.
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index aeec593..ba13065 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -625,6 +625,12 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
}
if (virDomainObjIsActive(vm)) {
+ if (driver->cgroup == NULL) {
+ lxcError(VIR_ERR_NO_SUPPORT,
+ "%s", _("cgroups must be configured on the host"));
+ goto cleanup;
+ }
+
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
lxcError(VIR_ERR_INTERNAL_ERROR,
_("Unable to get cgroup for %s\n"), vm->def->name);
diff --git a/src/util/cgroup.c b/src/util/cgroup.c
index 8777781..496d9d3 100644
--- a/src/util/cgroup.c
+++ b/src/util/cgroup.c
@@ -692,6 +692,9 @@ int virCgroupForDomain(virCgroupPtr driver,
int rc;
char *path;
+ if (driver == NULL)
+ return -EINVAL;
+
if (virAsprintf(&path, "%s/%s", driver->path, name) < 0)
return -ENOMEM;

View File

@ -1,7 +1,7 @@
Index: libvirt-0.7.6/include/libvirt/libvirt.h.in
Index: libvirt-0.7.7/include/libvirt/libvirt.h.in
===================================================================
--- libvirt-0.7.6.orig/include/libvirt/libvirt.h.in
+++ libvirt-0.7.6/include/libvirt/libvirt.h.in
--- libvirt-0.7.7.orig/include/libvirt/libvirt.h.in
+++ libvirt-0.7.7/include/libvirt/libvirt.h.in
@@ -621,6 +621,21 @@ int virDomainRestore
const char *from);
@ -24,10 +24,10 @@ Index: libvirt-0.7.6/include/libvirt/libvirt.h.in
* Domain core dump
*/
int virDomainCoreDump (virDomainPtr domain,
Index: libvirt-0.7.6/src/libvirt.c
Index: libvirt-0.7.7/src/libvirt.c
===================================================================
--- libvirt-0.7.6.orig/src/libvirt.c
+++ libvirt-0.7.6/src/libvirt.c
--- libvirt-0.7.7.orig/src/libvirt.c
+++ libvirt-0.7.7/src/libvirt.c
@@ -2379,6 +2379,166 @@ error:
}
@ -195,10 +195,10 @@ Index: libvirt-0.7.6/src/libvirt.c
* virDomainCoreDump:
* @domain: a domain object
* @to: path for the core file
Index: libvirt-0.7.6/src/driver.h
Index: libvirt-0.7.7/src/driver.h
===================================================================
--- libvirt-0.7.6.orig/src/driver.h
+++ libvirt-0.7.6/src/driver.h
--- libvirt-0.7.7.orig/src/driver.h
+++ libvirt-0.7.7/src/driver.h
@@ -136,6 +136,21 @@ typedef int
(*virDrvDomainRestore) (virConnectPtr conn,
const char *from);
@ -221,10 +221,10 @@ Index: libvirt-0.7.6/src/driver.h
(*virDrvDomainCoreDump) (virDomainPtr domain,
const char *to,
int flags);
@@ -458,6 +473,11 @@ struct _virDriver {
virDrvDomainIsActive domainIsActive;
virDrvDomainIsPersistent domainIsPersistent;
virDrvCPUCompare cpuCompare;
@@ -473,6 +488,11 @@ struct _virDriver {
virDrvCPUBaseline cpuBaseline;
virDrvDomainGetJobInfo domainGetJobInfo;
virDrvDomainAbortJob domainAbortJob;
+ virDrvDomainSnapshotCreate domainSnapshotCreate;
+ virDrvDomainSnapshotApply domainSnapshotApply;
+ virDrvDomainSnapshotDelete domainSnapshotDelete;
@ -233,10 +233,10 @@ Index: libvirt-0.7.6/src/driver.h
};
typedef int
Index: libvirt-0.7.6/src/xen/xen_driver.c
Index: libvirt-0.7.7/src/xen/xen_driver.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/xen_driver.c
+++ libvirt-0.7.6/src/xen/xen_driver.c
--- libvirt-0.7.7.orig/src/xen/xen_driver.c
+++ libvirt-0.7.7/src/xen/xen_driver.c
@@ -1052,6 +1052,81 @@ xenUnifiedDomainRestore (virConnectPtr c
}
@ -319,10 +319,10 @@ Index: libvirt-0.7.6/src/xen/xen_driver.c
xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, int flags)
{
GET_PRIVATE(dom->conn);
@@ -1904,6 +1979,11 @@ static virDriver xenUnifiedDriver = {
xenUnifiedDomainIsActive,
xenUnifiedDomainisPersistent,
NULL, /* cpuCompare */
@@ -1906,6 +1981,11 @@ static virDriver xenUnifiedDriver = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ xenUnifiedDomainSnapshotCreate, /* domainSnapshotCreate */
+ xenUnifiedDomainSnapshotApply, /* domainSnapshotApply */
+ xenUnifiedDomainSnapshotDelete, /* domainSnapshotDelete */
@ -331,10 +331,10 @@ Index: libvirt-0.7.6/src/xen/xen_driver.c
};
/**
Index: libvirt-0.7.6/src/xen/xen_driver.h
Index: libvirt-0.7.7/src/xen/xen_driver.h
===================================================================
--- libvirt-0.7.6.orig/src/xen/xen_driver.h
+++ libvirt-0.7.6/src/xen/xen_driver.h
--- libvirt-0.7.7.orig/src/xen/xen_driver.h
+++ libvirt-0.7.7/src/xen/xen_driver.h
@@ -100,6 +100,11 @@ struct xenUnifiedDriver {
virDrvDomainGetSchedulerType domainGetSchedulerType;
virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
@ -347,10 +347,10 @@ Index: libvirt-0.7.6/src/xen/xen_driver.h
};
typedef struct xenXMConfCache *xenXMConfCachePtr;
Index: libvirt-0.7.6/src/xen/xend_internal.c
Index: libvirt-0.7.7/src/xen/xend_internal.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/xend_internal.c
+++ libvirt-0.7.6/src/xen/xend_internal.c
--- libvirt-0.7.7.orig/src/xen/xend_internal.c
+++ libvirt-0.7.7/src/xen/xend_internal.c
@@ -53,6 +53,12 @@
#ifndef PROXY
@ -364,7 +364,7 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c
/*
* The number of Xen scheduler parameters
*/
@@ -3284,6 +3290,87 @@ xenDaemonDomainRestore(virConnectPtr con
@@ -3297,6 +3303,87 @@ xenDaemonDomainRestore(virConnectPtr con
}
return xend_op(conn, "", "op", "restore", "file", filename, NULL);
}
@ -452,7 +452,7 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c
#endif /* !PROXY */
/**
@@ -5235,6 +5322,11 @@ struct xenUnifiedDriver xenDaemonDriver
@@ -5245,6 +5332,11 @@ struct xenUnifiedDriver xenDaemonDriver
xenDaemonGetSchedulerType, /* domainGetSchedulerType */
xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */
@ -464,10 +464,10 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c
};
/************************************************************************
Index: libvirt-0.7.6/src/xen/proxy_internal.c
Index: libvirt-0.7.7/src/xen/proxy_internal.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/proxy_internal.c
+++ libvirt-0.7.6/src/xen/proxy_internal.c
--- libvirt-0.7.7.orig/src/xen/proxy_internal.c
+++ libvirt-0.7.7/src/xen/proxy_internal.c
@@ -83,6 +83,11 @@ struct xenUnifiedDriver xenProxyDriver =
NULL, /* domainGetSchedulerType */
NULL, /* domainGetSchedulerParameters */
@ -480,10 +480,10 @@ Index: libvirt-0.7.6/src/xen/proxy_internal.c
};
Index: libvirt-0.7.6/src/xen/xen_hypervisor.c
Index: libvirt-0.7.7/src/xen/xen_hypervisor.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/xen_hypervisor.c
+++ libvirt-0.7.6/src/xen/xen_hypervisor.c
--- libvirt-0.7.7.orig/src/xen/xen_hypervisor.c
+++ libvirt-0.7.7/src/xen/xen_hypervisor.c
@@ -850,6 +850,11 @@ struct xenUnifiedDriver xenHypervisorDri
xenHypervisorGetSchedulerType, /* domainGetSchedulerType */
xenHypervisorGetSchedulerParameters, /* domainGetSchedulerParameters */
@ -496,10 +496,10 @@ Index: libvirt-0.7.6/src/xen/xen_hypervisor.c
};
#endif /* !PROXY */
Index: libvirt-0.7.6/src/xen/xm_internal.c
Index: libvirt-0.7.7/src/xen/xm_internal.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/xm_internal.c
+++ libvirt-0.7.6/src/xen/xm_internal.c
--- libvirt-0.7.7.orig/src/xen/xm_internal.c
+++ libvirt-0.7.7/src/xen/xm_internal.c
@@ -118,6 +118,11 @@ struct xenUnifiedDriver xenXMDriver = {
NULL, /* domainGetSchedulerType */
NULL, /* domainGetSchedulerParameters */
@ -512,10 +512,10 @@ Index: libvirt-0.7.6/src/xen/xm_internal.c
};
#define xenXMError(conn, code, fmt...) \
Index: libvirt-0.7.6/src/xen/xs_internal.c
Index: libvirt-0.7.7/src/xen/xs_internal.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/xs_internal.c
+++ libvirt-0.7.6/src/xen/xs_internal.c
--- libvirt-0.7.7.orig/src/xen/xs_internal.c
+++ libvirt-0.7.7/src/xen/xs_internal.c
@@ -83,6 +83,11 @@ struct xenUnifiedDriver xenStoreDriver =
NULL, /* domainGetSchedulerType */
NULL, /* domainGetSchedulerParameters */
@ -528,11 +528,11 @@ Index: libvirt-0.7.6/src/xen/xs_internal.c
};
#endif /* ! PROXY */
Index: libvirt-0.7.6/tools/virsh.c
Index: libvirt-0.7.7/tools/virsh.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
--- libvirt-0.7.7.orig/tools/virsh.c
+++ libvirt-0.7.7/tools/virsh.c
@@ -1268,6 +1268,188 @@ cmdSave(vshControl *ctl, const vshCmd *c
}
/*
@ -721,7 +721,7 @@ Index: libvirt-0.7.6/tools/virsh.c
* "schedinfo" command
*/
static const vshCmdInfo info_schedinfo[] = {
@@ -7502,6 +7684,12 @@ static const vshCmdDef commands[] = {
@@ -7753,6 +7935,12 @@ static const vshCmdDef commands[] = {
{"undefine", cmdUndefine, opts_undefine, info_undefine},
{"uri", cmdURI, NULL, info_uri},
@ -734,14 +734,14 @@ Index: libvirt-0.7.6/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.6/src/lxc/lxc_driver.c
Index: libvirt-0.7.7/src/lxc/lxc_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/lxc/lxc_driver.c
+++ libvirt-0.7.7/src/lxc/lxc_driver.c
@@ -2459,6 +2459,11 @@ static virDriver lxcDriver = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -750,14 +750,14 @@ Index: libvirt-0.7.6/src/lxc/lxc_driver.c
};
static virStateDriver lxcStateDriver = {
Index: libvirt-0.7.6/src/openvz/openvz_driver.c
Index: libvirt-0.7.7/src/openvz/openvz_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/openvz/openvz_driver.c
+++ libvirt-0.7.7/src/openvz/openvz_driver.c
@@ -1540,6 +1540,11 @@ static virDriver openvzDriver = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -766,14 +766,14 @@ Index: libvirt-0.7.6/src/openvz/openvz_driver.c
};
int openvzRegister(void) {
Index: libvirt-0.7.6/src/qemu/qemu_driver.c
Index: libvirt-0.7.7/src/qemu/qemu_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/qemu/qemu_driver.c
+++ libvirt-0.7.7/src/qemu/qemu_driver.c
@@ -9535,6 +9535,11 @@ static virDriver qemuDriver = {
qemuCPUBaseline, /* cpuBaseline */
qemuDomainGetJobInfo, /* domainGetJobInfo */
qemuDomainAbortJob, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -782,14 +782,14 @@ Index: libvirt-0.7.6/src/qemu/qemu_driver.c
};
Index: libvirt-0.7.6/src/esx/esx_driver.c
Index: libvirt-0.7.7/src/esx/esx_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/esx/esx_driver.c
+++ libvirt-0.7.7/src/esx/esx_driver.c
@@ -3410,6 +3410,11 @@ static virDriver esxDriver = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -798,14 +798,14 @@ Index: libvirt-0.7.6/src/esx/esx_driver.c
};
Index: libvirt-0.7.6/src/test/test_driver.c
Index: libvirt-0.7.7/src/test/test_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/test/test_driver.c
+++ libvirt-0.7.7/src/test/test_driver.c
@@ -5245,6 +5245,11 @@ static virDriver testDriver = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -814,14 +814,14 @@ Index: libvirt-0.7.6/src/test/test_driver.c
};
static virNetworkDriver testNetworkDriver = {
Index: libvirt-0.7.6/src/uml/uml_driver.c
Index: libvirt-0.7.7/src/uml/uml_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/uml/uml_driver.c
+++ libvirt-0.7.7/src/uml/uml_driver.c
@@ -1932,6 +1932,11 @@ static virDriver umlDriver = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -830,14 +830,14 @@ Index: libvirt-0.7.6/src/uml/uml_driver.c
};
Index: libvirt-0.7.6/src/vbox/vbox_tmpl.c
Index: libvirt-0.7.7/src/vbox/vbox_tmpl.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/vbox/vbox_tmpl.c
+++ libvirt-0.7.7/src/vbox/vbox_tmpl.c
@@ -7065,6 +7065,11 @@ virDriver NAME(Driver) = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -846,14 +846,14 @@ Index: libvirt-0.7.6/src/vbox/vbox_tmpl.c
};
virNetworkDriver NAME(NetworkDriver) = {
Index: libvirt-0.7.6/src/opennebula/one_driver.c
Index: libvirt-0.7.7/src/opennebula/one_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/opennebula/one_driver.c
+++ libvirt-0.7.7/src/opennebula/one_driver.c
@@ -788,6 +788,11 @@ static virDriver oneDriver = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -862,14 +862,14 @@ Index: libvirt-0.7.6/src/opennebula/one_driver.c
};
static virStateDriver oneStateDriver = {
Index: libvirt-0.7.6/src/phyp/phyp_driver.c
Index: libvirt-0.7.7/src/phyp/phyp_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/phyp/phyp_driver.c
+++ libvirt-0.7.7/src/phyp/phyp_driver.c
@@ -1656,6 +1656,11 @@ virDriver phypDriver = {
NULL, /* cpuBaseline */
NULL, /* domainGetJobInfo */
NULL, /* domainAbortJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -878,14 +878,14 @@ Index: libvirt-0.7.6/src/phyp/phyp_driver.c
};
int
Index: libvirt-0.7.6/src/remote/remote_driver.c
Index: libvirt-0.7.7/src/remote/remote_driver.c
===================================================================
--- 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 */
--- libvirt-0.7.7.orig/src/remote/remote_driver.c
+++ libvirt-0.7.7/src/remote/remote_driver.c
@@ -9143,6 +9143,11 @@ static virDriver remote_driver = {
remoteCPUBaseline, /* cpuBaseline */
remoteDomainGetJobInfo, /* domainGetJobInfo */
remoteDomainAbortJob, /* domainFinishJob */
+ NULL, /* domainSnapshotCreate */
+ NULL, /* domainSnapshotApply */
+ NULL, /* domainSnapshotDelete */
@ -894,11 +894,11 @@ Index: libvirt-0.7.6/src/remote/remote_driver.c
};
static virNetworkDriver network_driver = {
Index: libvirt-0.7.6/docs/libvirt-api.xml
Index: libvirt-0.7.7/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 @@
--- libvirt-0.7.7.orig/docs/libvirt-api.xml
+++ libvirt-0.7.7/docs/libvirt-api.xml
@@ -300,6 +300,11 @@
<exports symbol='virDomainSetVcpus' type='function'/>
<exports symbol='virDomainShutdown' type='function'/>
<exports symbol='virDomainSuspend' type='function'/>
@ -910,7 +910,7 @@ Index: libvirt-0.7.6/docs/libvirt-api.xml
<exports symbol='virDomainUndefine' type='function'/>
<exports symbol='virEventAddHandleFunc' type='function'/>
<exports symbol='virEventAddTimeoutFunc' type='function'/>
@@ -1972,6 +1977,36 @@ This function may requires privileged ac
@@ -2040,6 +2045,36 @@ This function may requires privileged ac
<return type='int' info='0 in case of success and -1 in case of failure.'/>
<arg name='domain' type='virDomainPtr' info='a domain object'/>
</function>
@ -947,10 +947,10 @@ Index: libvirt-0.7.6/docs/libvirt-api.xml
<function name='virDomainUndefine' file='libvirt' module='libvirt'>
<info><![CDATA[Undefine a domain but does not stop it if it is running]]></info>
<return type='int' info='0 in case of success, -1 in case of error'/>
Index: libvirt-0.7.6/src/libvirt_public.syms
Index: libvirt-0.7.7/src/libvirt_public.syms
===================================================================
--- libvirt-0.7.6.orig/src/libvirt_public.syms
+++ libvirt-0.7.6/src/libvirt_public.syms
--- libvirt-0.7.7.orig/src/libvirt_public.syms
+++ libvirt-0.7.7/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.6/src/libvirt_public.syms
} LIBVIRT_0.4.2;
LIBVIRT_0.5.0 {
Index: libvirt-0.7.6/python/generator.py
Index: libvirt-0.7.7/python/generator.py
===================================================================
--- libvirt-0.7.6.orig/python/generator.py
+++ libvirt-0.7.6/python/generator.py
@@ -289,6 +289,7 @@ skip_impl = (
--- libvirt-0.7.7.orig/python/generator.py
+++ libvirt-0.7.7/python/generator.py
@@ -290,6 +290,7 @@ skip_impl = (
'virDomainSetSchedulerParameters',
'virDomainGetVcpus',
'virDomainPinVcpu',
@ -975,10 +975,10 @@ Index: libvirt-0.7.6/python/generator.py
'virSecretGetValue',
'virSecretSetValue',
'virSecretGetUUID',
Index: libvirt-0.7.6/python/libvirt-override.c
Index: libvirt-0.7.7/python/libvirt-override.c
===================================================================
--- libvirt-0.7.6.orig/python/libvirt-override.c
+++ libvirt-0.7.6/python/libvirt-override.c
--- libvirt-0.7.7.orig/python/libvirt-override.c
+++ libvirt-0.7.7/python/libvirt-override.c
@@ -1542,6 +1542,34 @@ libvirt_virStoragePoolGetInfo(PyObject *
return(py_retval);
}
@ -1014,7 +1014,7 @@ Index: libvirt-0.7.6/python/libvirt-override.c
static PyObject *
libvirt_virStorageVolGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
@@ -2717,6 +2745,7 @@ static PyMethodDef libvirtMethods[] = {
@@ -2805,6 +2833,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.6/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.6/python/libvirt-override-api.xml
Index: libvirt-0.7.7/python/libvirt-override-api.xml
===================================================================
--- libvirt-0.7.6.orig/python/libvirt-override-api.xml
+++ libvirt-0.7.6/python/libvirt-override-api.xml
@@ -150,6 +150,11 @@
--- libvirt-0.7.7.orig/python/libvirt-override-api.xml
+++ libvirt-0.7.7/python/libvirt-override-api.xml
@@ -155,6 +155,11 @@
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='params' type='virSchedParameterPtr' info='pointer to scheduler parameter objects'/>
</function>
@ -1038,10 +1038,10 @@ Index: libvirt-0.7.6/python/libvirt-override-api.xml
<function name='virConnectListStoragePools' file='python'>
<info>list the storage pools, stores the pointers to the names in @names</info>
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
Index: libvirt-0.7.6/src/xen/xen_inotify.c
Index: libvirt-0.7.7/src/xen/xen_inotify.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/xen_inotify.c
+++ libvirt-0.7.6/src/xen/xen_inotify.c
--- libvirt-0.7.7.orig/src/xen/xen_inotify.c
+++ libvirt-0.7.7/src/xen/xen_inotify.c
@@ -86,6 +86,11 @@ struct xenUnifiedDriver xenInotifyDriver
NULL, /* domainGetSchedulerType */
NULL, /* domainGetSchedulerParameters */

View File

@ -1,8 +1,8 @@
Index: libvirt-0.7.4/src/remote/remote_driver.c
Index: libvirt-0.7.7/src/remote/remote_driver.c
===================================================================
--- libvirt-0.7.4.orig/src/remote/remote_driver.c
+++ libvirt-0.7.4/src/remote/remote_driver.c
@@ -763,12 +763,29 @@ doRemoteOpen (virConnectPtr conn,
--- libvirt-0.7.7.orig/src/remote/remote_driver.c
+++ libvirt-0.7.7/src/remote/remote_driver.c
@@ -766,12 +766,29 @@ doRemoteOpen (virConnectPtr conn,
cmd_argv[j++] = strdup ("none");
}
cmd_argv[j++] = strdup (priv->hostname);

View File

@ -1,58 +1,56 @@
Index: libvirt-0.7.5/src/conf/network_conf.c
Index: libvirt-0.7.7/src/conf/network_conf.c
===================================================================
--- libvirt-0.7.5.orig/src/conf/network_conf.c
+++ libvirt-0.7.5/src/conf/network_conf.c
@@ -863,6 +863,137 @@ error:
--- libvirt-0.7.7.orig/src/conf/network_conf.c
+++ libvirt-0.7.7/src/conf/network_conf.c
@@ -845,6 +845,135 @@ error:
return NULL;
}
+static int virNetworkIsBridge(const char *name)
+int virNetworkIsBridge(const char *name)
+{
+ char *path = NULL;
+ int ret = 0;
+ struct stat s;
+
+ if (asprintf(&path, "/sys/class/net/%s/bridge", name) < 0)
+ goto out;
+ goto out;
+
+ if (stat(path, &s) != 0)
+ goto out;
+ goto out;
+
+ if (S_ISDIR(s.st_mode))
+ ret = 1;
+ ret = 1;
+
+ out:
+out:
+ free(path);
+ return ret;
+ }
+
+static unsigned long virNetworkDefSuseGetValue(const char *netName, const char *valName)
+{
+ unsigned long ret = 0;
+ char *path = NULL;
+ FILE *f;
+
+ if (asprintf(&path, "/sys/class/net/%s/bridge/%s", netName, valName) < 0)
+ return ret;
+
+ if ((f = fopen(path, "r")) == NULL)
+ goto out;
+
+ if (fscanf(f, "%lu", &ret) != 1) {
+ ret = 0;
+ goto out;
+ }
+
+ out:
+ if (f != NULL)
+ fclose(f);
+ free(path);
+ return ret;
+}
+
+static unsigned long virNetworkDefSuseGetValue(const char *netName, const char *valName)
+{
+ unsigned long ret = 0;
+ char *path = NULL;
+ FILE *f;
+
+ if (asprintf(&path, "/sys/class/net/%s/bridge/%s", netName, valName) < 0)
+ return ret;
+
+ if ((f = fopen(path, "r")) == NULL)
+ goto out;
+
+ if (fscanf(f, "%lu", &ret) != 1) {
+ ret = 0;
+ goto out;
+ }
+
+
+ out:
+ if (f != NULL)
+ fclose(f);
+ free(path);
+ return ret;
+}
+
+static virNetworkObjPtr virNetworkLoadSuseNet(virConnectPtr conn,
+ virNetworkObjListPtr nets,
+static virNetworkObjPtr virNetworkLoadSuseNet(virNetworkObjListPtr nets,
+ const char *name)
+{
+ virNetworkDefPtr def;
@ -60,21 +58,22 @@ Index: libvirt-0.7.5/src/conf/network_conf.c
+ int err;
+
+ if ((network = virNetworkFindByName(nets, name))) {
+ return network;
+ virNetworkObjUnlock(network);
+ return network;
+ }
+
+ if (VIR_ALLOC(network) < 0) {
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
+ return NULL;
+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL);
+ return NULL;
+ }
+
+ network->autostart = 1;
+ network->active = 1;
+ network->readonly = 1;
+ network->suse = 1;
+
+ if (VIR_ALLOC(def) < 0) {
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
+ goto error;
+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL);
+ goto error;
+ }
+
+ network->def = def;
@ -82,29 +81,29 @@ Index: libvirt-0.7.5/src/conf/network_conf.c
+ /* name */
+ def->name = strdup(name);
+ if (def->name == NULL) {
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
+ goto error;
+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL);
+ goto error;
+ }
+
+ /* uuid */
+ if ((err = virUUIDGenerate(def->uuid))) {
+ virNetworkReportError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Failed to generate UUID: %s"), strerror(err));
+ goto error;
+ virNetworkReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Failed to generate UUID: %s"), strerror(err));
+ goto error;
+ }
+
+ /* bridge information */
+ def->bridge = strdup(name);
+ if (def->bridge == NULL) {
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
+ goto error;
+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL);
+ goto error;
+ }
+ def->stp = (int)virNetworkDefSuseGetValue(name, "stp_state");
+ def->delay = virNetworkDefSuseGetValue(name, "forward_delay");
+
+ /* Add network to the list */
+ if (VIR_REALLOC_N(nets->objs, nets->count + 1) < 0) {
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
+ virNetworkReportError(VIR_ERR_NO_MEMORY, NULL);
+ VIR_FREE(network);
+ return NULL;
+ }
@ -114,78 +113,144 @@ Index: libvirt-0.7.5/src/conf/network_conf.c
+
+ return network;
+
+ error:
+error:
+ virNetworkObjFree(network);
+ return NULL;
+}
+
+static void virNetworkLoadSuseNetworks(virConnectPtr conn,
+ virNetworkObjListPtr nets)
+void virNetworkLoadSuseNetworks(virNetworkObjListPtr nets)
+{
+ DIR *dir = NULL;
+ struct dirent *de;
+
+ dir = opendir("/sys/class/net");
+ if (dir == NULL)
+ return;
+ return;
+
+ while ((de = readdir(dir))) {
+ if (virNetworkIsBridge(de->d_name)) {
+ virNetworkLoadSuseNet(conn, nets, de->d_name);
+ }
+ if (virNetworkIsBridge(de->d_name)) {
+ virNetworkLoadSuseNet(nets, de->d_name);
+ }
+ }
+ closedir(dir);
+}
+
int virNetworkLoadAllConfigs(virConnectPtr conn,
virNetworkObjListPtr nets,
int virNetworkLoadAllConfigs(virNetworkObjListPtr nets,
const char *configDir,
@@ -902,6 +1033,7 @@ int virNetworkLoadAllConfigs(virConnectP
const char *autostartDir)
@@ -882,6 +1011,7 @@ int virNetworkLoadAllConfigs(virNetworkO
closedir(dir);
+ virNetworkLoadSuseNetworks(conn, nets);
+ virNetworkLoadSuseNetworks(nets);
return 0;
}
Index: libvirt-0.7.5/src/conf/network_conf.h
Index: libvirt-0.7.7/src/conf/network_conf.h
===================================================================
--- libvirt-0.7.5.orig/src/conf/network_conf.h
+++ libvirt-0.7.5/src/conf/network_conf.h
--- libvirt-0.7.7.orig/src/conf/network_conf.h
+++ libvirt-0.7.7/src/conf/network_conf.h
@@ -94,6 +94,7 @@ struct _virNetworkObj {
unsigned int active : 1;
unsigned int autostart : 1;
unsigned int persistent : 1;
+ unsigned int readonly : 1;
+ unsigned int suse : 1;
virNetworkDefPtr def; /* The current definition */
virNetworkDefPtr newDef; /* New definition to activate at shutdown */
Index: libvirt-0.7.5/src/network/bridge_driver.c
@@ -172,4 +173,7 @@ int virNetworkSetBridgeName(const virNet
void virNetworkObjLock(virNetworkObjPtr obj);
void virNetworkObjUnlock(virNetworkObjPtr obj);
+int virNetworkIsBridge(const char *name);
+void virNetworkLoadSuseNetworks(virNetworkObjListPtr nets);
+
#endif /* __NETWORK_CONF_H__ */
Index: libvirt-0.7.7/src/network/bridge_driver.c
===================================================================
--- libvirt-0.7.5.orig/src/network/bridge_driver.c
+++ libvirt-0.7.5/src/network/bridge_driver.c
@@ -1010,6 +1010,11 @@ static int networkShutdownNetworkDaemon(
--- libvirt-0.7.7.orig/src/network/bridge_driver.c
+++ libvirt-0.7.7/src/network/bridge_driver.c
@@ -811,7 +811,8 @@ networkReloadIptablesRules(struct networ
for (i = 0 ; i < driver->networks.count ; i++) {
virNetworkObjLock(driver->networks.objs[i]);
- if (virNetworkObjIsActive(driver->networks.objs[i])) {
+ if (virNetworkObjIsActive(driver->networks.objs[i]) &&
+ !(driver->networks.objs[i]->suse)) {
networkRemoveIptablesRules(driver, driver->networks.objs[i]);
if (!networkAddIptablesRules(driver, driver->networks.objs[i])) {
/* failed to add but already logged */
@@ -1003,6 +1004,12 @@ static int networkShutdownNetworkDaemon(
unlink(stateFile);
VIR_FREE(stateFile);
+ if (network->readonly) {
+ VIR_WARN("Network '%s' is readonly\n", network->def->name);
+ if (network->suse) {
+ VIR_WARN("Network '%s' is not under libvirt control and will not be "
+ "shutdown\n", network->def->name);
+ return -1;
+ }
+
if (network->dnsmasqPid > 0)
kill(network->dnsmasqPid, SIGTERM);
@@ -1510,6 +1515,12 @@ static int networkSetAutostart(virNetwor
@@ -1098,11 +1105,25 @@ static int networkCloseNetwork(virConnec
return 0;
}
+static void networkDriverSuseRefresh(struct network_driver *driver) {
+ int i = 0;
+ virNetworkObjPtr netObj;
+
+ virNetworkLoadSuseNetworks(&driver->networks);
+ while (i < driver->networks.count) {
+ netObj = driver->networks.objs[i];
+ if (netObj->suse && !virNetworkIsBridge(netObj->def->name))
+ virNetworkRemoveInactive(&driver->networks, netObj);
+ i++;
+ }
+}
+
static int networkNumNetworks(virConnectPtr conn) {
int nactive = 0, i;
struct network_driver *driver = conn->networkPrivateData;
networkDriverLock(driver);
+ networkDriverSuseRefresh(driver);
for (i = 0 ; i < driver->networks.count ; i++) {
virNetworkObjLock(driver->networks.objs[i]);
if (virNetworkObjIsActive(driver->networks.objs[i]))
@@ -1119,6 +1140,7 @@ static int networkListNetworks(virConnec
int got = 0, i;
networkDriverLock(driver);
+ networkDriverSuseRefresh(driver);
for (i = 0 ; i < driver->networks.count && got < nnames ; i++) {
virNetworkObjLock(driver->networks.objs[i]);
if (virNetworkObjIsActive(driver->networks.objs[i])) {
@@ -1499,6 +1521,13 @@ static int networkSetAutostart(virNetwor
goto cleanup;
}
+ if (network->readonly) {
+ networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
+ ": Network '%s' is readonly", network->def->name);
+ if (network->suse) {
+ networkReportError(VIR_ERR_INTERNAL_ERROR,
+ ": Network '%s' is not under libvirt control",
+ network->def->name);
+ return -1;
+ }
+
autostart = (autostart != 0);
if (network->autostart != autostart) {
Index: libvirt-0.7.7/src/libvirt_private.syms
===================================================================
--- libvirt-0.7.7.orig/src/libvirt_private.syms
+++ libvirt-0.7.7/src/libvirt_private.syms
@@ -411,6 +411,8 @@ virNetworkSaveConfig;
virNetworkSetBridgeName;
virNetworkObjLock;
virNetworkObjUnlock;
+virNetworkLoadSuseNetworks;
+virNetworkIsBridge;
# nodeinfo.h

View File

@ -13,10 +13,10 @@ Date: Wed Jan 27 16:11:41 2010 -0700
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
Index: libvirt-0.7.7/src/xen/xend_internal.c
===================================================================
--- libvirt-0.7.6.orig/src/xen/xend_internal.c
+++ libvirt-0.7.6/src/xen/xend_internal.c
--- libvirt-0.7.7.orig/src/xen/xend_internal.c
+++ libvirt-0.7.7/src/xen/xend_internal.c
@@ -93,6 +93,7 @@ xenDaemonFormatSxprOnePCI(virConnectPtr
static int
@ -25,7 +25,7 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c
virDomainDeviceDefPtr dev,
char *class,
char *ref,
@@ -4215,7 +4216,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr
@@ -4212,7 +4213,7 @@ xenDaemonAttachDeviceFlags(virDomainPtr
sexpr = virBufferContentAndReset(&buf);
@ -34,7 +34,7 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c
/* 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
@@ -4306,7 +4307,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr
def, xml, VIR_DOMAIN_XML_INACTIVE)))
goto cleanup;
@ -43,7 +43,7 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c
goto cleanup;
if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
@@ -6052,6 +6053,7 @@ error:
@@ -6060,6 +6061,7 @@ error:
*/
static int
virDomainXMLDevID(virDomainPtr domain,
@ -51,7 +51,7 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c
virDomainDeviceDefPtr dev,
char *class,
char *ref,
@@ -6060,27 +6062,33 @@ virDomainXMLDevID(virDomainPtr domain,
@@ -6068,27 +6070,33 @@ virDomainXMLDevID(virDomainPtr domain,
xenUnifiedPrivatePtr priv = domain->conn->privateData;
char *xref;
char *tmp;

View File

@ -1,8 +1,8 @@
Index: libvirt-0.7.6/src/xen/xend_internal.c
Index: libvirt-0.7.7/src/xen/xend_internal.c
===================================================================
--- 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
--- libvirt-0.7.7.orig/src/xen/xend_internal.c
+++ libvirt-0.7.7/src/xen/xend_internal.c
@@ -5475,7 +5475,10 @@ xenDaemonFormatSxprDisk(virConnectPtr co
} else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
virBufferVSprintf(buf, "(dev '%s:cdrom')", def->dst);
} else {

30
xen-tap2-support.patch Normal file
View File

@ -0,0 +1,30 @@
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
@@ -1606,7 +1606,8 @@ xenDaemonParseSxprDisks(virConnectPtr co
but blktap disks ended up in a differently named
(device (tap ....)) block.... */
if (sexpr_lookup(node, "device/vbd") ||
- sexpr_lookup(node, "device/tap")) {
+ sexpr_lookup(node, "device/tap") ||
+ sexpr_lookup(node, "device/tap2")) {
char *offset;
const char *src = NULL;
const char *dst = NULL;
@@ -1617,10 +1618,14 @@ xenDaemonParseSxprDisks(virConnectPtr co
src = sexpr_node(node, "device/vbd/uname");
dst = sexpr_node(node, "device/vbd/dev");
mode = sexpr_node(node, "device/vbd/mode");
- } else {
+ } else if (sexpr_lookup(node, "device/tap")) {
src = sexpr_node(node, "device/tap/uname");
dst = sexpr_node(node, "device/tap/dev");
mode = sexpr_node(node, "device/tap/mode");
+ } else {
+ src = sexpr_node(node, "device/tap2/uname");
+ dst = sexpr_node(node, "device/tap2/dev");
+ mode = sexpr_node(node, "device/tap2/mode");
}
if (VIR_ALLOC(disk) < 0)

45
xend-disk-order.patch Normal file
View File

@ -0,0 +1,45 @@
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
@@ -1612,20 +1612,24 @@ xenDaemonParseSxprDisks(virConnectPtr co
const char *src = NULL;
const char *dst = NULL;
const char *mode = NULL;
+ int bootable;
/* Again dealing with (vbd...) vs (tap ...) differences */
if (sexpr_lookup(node, "device/vbd")) {
src = sexpr_node(node, "device/vbd/uname");
dst = sexpr_node(node, "device/vbd/dev");
mode = sexpr_node(node, "device/vbd/mode");
+ bootable = sexpr_int(node, "device/vbd/bootable");
} else if (sexpr_lookup(node, "device/tap")) {
src = sexpr_node(node, "device/tap/uname");
dst = sexpr_node(node, "device/tap/dev");
mode = sexpr_node(node, "device/tap/mode");
+ bootable = sexpr_int(node, "device/tap/bootable");
} else {
src = sexpr_node(node, "device/tap2/uname");
dst = sexpr_node(node, "device/tap2/dev");
mode = sexpr_node(node, "device/tap2/mode");
+ bootable = sexpr_int(node, "device/tap2/bootable");
}
if (VIR_ALLOC(disk) < 0)
@@ -1749,8 +1753,13 @@ xenDaemonParseSxprDisks(virConnectPtr co
if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0)
goto no_memory;
-
- def->disks[def->ndisks++] = disk;
+
+ if (bootable == 1 && def->ndisks > 0) {
+ memmove(def->disks + 1, def->disks, sizeof(def->disks) * def->ndisks);
+ def->disks[0] = disk;
+ def->ndisks++;
+ } else
+ def->disks[def->ndisks++] = disk;
disk = NULL;
}
}