bug fixes from SLE11 SP1

OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=42
This commit is contained in:
James Fehlig 2010-03-09 21:12:01 +00:00 committed by Git OBS Bridge
parent dfdc93c360
commit bf52d084ff
6 changed files with 196 additions and 24 deletions

View File

@ -1,3 +1,26 @@
-------------------------------------------------------------------
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 Mon Feb 22 11:05:41 MST 2010 - jfehlig@novell.com

View File

@ -153,6 +153,8 @@ Patch100: socat.patch
Patch101: clone.patch Patch101: clone.patch
Patch102: xen-pv-cdrom.patch Patch102: xen-pv-cdrom.patch
Patch103: xen-domctl-ver7.patch Patch103: xen-domctl-ver7.patch
Patch104: xen-tap2-support.patch
Patch105: xend-disk-order.patch
# Our patches # Our patches
Patch200: libvirtd-defaults.patch Patch200: libvirtd-defaults.patch
Patch201: suse-network.patch Patch201: suse-network.patch
@ -274,6 +276,8 @@ Authors:
%patch101 %patch101
%patch102 -p1 %patch102 -p1
%patch103 -p1 %patch103 -p1
%patch104 -p1
%patch105 -p1
%patch200 -p1 %patch200 -p1
%patch201 -p1 %patch201 -p1
%patch202 -p1 %patch202 -p1

View File

@ -364,7 +364,7 @@ Index: libvirt-0.7.6/src/xen/xend_internal.c
/* /*
* The number of Xen scheduler parameters * The number of Xen scheduler parameters
*/ */
@@ -3284,6 +3290,87 @@ xenDaemonDomainRestore(virConnectPtr con @@ -3298,6 +3304,87 @@ xenDaemonDomainRestore(virConnectPtr con
} }
return xend_op(conn, "", "op", "restore", "file", filename, NULL); 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 */ #endif /* !PROXY */
/** /**
@@ -5235,6 +5322,11 @@ struct xenUnifiedDriver xenDaemonDriver @@ -5249,6 +5336,11 @@ struct xenUnifiedDriver xenDaemonDriver
xenDaemonGetSchedulerType, /* domainGetSchedulerType */ xenDaemonGetSchedulerType, /* domainGetSchedulerType */
xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */ xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */ xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */

View File

