[libvirt] [sandbox PATCH] Fix FSF address on bin/virt-sandbox-service
by Cédric Bosdonnat
---
bin/virt-sandbox-service | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 2dcbfb8..a7e71cd 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -16,7 +16,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301 USA.
#
from gi.repository import LibvirtGObject
--
1.8.5.2
10 years, 11 months
[libvirt] [PATCH] maint: fix comment typos in qemu numa code
by Eric Blake
Introduced in commit 81fae6b9.
* src/qemu/qemu_driver.c (qemuDomainSetNumaParamsLive): Fix typos.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the trivial rule.
src/qemu/qemu_driver.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7e45ffc..004ec88 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1,7 +1,7 @@
/*
* qemu_driver.c: core driver methods for managing qemu guests
*
- * Copyright (C) 2006-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2014 Red Hat, Inc.
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
@@ -8161,7 +8161,7 @@ qemuDomainSetNumaParamsLive(virDomainObjPtr vm,
goto cleanup;
}
- /*Get Exisitng nodeset values */
+ /* Get existing nodeset values */
if (virCgroupGetCpusetMems(priv->cgroup, &nodeset_str) < 0 ||
virBitmapParse(nodeset_str, 0, &temp_nodeset,
VIR_DOMAIN_CPUMASK_LEN) < 0)
@@ -8192,7 +8192,7 @@ qemuDomainSetNumaParamsLive(virDomainObjPtr vm,
goto cleanup;
VIR_FREE(nodeset_str);
- /* Ensure the cpuset string is formated before passing to cgroup */
+ /* Ensure the cpuset string is formatted before passing to cgroup */
if (!(nodeset_str = virBitmapFormat(nodeset))) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to format nodeset"));
--
1.8.4.2
10 years, 11 months
[libvirt] [PATCH v3] BSD: implement nodeGetMemoryStats
by Roman Bogorodskiy
Add a BSD implementation of nodeGetMemoryStats based
on sysctl(3).
---
src/nodeinfo.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 81 insertions(+), 1 deletion(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 1838547..05bc038 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -96,7 +96,85 @@ appleFreebsdNodeGetMemorySize(unsigned long *memory)
return 0;
}
-#endif
+#endif /* defined(__FreeBSD__) || defined(__APPLE__) */
+
+#ifdef __FreeBSD__
+# define BSD_MEMORY_STATS_ALL 4
+
+static int
+freebsdNodeGetMemoryStats(virNodeMemoryStatsPtr params,
+ int *nparams)
+{
+ size_t i, j = 0;
+ unsigned long pagesize = getpagesize() >> 10;
+ long bufpages;
+ size_t bufpages_size = sizeof(bufpages);
+ struct field_sysctl_map {
+ const char *field;
+ const char *sysctl_name;
+ } sysctl_map[] = {
+ {VIR_NODE_MEMORY_STATS_TOTAL, "vm.stats.vm.v_page_count"},
+ {VIR_NODE_MEMORY_STATS_FREE, "vm.stats.vm.v_free_count"},
+ {VIR_NODE_MEMORY_STATS_CACHED, "vm.stats.vm.v_cache_count"},
+ {NULL, NULL}
+ };
+
+ if ((*nparams) == 0) {
+ *nparams = BSD_MEMORY_STATS_ALL;
+ return 0;
+ }
+
+ if ((*nparams) != BSD_MEMORY_STATS_ALL) {
+ virReportInvalidArg(nparams,
+ _("nparams in %s must be %d"),
+ __FUNCTION__, BSD_MEMORY_STATS_ALL);
+ return -1;
+ }
+
+ for (i = 0; sysctl_map[i].field != NULL; i++) {
+ u_int value;
+ size_t value_size = sizeof(value);
+ virNodeMemoryStatsPtr param;
+
+ if (sysctlbyname(sysctl_map[i].sysctl_name, &value,
+ &value_size, NULL, 0) < 0) {
+ virReportSystemError(errno,
+ _("sysctl failed for '%s'"),
+ sysctl_map[i].sysctl_name);
+ return -1;
+ }
+
+ param = ¶ms[j++];
+ if (virStrcpyStatic(param->field, sysctl_map[i].field) == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Field '%s' too long for destination"),
+ sysctl_map[i].field);
+ return -1;
+ }
+ param->value = (unsigned long long)value * pagesize;
+ }
+
+ {
+ virNodeMemoryStatsPtr param = ¶ms[j++];
+
+ if (sysctlbyname("vfs.bufspace", &bufpages, &bufpages_size, NULL, 0) < 0) {
+ virReportSystemError(errno,
+ _("sysctl failed for '%s'"),
+ "vfs.bufspace");
+ return -1;
+ }
+ if (virStrcpyStatic(param->field, VIR_NODE_MEMORY_STATS_BUFFERS) == NULL) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Field '%s' too long for destination"),
+ VIR_NODE_MEMORY_STATS_BUFFERS);
+ return -1;
+ }
+ param->value = (unsigned long long)bufpages >> 10;
+ }
+
+ return 0;
+}
+#endif /* __FreeBSD__ */
#ifdef __linux__
# define CPUINFO_PATH "/proc/cpuinfo"
@@ -1041,6 +1119,8 @@ int nodeGetMemoryStats(int cellNum ATTRIBUTE_UNUSED,
return ret;
}
+#elif defined(__FreeBSD__)
+ return freebsdNodeGetMemoryStats(params, nparams);
#else
virReportError(VIR_ERR_NO_SUPPORT, "%s",
_("node memory stats not implemented on this platform"));
--
1.8.4.3
10 years, 11 months
[libvirt] [PATCH] qemuStateInitialize: Create qemu log directory
by Wangyufei (James)
>From 51782a44eecf5801e5100920e5965d8dfc46e4cc Mon Sep 17 00:00:00 2001
From: Zhou Yimin <zhouyimin(a)huawei.com>
Date: Thu, 2 Jan 2014 16:32:46 +0800
Subject: [PATCH] qemuStateInitialize: Create qemu log directory
When an error occurred in qemuProcessStart before qemu log directory created,
it will fail to create qemu log file in qemuProcessStop during
qemuProcessStart's cleanup phase. So when I start a VM whose PCI device not
exist, the last error will be overwrited as "failed to create logfile XXX:
No such file or directory" not the real reason "Device XXX not found:could not
access XXX: No such file or directory".
I fix it as following.
Signed-off-by: Zhou Yimin <zhouyimin(a)huawei.com>
Reviewed-by: Wang Yufei <james.wangyufei(a)huawei.com>
---
src/qemu/qemu_driver.c | 5 +++++
src/qemu/qemu_process.c | 14 --------------
2 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 45d11cd..ca3208e 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -615,6 +615,11 @@ qemuStateInitialize(bool privileged,
goto error;
VIR_FREE(driverConf);
+ if (virFileMakePath(cfg->logDir) < 0) {
+ VIR_ERROR(_("Failed to create log dir '%s': %s"),
+ cfg->logDir, virStrerror(errno, ebuf, sizeof(ebuf)));
+ goto error;
+ }
if (virFileMakePath(cfg->stateDir) < 0) {
VIR_ERROR(_("Failed to create state dir '%s': %s"),
cfg->stateDir, virStrerror(errno, ebuf, sizeof(ebuf)));
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index d0fde54..0382c06 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3737,13 +3737,6 @@ int qemuProcessStart(virConnectPtr conn,
}
}
- if (virFileMakePath(cfg->logDir) < 0) {
- virReportSystemError(errno,
- _("cannot create log directory %s"),
- cfg->logDir);
- goto cleanup;
- }
-
VIR_DEBUG("Creating domain log file");
if ((logfile = qemuDomainCreateLog(driver, vm, false)) < 0)
goto cleanup;
@@ -4503,13 +4496,6 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
driver->inhibitCallback(true, driver->inhibitOpaque);
active = true;
- if (virFileMakePath(cfg->logDir) < 0) {
- virReportSystemError(errno,
- _("cannot create log directory %s"),
- cfg->logDir);
- goto error;
- }
-
VIR_FREE(priv->pidfile);
if (VIR_STRDUP(priv->pidfile, pidfile) < 0)
goto error;
--
1.7.3.1.msysgit.0
Best Regards,
-WangYufei
10 years, 11 months
[libvirt] [PATCH] Fix argument order at qemuMigrationPerformJob().
by Minoru Usui
Hi, everyone.
I found a small bug at qemuMigrationPerformJob().
The order of argument, @listenAddress and @cookiein, should be changed place,
because these order are mismatched caller and callee.
Signed-off-by: Minoru Usui <usui(a)mxm.nes.nec.co.jp>
---
src/qemu/qemu_migration.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 9342062..53a4ae6 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4045,8 +4045,8 @@ qemuMigrationPerformJob(virQEMUDriverPtr driver,
const char *dconnuri,
const char *uri,
const char *graphicsuri,
- const char *cookiein,
const char *listenAddress,
+ const char *cookiein,
int cookieinlen,
char **cookieout,
int *cookieoutlen,
--
1.7.2.3
--
Minoru Usui <usui(a)mxm.nes.nec.co.jp>
10 years, 11 months
[libvirt] [PATCH 0/2] Fixes on shareable SCSI host device
by Osier Yang
It's easy to reproduce with two domains using the same SCSI
generic device, both with <shareable> specified. It's expected
to work. But the fact is:
% virsh start f20-1
error: Failed to start domain b
error: Requested operation is not valid: SCSI device 1:0:0:0 is in use by domain f20-0
Osier Yang (2):
util: Add "shareable" field for virSCSIDevice struct
qemu: Don't fail if the SCSI host device is shareable between domains
src/libvirt_private.syms | 1 +
src/qemu/qemu_cgroup.c | 3 ++-
src/qemu/qemu_hostdev.c | 42 +++++++++++++++++++++++-----------------
src/security/security_apparmor.c | 3 ++-
src/security/security_dac.c | 6 ++++--
src/security/security_selinux.c | 6 ++++--
src/util/virscsi.c | 11 ++++++++++-
src/util/virscsi.h | 4 +++-
8 files changed, 50 insertions(+), 26 deletions(-)
--
1.8.1.4
10 years, 11 months
[libvirt] [PATCH] libxl: Fix initialization of nictype in libxl_device_nic
by Jim Fehlig
As pointed out by the Xen folks [1], HVM nics should always be set
to type LIBXL_NIC_TYPE_VIF_IOEMU unless the user explicity requests
LIBXL_NIC_TYPE_VIF via model='netfront'. The current logic in
libxlMakeNic() only sets the nictype to LIBXL_NIC_TYPE_VIF_IOEMU if
a model is specified that is not 'netfront', which breaks PXE booting
configurations where no model is specified (i.e. use the hypervisor
default).
Reported-by: Stefan Bader <stefan.bader(a)canonical.com>
[1] https://www.redhat.com/archives/libvir-list/2013-December/msg01156.html
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
I toyed with detecting whether to use an IOEMU nic in libxlMakeNicList()
and passing the bool to libxlMakeNic(), but in the end left the detection
to libxlMakeNic().
src/libxl/libxl_conf.c | 20 ++++++++++++++------
src/libxl/libxl_conf.h | 4 +++-
2 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index aaeb00e..04d01af 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -855,8 +855,12 @@ error:
}
int
-libxlMakeNic(virDomainNetDefPtr l_nic, libxl_device_nic *x_nic)
+libxlMakeNic(virDomainDefPtr def,
+ virDomainNetDefPtr l_nic,
+ libxl_device_nic *x_nic)
{
+ bool ioemu_nic = STREQ(def->os.type, "hvm");
+
/* TODO: Where is mtu stored?
*
* x_nics[i].mtu = 1492;
@@ -866,12 +870,16 @@ libxlMakeNic(virDomainNetDefPtr l_nic, libxl_device_nic *x_nic)
virMacAddrGetRaw(&l_nic->mac, x_nic->mac);
- if (l_nic->model && !STREQ(l_nic->model, "netfront")) {
- if (VIR_STRDUP(x_nic->model, l_nic->model) < 0)
- return -1;
+ if (ioemu_nic)
x_nic->nictype = LIBXL_NIC_TYPE_VIF_IOEMU;
- } else {
+ else
x_nic->nictype = LIBXL_NIC_TYPE_VIF;
+
+ if (l_nic->model) {
+ if (VIR_STRDUP(x_nic->model, l_nic->model) < 0)
+ return -1;
+ if (STREQ(l_nic->model, "netfront"))
+ x_nic->nictype = LIBXL_NIC_TYPE_VIF;
}
if (VIR_STRDUP(x_nic->ifname, l_nic->ifname) < 0)
@@ -908,7 +916,7 @@ libxlMakeNicList(virDomainDefPtr def, libxl_domain_config *d_config)
return -1;
for (i = 0; i < nnics; i++) {
- if (libxlMakeNic(l_nics[i], &x_nics[i]))
+ if (libxlMakeNic(def, l_nics[i], &x_nics[i]))
goto error;
}
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index ffa93bd..90d590f 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -142,7 +142,9 @@ libxlMakeCapabilities(libxl_ctx *ctx);
int
libxlMakeDisk(virDomainDiskDefPtr l_dev, libxl_device_disk *x_dev);
int
-libxlMakeNic(virDomainNetDefPtr l_nic, libxl_device_nic *x_nic);
+libxlMakeNic(virDomainDefPtr def,
+ virDomainNetDefPtr l_nic,
+ libxl_device_nic *x_nic);
int
libxlMakeVfb(libxlDriverPrivatePtr driver,
virDomainGraphicsDefPtr l_vfb, libxl_device_vfb *x_vfb);
--
1.8.1.4
10 years, 11 months
[libvirt] [PATCH] maint: Fix messy include of libvirt_internal.h
by Peter Krempa
The libvirt_internal.h header was included by the internal.h header.
This made it painful to add new stuff to the header file that would
require some more specific types. Remove inclusion by internal.h and add
it to appropriate places manually.
---
src/driver.h | 1 +
src/internal.h | 2 --
src/libxl/libxl_conf.h | 1 +
src/lxc/lxc_conf.h | 1 +
src/uml/uml_conf.h | 1 +
5 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/driver.h b/src/driver.h
index b6927ea..5f4cd8d 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -25,6 +25,7 @@
# include <unistd.h>
# include "internal.h"
+# include "libvirt_internal.h"
# include "viruri.h"
/*
* List of registered drivers numbers
diff --git a/src/internal.h b/src/internal.h
index 5035dac..4ba0e41 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -60,8 +60,6 @@
# include "libvirt/libvirt-qemu.h"
# include "libvirt/virterror.h"
-# include "libvirt_internal.h"
-
# include "c-strcase.h"
# include "ignore-value.h"
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index ffa93bd..3ab8f20 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -29,6 +29,7 @@
# include <libxl.h>
# include "internal.h"
+# include "libvirt_internal.h"
# include "domain_conf.h"
# include "domain_event.h"
# include "capabilities.h"
diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h
index f6cbfc9..e04dcdd 100644
--- a/src/lxc/lxc_conf.h
+++ b/src/lxc/lxc_conf.h
@@ -26,6 +26,7 @@
# define LXC_CONF_H
# include "internal.h"
+# include "libvirt_internal.h"
# include "domain_conf.h"
# include "domain_event.h"
# include "capabilities.h"
diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h
index c23a177..a914be0 100644
--- a/src/uml/uml_conf.h
+++ b/src/uml/uml_conf.h
@@ -25,6 +25,7 @@
# define __UML_CONF_H
# include "internal.h"
+# include "libvirt_internal.h"
# include "capabilities.h"
# include "network_conf.h"
# include "domain_conf.h"
--
1.8.5.2
10 years, 11 months
[libvirt] [PATCH] lxcDomainShutdownFlags: Cleanup @flags usage
by Michal Privoznik
Currently, the @flags usage is a bit unclear at first sight to say the
least. There's no need for such unclear code especially when we can
borrow the working code from qemuDomainShutdownFlags().
In addition, this fixes one bug too. If user requested both
VIR_DOMAIN_SHUTDOWN_INITCTL and VIR_DOMAIN_SHUTDOWN_SIGNAL at the same
time, he is basically saying: 'Use the force Luke! If initctl fails try
sending a signal.' But with the current code we don't do that. If
initctl fails for some reason (e.g. inability to write to /dev/initctl)
we don't try sending any signal but fail immediately. To make things
worse, making a domain shutdown with bare _SIGNAL was working by blind
chance of a @rc variable being placed at correct place on the stack so
its initial value was zero.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/lxc/lxc_driver.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index c499182..a563b70 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -2594,7 +2594,8 @@ lxcDomainShutdownFlags(virDomainPtr dom,
virDomainObjPtr vm;
char *vroot = NULL;
int ret = -1;
- int rc;
+ int rc = 0;
+ bool useInitctl = false, initctlRequested, signalRequested;
virCheckFlags(VIR_DOMAIN_SHUTDOWN_INITCTL |
VIR_DOMAIN_SHUTDOWN_SIGNAL, -1);
@@ -2623,25 +2624,24 @@ lxcDomainShutdownFlags(virDomainPtr dom,
(unsigned long long)priv->initpid) < 0)
goto cleanup;
- if (flags == 0 ||
- (flags & VIR_DOMAIN_SHUTDOWN_INITCTL)) {
- if ((rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF,
- vroot)) < 0) {
+ initctlRequested = flags & VIR_DOMAIN_SHUTDOWN_INITCTL;
+ signalRequested = flags & VIR_DOMAIN_SHUTDOWN_SIGNAL;
+
+ if (initctlRequested || !flags)
+ useInitctl = true;
+
+ if (useInitctl) {
+ rc = virInitctlSetRunLevel(VIR_INITCTL_RUNLEVEL_POWEROFF, vroot);
+ if (rc < 0 && !signalRequested)
goto cleanup;
- }
- if (rc == 0 && flags != 0 &&
- ((flags & ~VIR_DOMAIN_SHUTDOWN_INITCTL) == 0)) {
+ if (rc == 0 && !signalRequested) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Container does not provide an initctl pipe"));
goto cleanup;
}
- } else {
- rc = 0;
}
- if (rc == 0 &&
- (flags == 0 ||
- (flags & VIR_DOMAIN_SHUTDOWN_SIGNAL))) {
+ if (rc == 0 && !useInitctl) {
if (kill(priv->initpid, SIGTERM) < 0 &&
errno != ESRCH) {
virReportSystemError(errno,
--
1.8.5.1
10 years, 11 months
[libvirt] [PATCH] build: fix bootstrap with older autoconf
by Eric Blake
Pavel Hrdina reported to me off-list that my gnulib update on
Jan 1 broke the build on RHEL 6.4 and older:
executing aclocal -I glm4
glm4/gl-openssl.m4:11: error: m4_defn: undefined macro: _m4_divert_diversion
glm4/gl-openssl.m4:11: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: autom4te failed with exit status: 1
It took me a while, but I fixed the regression in gnulib.
* gnulib: Update to latest, for buid fixes.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
Pushing under the build-breaker rule.
* .gnulib c7802e2...5a7fe2f (12):
> md5, sha1, sha256, sha512: support older autoconf
> include_next: port to autoconf 2.63
> maint: add a gnulib-local rule to keep non-ascii out of .texi files
> freadable, fwritable, fwriting: declare with the "pure" attribute
> maint.mk: adapt openat.h-include-without-use test
> doc: use ASCII in .texi files where UTF-8 isn't needed
> freading: declare with attribute "pure"
> manywarnings: remove -Wmudflap
> autoupdate
> relocatable-script: remove unused code
> maint: fix public-submodule-commit to work with newer git
> autoupdate
.gnulib | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.gnulib b/.gnulib
index c7802e2..5a7fe2f 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit c7802e2b418c40fa2bd270cf241314d0c8433a26
+Subproject commit 5a7fe2fe76d74d2cad663018bdf6ed40a90f085e
--
1.8.4.2
10 years, 11 months