forked from pool/libvirt
This commit is contained in:
parent
420c59c5d3
commit
ebe0f017a1
@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 30 16:11:54 MST 2009 - jfehlig@novell.com
|
||||
|
||||
- Fix build for architectures not supporting numa
|
||||
- Forward port suse-network.patch and snapshots.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jan 28 15:45:25 MST 2009 - jfehlig@novell.com
|
||||
|
||||
|
14
libvirt.spec
14
libvirt.spec
@ -30,7 +30,7 @@
|
||||
%endif
|
||||
|
||||
Name: libvirt
|
||||
BuildRequires: PolicyKit-devel bridge-utils cyrus-sasl-devel fdupes gettext gnutls-devel hal-devel iptables-devel libnuma-devel libxml2-devel lvm2 ncurses-devel parted-devel pkg-config python-devel readline-devel util-linux xhtml-dtd
|
||||
BuildRequires: PolicyKit-devel bridge-utils cyrus-sasl-devel fdupes gettext gnutls-devel hal-devel iptables-devel libxml2-devel lvm2 ncurses-devel parted-devel pkg-config python-devel readline-devel util-linux xhtml-dtd
|
||||
%if %{with_xen}
|
||||
BuildRequires: xen-devel
|
||||
%endif
|
||||
@ -42,6 +42,9 @@ BuildRequires: avahi-devel
|
||||
%if %{with_selinux}
|
||||
BuildRequires: libselinux-devel
|
||||
%endif
|
||||
%ifarch x86_64 ia64
|
||||
BuildRequires: libnuma-devel
|
||||
%endif
|
||||
# Only for directory ownership:
|
||||
BuildRequires: gtk-doc
|
||||
Url: http://libvirt.org/
|
||||
@ -49,7 +52,7 @@ License: LGPL v2.1 or later
|
||||
Group: Development/Libraries/C and C++
|
||||
AutoReqProv: yes
|
||||
Version: 0.5.1
|
||||
Release: 1
|
||||
Release: 2
|
||||
Summary: A C toolkit to interract with the virtualization capabilities of Linux
|
||||
Requires: readline
|
||||
Requires: ncurses
|
||||
@ -78,6 +81,8 @@ Patch6: detach-disk.patch
|
||||
Patch7: migrate-params.patch
|
||||
Patch8: cve-2008-5086.patch
|
||||
Patch9: devhelp.patch
|
||||
Patch10: suse-network.patch
|
||||
Patch11: snapshots.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
||||
%description
|
||||
@ -179,6 +184,8 @@ Authors:
|
||||
%patch7 -p1
|
||||
%patch8 -p1
|
||||
%patch9 -p1
|
||||
%patch10 -p1
|
||||
%patch11 -p1
|
||||
|
||||
%build
|
||||
%if ! %{with_xen}
|
||||
@ -312,6 +319,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{py_sitedir}/libvirtmod*
|
||||
|
||||
%changelog
|
||||
* Fri Jan 30 2009 jfehlig@novell.com
|
||||
- Fix build for architectures not supporting numa
|
||||
- Forward port suse-network.patch and snapshots.patch
|
||||
* Wed Jan 28 2009 jfehlig@novell.com
|
||||
- Updated to version 0.5.1
|
||||
- CPU and scheduler support for LXC
|
||||
|
1139
snapshots.patch
Normal file
1139
snapshots.patch
Normal file
File diff suppressed because it is too large
Load Diff
191
suse-network.patch
Normal file
191
suse-network.patch
Normal file
@ -0,0 +1,191 @@
|
||||
Index: libvirt-0.5.1/src/network_conf.c
|
||||
===================================================================
|
||||
--- libvirt-0.5.1.orig/src/network_conf.c
|
||||
+++ libvirt-0.5.1/src/network_conf.c
|
||||
@@ -752,6 +752,137 @@ error:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+static 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;
|
||||
+
|
||||
+ if (stat(path, &s) != 0)
|
||||
+ goto out;
|
||||
+
|
||||
+ if (S_ISDIR(s.st_mode))
|
||||
+ ret = 1;
|
||||
+
|
||||
+ 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 virNetworkObjPtr virNetworkLoadSuseNet(virConnectPtr conn,
|
||||
+ virNetworkObjListPtr nets,
|
||||
+ const char *name)
|
||||
+{
|
||||
+ virNetworkDefPtr def;
|
||||
+ virNetworkObjPtr network;
|
||||
+ int err;
|
||||
+
|
||||
+ if ((network = virNetworkFindByName(nets, name))) {
|
||||
+ return network;
|
||||
+ }
|
||||
+
|
||||
+ if (VIR_ALLOC(network) < 0) {
|
||||
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ network->autostart = 1;
|
||||
+ network->active = 1;
|
||||
+ network->readonly = 1;
|
||||
+
|
||||
+ if (VIR_ALLOC(def) < 0) {
|
||||
+ virNetworkReportError(conn, VIR_ERR_NO_MEMORY, NULL);
|
||||
+ goto error;
|
||||
+ }
|
||||
+
|
||||
+ network->def = def;
|
||||
+
|
||||
+ /* name */
|
||||
+ def->name = strdup(name);
|
||||
+ if (def->name == NULL) {
|
||||
+ virNetworkReportError(conn, 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;
|
||||
+ }
|
||||
+
|
||||
+ /* bridge information */
|
||||
+ def->bridge = strdup(name);
|
||||
+ if (def->bridge == NULL) {
|
||||
+ virNetworkReportError(conn, 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);
|
||||
+ VIR_FREE(network);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ nets->objs[nets->count] = network;
|
||||
+ nets->count++;
|
||||
+
|
||||
+ return network;
|
||||
+
|
||||
+ error:
|
||||
+ virNetworkObjFree(network);
|
||||
+ return NULL;
|
||||
+}
|
||||
+
|
||||
+static void virNetworkLoadSuseNetworks(virConnectPtr conn,
|
||||
+ virNetworkObjListPtr nets)
|
||||
+{
|
||||
+ DIR *dir = NULL;
|
||||
+ struct dirent *de;
|
||||
+
|
||||
+ dir = opendir("/sys/class/net");
|
||||
+ if (dir == NULL)
|
||||
+ return;
|
||||
+
|
||||
+ while ((de = readdir(dir))) {
|
||||
+ if (virNetworkIsBridge(de->d_name)) {
|
||||
+ virNetworkLoadSuseNet(conn, nets, de->d_name);
|
||||
+ }
|
||||
+ }
|
||||
+ closedir(dir);
|
||||
+}
|
||||
+
|
||||
int virNetworkLoadAllConfigs(virConnectPtr conn,
|
||||
virNetworkObjListPtr nets,
|
||||
const char *configDir,
|
||||
@@ -787,6 +918,7 @@ int virNetworkLoadAllConfigs(virConnectP
|
||||
|
||||
closedir(dir);
|
||||
|
||||
+ virNetworkLoadSuseNetworks(conn, nets);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Index: libvirt-0.5.1/src/network_conf.h
|
||||
===================================================================
|
||||
--- libvirt-0.5.1.orig/src/network_conf.h
|
||||
+++ libvirt-0.5.1/src/network_conf.h
|
||||
@@ -86,6 +86,7 @@ struct _virNetworkObj {
|
||||
unsigned int active : 1;
|
||||
unsigned int autostart : 1;
|
||||
unsigned int persistent : 1;
|
||||
+ unsigned int readonly : 1;
|
||||
|
||||
char *configFile; /* Persistent config file path */
|
||||
char *autostartLink; /* Symlink path for autostart */
|
||||
Index: libvirt-0.5.1/src/network_driver.c
|
||||
===================================================================
|
||||
--- libvirt-0.5.1.orig/src/network_driver.c
|
||||
+++ libvirt-0.5.1/src/network_driver.c
|
||||
@@ -763,6 +763,11 @@ static int networkShutdownNetworkDaemon(
|
||||
if (!virNetworkIsActive(network))
|
||||
return 0;
|
||||
|
||||
+ if (network->readonly) {
|
||||
+ networkLog(NETWORK_WARN, ": Network '%s' is readonly", network->def->name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
if (network->dnsmasqPid > 0)
|
||||
kill(network->dnsmasqPid, SIGTERM);
|
||||
|
||||
@@ -1082,6 +1087,12 @@ static int networkSetAutostart(virNetwor
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (network->readonly) {
|
||||
+ networkReportError(net->conn, NULL, net, VIR_ERR_INTERNAL_ERROR,
|
||||
+ ": Network '%s' is readonly", network->def->name);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
autostart = (autostart != 0);
|
||||
|
||||
if (network->autostart == autostart)
|
Loading…
Reference in New Issue
Block a user