@ -1,12 +1,12 @@
Index: libvirt-0.7.5/src/conf/network_conf.c Index: libvirt-0.7.6/src/conf/network_conf.c
=================================================================== ===================================================================
--- libvirt-0.7.5.orig/src/conf/network_conf.c --- libvirt-0.7.6.orig/src/conf/network_conf.c
+++ libvirt-0.7.5/src/conf/network_conf.c +++ libvirt-0.7.6/src/conf/network_conf.c
@@ -863,6 +863,137 @@ error: @@ -863,6 +863,138 @@ error:
return NULL; return NULL;
} }
+static int virNetworkIsBridge(const char *name) +int virNetworkIsBridge(const char *name)
+{ +{
+ char *path = NULL; + char *path = NULL;
+ int ret = 0; + int ret = 0;
@ -60,6 +60,7 @@ Index: libvirt-0.7.5/src/conf/network_conf.c
+ int err; + int err;
+ +
+ if ((network = virNetworkFindByName(nets, name))) { + if ((network = virNetworkFindByName(nets, name))) {
+ virNetworkObjUnlock(network);
+ return network; + return network;
+ } + }
+ +
@ -70,7 +71,7 @@ Index: libvirt-0.7.5/src/conf/network_conf.c
+ +
+ network->autostart = 1; + network->autostart = 1;
+ network->active = 1; + network->active = 1;
+ network->readonly = 1; + network->suse = 1;
+ +
+ if (VIR_ALLOC(def) < 0) { + if (VIR_ALLOC(def) < 0) {
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL); + virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
@ -119,7 +120,7 @@ Index: libvirt-0.7.5/src/conf/network_conf.c
+ return NULL; + return NULL;
+} +}
+ +
+static void virNetworkLoadSuseNetworks(virConnectPtr conn, +void virNetworkLoadSuseNetworks(virConnectPtr conn,
+ virNetworkObjListPtr nets) + virNetworkObjListPtr nets)
+{ +{
+ DIR *dir = NULL; + DIR *dir = NULL;
@ -140,7 +141,7 @@ Index: libvirt-0.7.5/src/conf/network_conf.c
int virNetworkLoadAllConfigs(virConnectPtr conn, int virNetworkLoadAllConfigs(virConnectPtr conn,
virNetworkObjListPtr nets, virNetworkObjListPtr nets,
const char *configDir, const char *configDir,
@@ -902,6 +1033,7 @@ int virNetworkLoadAllConfigs(virConnectP @@ -902,6 +1034,7 @@ int virNetworkLoadAllConfigs(virConnectP
closedir(dir); closedir(dir);
@ -148,44 +149,113 @@ Index: libvirt-0.7.5/src/conf/network_conf.c
return 0; return 0;
} }
Index: libvirt-0.7.5/src/conf/network_conf.h Index: libvirt-0.7.6/src/conf/network_conf.h
=================================================================== ===================================================================
--- libvirt-0.7.5.orig/src/conf/network_conf.h --- libvirt-0.7.6.orig/src/conf/network_conf.h
+++ libvirt-0.7.5/src/conf/network_conf.h +++ libvirt-0.7.6/src/conf/network_conf.h
@@ -94,6 +94,7 @@ struct _virNetworkObj { @@ -94,6 +94,7 @@ struct _virNetworkObj {
unsigned int active : 1; unsigned int active : 1;
unsigned int autostart : 1; unsigned int autostart : 1;
unsigned int persistent : 1; unsigned int persistent : 1;
+ unsigned int readonly : 1; + unsigned int suse : 1;
virNetworkDefPtr def; /* The current definition */ virNetworkDefPtr def; /* The current definition */
virNetworkDefPtr newDef; /* New definition to activate at shutdown */ virNetworkDefPtr newDef; /* New definition to activate at shutdown */
Index: libvirt-0.7.5/src/network/bridge_driver.c @@ -190,4 +191,8 @@ int virNetworkSetBridgeName(virConnectPt
void virNetworkObjLock(virNetworkObjPtr obj);
void virNetworkObjUnlock(virNetworkObjPtr obj);
+int virNetworkIsBridge(const char *name);
+void virNetworkLoadSuseNetworks(virConnectPtr conn,
+ virNetworkObjListPtr nets);
+
#endif /* __NETWORK_CONF_H__ */
Index: libvirt-0.7.6/src/network/bridge_driver.c
=================================================================== ===================================================================
--- libvirt-0.7.5.orig/src/network/bridge_driver.c --- libvirt-0.7.6.orig/src/network/bridge_driver.c
+++ libvirt-0.7.5/src/network/bridge_driver.c +++ libvirt-0.7.6/src/network/bridge_driver.c
@@ -1010,6 +1010,11 @@ static int networkShutdownNetworkDaemon( @@ -817,7 +817,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(NULL, driver, driver->networks.objs[i])) {
/* failed to add but already logged */
@@ -1010,6 +1011,12 @@ static int networkShutdownNetworkDaemon(
unlink(stateFile); unlink(stateFile);
VIR_FREE(stateFile); VIR_FREE(stateFile);
+ if (network->readonly) { + if (network->suse) {
+ VIR_WARN("Network '%s' is readonly\n", network->def->name); + VIR_WARN("Network '%s' is not under libvirt control and will not be "
+ "shutdown\n", network->def->name);
+ return -1; + return -1;
+ } + }
+ +
if (network->dnsmasqPid > 0) if (network->dnsmasqPid > 0)
kill(network->dnsmasqPid, SIGTERM); kill(network->dnsmasqPid, SIGTERM);
@@ -1510,6 +1515,12 @@ static int networkSetAutostart(virNetwor @@ -1105,11 +1112,26 @@ static int networkCloseNetwork(virConnec
return 0;
}
+static void networkDriverSuseRefresh(virConnectPtr conn,
+ struct network_driver *driver) {
+ int i = 0;
+ virNetworkObjPtr netObj;
+
+ virNetworkLoadSuseNetworks(conn, &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(conn, driver);
for (i = 0 ; i < driver->networks.count ; i++) {
virNetworkObjLock(driver->networks.objs[i]);
if (virNetworkObjIsActive(driver->networks.objs[i]))
@@ -1126,6 +1148,7 @@ static int networkListNetworks(virConnec
int got = 0, i;
networkDriverLock(driver);
+ networkDriverSuseRefresh(conn, driver);
for (i = 0 ; i < driver->networks.count && got < nnames ; i++) {
virNetworkObjLock(driver->networks.objs[i]);
if (virNetworkObjIsActive(driver->networks.objs[i])) {
@@ -1510,6 +1533,13 @@ static int networkSetAutostart(virNetwor
goto cleanup; goto cleanup;
} }
+ if (network->readonly) { + if (network->suse) {
+ networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR, + networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
+ ": Network '%s' is readonly", network->def->name); + ": Network '%s' is not under libvirt control",
+ network->def->name);
+ return -1; + return -1;
+ } + }
+ +
autostart = (autostart != 0); autostart = (autostart != 0);
if (network->autostart != autostart) { if (network->autostart != autostart) {
Index: libvirt-0.7.6/src/libvirt_private.syms
===================================================================
--- libvirt-0.7.6.orig/src/libvirt_private.syms
+++ libvirt-0.7.6/src/libvirt_private.syms
@@ -408,6 +408,8 @@ virNetworkSaveConfig;
virNetworkSetBridgeName;
virNetworkObjLock;
virNetworkObjUnlock;
+virNetworkLoadSuseNetworks;
+virNetworkIsBridge;
# nodeinfo.h

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;
}
}