[libvirt] libvirt.so.0: cannot open shared object file: No such file or directory
by YAO
Hi,
I cloned the latest libvirt from git and compiled as follows:
cd libvirt
./autogen.sh
make
sudo make install
when installing, it reported "*/usr/bin/install: cannot stat `./xxx.html':
No such file or directory*", is that normal?
after install completed, I typed virsh, it showed:
"*virsh: error while loading shared libraries: libvirt.so.0: cannot open
shared object file: No such file or directory*", how to fix it?
I found libvirt.so.0 in /usr/local/lib, but why virsh can't find it?
the same problem happens on /usr/local/sbin/libvirtd, it can't find
libvirt-qemu.so.0 which is also located in /usr/local/lib.
So, what's the general procedure to make git version work?
13 years, 6 months
[libvirt] [PATCH v4 0/4] vcpupin: configure inactive domains' CPU affinity setting
by Taku Izumi
Hi all,
This patchset enables us to configure inactive domains' CPU affinity setting.
v3 -> v4:
- Rebase
*[PATCHv4 1/4] vcpupin: inroduce a new libvir API (virDomainPinVcpuFlags)
*[PATCHv4 2/4] vcpupin: implement the code to address the new API in the qemu driver
*[PATCHv4 3/4] vcpupin: implement the remote protocol to address the new API
*[PATCHv4 4/4] vcpupin: add the new options to "virsh vcpupin" command
Best regards,
Taku Izumi
13 years, 6 months
[libvirt] [PATCH] qemu: don't require is_kvm for vhost-net support
by Laine Stump
This was discussed in:
https://www.redhat.com/archives/libvir-list/2011-May/msg01370.html
The capabilities code only sets the flag to allow use of vhost-net if
kvm is detected (set if the help string contains "(qemu-kvm-" or
"(kvm-"), but actually vhost-net is available in some qemu builds that
don't have kvm in their name, so just checking for ",vhost=" is enough.
---
src/qemu/qemu_capabilities.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ea55df5..71a54a5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -982,7 +982,7 @@ qemuCapsComputeCmdFlags(const char *help,
if (is_kvm && (version >= 10000 || kvm_version >= 74))
qemuCapsSet(flags, QEMU_CAPS_VNET_HDR);
- if (is_kvm && strstr(help, ",vhost=")) {
+ if (strstr(help, ",vhost=")) {
qemuCapsSet(flags, QEMU_CAPS_VNET_HOST);
}
--
1.7.3.4
13 years, 6 months
[libvirt] [Patch V2] Fix initialization of current vcpus in libxl driver
by Jim Fehlig
The cur_vcpus member of struct libxl_domain_build_info was incorrectly
initialized to the number of vcpus, when it should have been interpreted
as a bitmap, where bit X corresponds to online/offline status of vcpuX.
To complicate matters, cur_vcpus is an int, so only 32 vcpus can be
set online. Add a check to ensure vcpus does not exceed this limit.
V2: Eric Blake noted a compilation pitfal when '1 << 32' on an int.
Account for vcpus == 32.
---
src/libxl/libxl_conf.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 3cebf41..649352d 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -379,11 +379,26 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config)
int hvm = STREQ(def->os.type, "hvm");
int i;
+ /* Currently, libxenlight only supports 32 vcpus per domain.
+ * cur_vcpus member of struct libxl_domain_build_info is defined
+ * as an int, but its' semantic is a bitmap of online vcpus, so
+ * only 32 can be represented.
+ */
+ if (def->maxvcpus > 32 || def->vcpus > 32) {
+ libxlError(VIR_ERR_INTERNAL_ERROR,
+ _("This version of libxenlight only supports 32 "
+ "vcpus per domain"));
+ return -1;
+ }
+
libxl_init_build_info(b_info, &d_config->c_info);
b_info->hvm = hvm;
b_info->max_vcpus = def->maxvcpus;
- b_info->cur_vcpus = def->vcpus;
+ if (def->vcpus == 32)
+ b_info->cur_vcpus = 1 << 31;
+ else
+ b_info->cur_vcpus = (1 << def->vcpus) - 1;
if (def->clock.ntimers > 0 &&
def->clock.timers[0]->name == VIR_DOMAIN_TIMER_NAME_TSC) {
switch (def->clock.timers[0]->mode) {
--
1.7.3.1
13 years, 6 months
[libvirt] [PATCH] build: fix VIR_DEBUG on mingw
by Eric Blake
We don't use the gnulib vsnprintf replacement, which means that
on mingw, vsnprintf doesn't support %sn.
But as it turns out, VIR_GET_VAR_STR was a rather inefficient
reimplementation of virVasprintf.
* src/util/logging.c (VIR_GET_VAR_STR): Drop.
(virLogMessage): Inline a simpler version here.
* src/util/virterror.c (VIR_GET_VAR_STR, virRaiseErrorFull):
Likewise.
Reported by Matthias Bolte.
---
src/util/logging.c | 45 ++++++---------------------------------------
src/util/virterror.c | 44 +++++---------------------------------------
2 files changed, 11 insertions(+), 78 deletions(-)
diff --git a/src/util/logging.c b/src/util/logging.c
index 823e506..c86fcda 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -47,43 +47,6 @@
#define VIR_FROM_THIS VIR_FROM_NONE
/*
- * Macro used to format the message as a string in virLogMessage
- * and borrowed from libxml2 (also used in virRaiseError)
- */
-#define VIR_GET_VAR_STR(msg, str) { \
- int size, prev_size = -1; \
- int chars; \
- char *larger; \
- va_list ap; \
- \
- str = (char *) malloc(150); \
- if (str != NULL) { \
- \
- size = 150; \
- \
- while (1) { \
- va_start(ap, msg); \
- chars = vsnprintf(str, size, msg, ap); \
- va_end(ap); \
- if ((chars > -1) && (chars < size)) { \
- if (prev_size == chars) { \
- break; \
- } else { \
- prev_size = chars; \
- } \
- } \
- if (chars > -1) \
- size += chars + 1; \
- else \
- size += 100; \
- if ((larger = (char *) realloc(str, size)) == NULL) { \
- break; \
- } \
- str = larger; \
- }} \
-}
-
-/*
* A logging buffer to keep some history over logs
*/
@@ -729,6 +692,7 @@ void virLogMessage(const char *category, int priority, const char *funcname,
int len, fprio, i, ret;
int saved_errno = errno;
int emit = 1;
+ va_list ap;
if (!virLogInitialized)
virLogStartup();
@@ -753,9 +717,12 @@ void virLogMessage(const char *category, int priority, const char *funcname,
/*
* serialize the error message, add level and timestamp
*/
- VIR_GET_VAR_STR(fmt, str);
- if (str == NULL)
+ va_start(ap, fmt);
+ if (virVasprintf(&str, fmt, ap) < 0) {
+ va_end(ap);
goto cleanup;
+ }
+ va_end(ap);
gettimeofday(&cur_time, NULL);
localtime_r(&cur_time.tv_sec, &time_info);
diff --git a/src/util/virterror.c b/src/util/virterror.c
index 2d7309a..852ff9a 100644
--- a/src/util/virterror.c
+++ b/src/util/virterror.c
@@ -28,43 +28,6 @@ virErrorFunc virErrorHandler = NULL; /* global error handler */
void *virUserData = NULL; /* associated data */
virErrorLogPriorityFunc virErrorLogPriorityFilter = NULL;
-/*
- * Macro used to format the message as a string in virRaiseError
- * and borrowed from libxml2.
- */
-#define VIR_GET_VAR_STR(msg, str) { \
- int size, prev_size = -1; \
- int chars; \
- char *larger; \
- va_list ap; \
- \
- str = (char *) malloc(150); \
- if (str != NULL) { \
- \
- size = 150; \
- \
- while (1) { \
- va_start(ap, msg); \
- chars = vsnprintf(str, size, msg, ap); \
- va_end(ap); \
- if ((chars > -1) && (chars < size)) { \
- if (prev_size == chars) { \
- break; \
- } else { \
- prev_size = chars; \
- } \
- } \
- if (chars > -1) \
- size += chars + 1; \
- else \
- size += 100; \
- if ((larger = (char *) realloc(str, size)) == NULL) { \
- break; \
- } \
- str = larger; \
- }} \
-}
-
static virLogPriority virErrorLevelPriority(virErrorLevel level) {
switch (level) {
case VIR_ERR_NONE:
@@ -718,12 +681,15 @@ virRaiseErrorFull(const char *filename ATTRIBUTE_UNUSED,
}
/*
- * formats the message
+ * formats the message; drop message on OOM situations
*/
if (fmt == NULL) {
str = strdup(_("No error message provided"));
} else {
- VIR_GET_VAR_STR(fmt, str);
+ va_list ap;
+ va_start(ap, fmt);
+ virVasprintf(&str, fmt, ap);
+ va_end(ap);
}
/*
--
1.7.4.4
13 years, 6 months
[libvirt] [PATCH] Fix initialization of current vcpus in libxl driver
by Jim Fehlig
The cur_vcpus member of struct libxl_domain_build_info was incorrectly
initialized to the number of vcpus, when it should have been interpreted
as a bitmap, where bit X corresponds to online/offline status of vcpuX.
To complicate matters, cur_vcpus is an int, so only 32 vcpus can be
set online. Add a check to ensure vcpus does not exceed this limit.
---
src/libxl/libxl_conf.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 3cebf41..2e48356 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -379,11 +379,23 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config)
int hvm = STREQ(def->os.type, "hvm");
int i;
+ /* Currently, libxenlight only supports 32 vcpus per domain.
+ * cur_vcpus member of struct libxl_domain_build_info is defined
+ * as an int, but its' semantic is a bitmap of online vcpus, so
+ * only 32 can be represented.
+ */
+ if (def->maxvcpus > 32 || def->vcpus > 32) {
+ libxlError(VIR_ERR_INTERNAL_ERROR,
+ _("This version of libxenlight only supports 32 "
+ "vcpus per domain"));
+ return -1;
+ }
+
libxl_init_build_info(b_info, &d_config->c_info);
b_info->hvm = hvm;
b_info->max_vcpus = def->maxvcpus;
- b_info->cur_vcpus = def->vcpus;
+ b_info->cur_vcpus = (1 << def->vcpus) - 1;
if (def->clock.ntimers > 0 &&
def->clock.timers[0]->name == VIR_DOMAIN_TIMER_NAME_TSC) {
switch (def->clock.timers[0]->mode) {
--
1.7.3.1
13 years, 6 months
[libvirt] [PATCH] qemu: Don't change ownership of file when appending to it
by Michal Privoznik
Saving domain to previously created file changes also its ownership.
This is certainly not what users want if some conditions are met:
it is a regular, local file and dynamic_ownership is off.
---
src/qemu/qemu_driver.c | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index db299a2..4538cf3 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1963,6 +1963,8 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
bool is_reg = false;
unsigned long long offset;
int fd = -1;
+ uid_t uid = getuid();
+ gid_t gid = getgid();
memset(&header, 0, sizeof(header));
memcpy(header.magic, QEMUD_SAVE_MAGIC, sizeof(header.magic));
@@ -2013,6 +2015,14 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
is_reg = true;
} else {
is_reg = !!S_ISREG(sb.st_mode);
+ /* If the path is regular local file which exists
+ * already and dynamic_ownership is off, we don't
+ * want to change it's ownership, just append the data */
+ if (is_reg && !driver->dynamicOwnership &&
+ virStorageFileIsSharedFS(path) == 0) {
+ uid=sb.st_uid;
+ gid=sb.st_gid;
+ }
}
offset = sizeof(header) + header.xml_len;
@@ -2048,7 +2058,7 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
} else {
if ((fd = virFileOpenAs(path, O_CREAT|O_TRUNC|O_WRONLY,
S_IRUSR|S_IWUSR,
- getuid(), getgid(), 0)) < 0) {
+ uid, gid, 0)) < 0) {
/* If we failed as root, and the error was permission-denied
(EACCES or EPERM), assume it's on a network-connected share
where root access is restricted (eg, root-squashed NFS). If the
--
1.7.5.rc3
13 years, 6 months
[libvirt] API Proposal: virDomainBlockPull() V5
by Adam Litke
Changes since V4:
- Split out BlockPull() and BlockPullAll().
- BlockPull() cursor changed to a virDomainBlockPullInfo for progress
reporting only (from in/out to out-only parameter).
/* An iterator for initiating and monitoring block pull operations */
typedef unsigned long long virDomainBlockPullCursor;
typedef struct _virDomainBlockPullInfo virDomainBlockPullInfo;
struct _virDomainBlockPullInfo {
/*
* The following fields provide an indication of block pull progress. @cur
* indicates the current position and will be between 0 and @end. @end is
* the final cursor position for this operation and represents completion.
* To approximate progress, divide @cur by @end.
*/
virDomainBlockPullCursor cur;
virDomainBlockPullCursor end;
};
typedef virDomainBlockPullInfo *virDomainBlockPullInfoPtr;
/**
* virDomainBlockPull:
* @dom: pointer to domain object
* @path: Fully-qualified filename of disk
* @pos: A pointer to a virDomainBlockPullInfo structure, or NULL
* @flags: currently unused, for future extension
*
* Populate a disk image with data from its backing image. Once all data from
* its backing image has been pulled, the disk no longer depends on a backing
* image. This function works incrementally, performing a small amount of work
* each time it is called. When successful, @pos is updated with the current
* progress.
*
* Returns -1 in case of failure, 0 when successful.
*/
int virDomainBlockPull(virDomainPtr dom,
const char *path,
virDomainBlockPullInfoPtr *pos,
unsigned int flags);
/**
* virDomainBlockPullAll:
* @dom: pointer to domain object
* @path: Fully-qualified filename of disk
* @flags: currently unused, for future extension
*
* Populate a disk image with data from its backing image. Once all data from
* its backing image has been pulled, the disk no longer depends on a backing
* image. This function pulls data for the entire device in the background.
* Progress of the operation can be checked with virDomainGetBlockPullInfo() and
* the operation can be aborted with virDomainBlockPullAbort(). When finished,
* an asynchronous event is raised to indicate the final status.
*
* Returns 0 if the operation has started, -1 on failure.
*/
int virDomainBlockPullAll(virDomainPtr dom,
const char *path,
unsigned int flags);
/**
* virDomainBlockPullAbort:
* @dom: pointer to domain object
* @path: fully-qualified filename of disk
* @flags: currently unused, for future extension
*
* Cancel a pull operation previously started by virDomainBlockPullAll().
*
* Returns -1 in case of failure, 0 when successful.
*/
int virDomainBlockPullAbort(virDomainPtr dom,
const char *path,
unsigned int flags);
/**
* virDomainGetBlockPullInfo:
* @dom: pointer to domain object
* @path: fully-qualified filename of disk
* @info: pointer to a virDomainBlockPullInfo structure
* @flags: currently unused, for future extension
*
* Request progress information on a block pull operation that has been started
* with virDomainBlockPullAll(). If an operation is active for the given
* parameters, @info will be updated with the current progress.
*
* Returns -1 in case of failure, 0 when successful.
*/
int virDomainGetBlockPullInfo(virDomainPtr dom,
const char *path,
virDomainBlockStreamInfoPtr info,
unsigned int flags);
The following new asynchronous event will be made available for subscription:
VIR_DOMAIN_EVENT_ID_BLOCK_PULL = 7,
typedef enum {
VIR_DOMAIN_BLOCK_PULL_COMPLETED,
VIR_DOMAIN_BLOCK_PULL_FAILED,
} virConnectDomainEventBlockPullStatus;
typedef void (*virConnectDomainEventBlockPullCallback(virConnectPtr conn,
virDomainPtr dom,
const char *path,
int status);
Upon receipt of this event and when the status field indicates success, libvirt
will revoke access to the backing file which is no longer needed by the domain.
NOTE: Qemu will emit an asynchronous event (VIR_DOMAIN_BLOCK_PULL_COMPLETED)
after any operation that eliminates the dependency on the backing file. This
will allow libvirt to manage backing file security. If the operation failed,
an event (VIR_DOMAIN_BLOCK_PULL_FAILED) will indicate that the backing file has
not been removed.
--
Adam Litke
IBM Linux Technology Center
13 years, 6 months
[libvirt] [PATCH] qemu: fix typo in name - should be VHOST_NET, not VNET_HOST
by Laine Stump
---
configure.ac | 8 +++++---
src/qemu/qemu_capabilities.c | 2 +-
src/qemu/qemu_capabilities.h | 2 +-
src/qemu/qemu_command.c | 2 +-
tests/qemuhelptest.c | 8 ++++----
5 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index 80a13a1..b6f433b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -318,14 +318,16 @@ AC_ARG_WITH([init-script],
[AC_HELP_STRING([--with-init-script=@<:@redhat|auto|none@:>@],
[Style of init script to install @<:@default=auto@:>@])])
if test "x$with_init_script" = "x" || test "x$with_init_script" = "xauto"; then
- if test "$cross_compiling" = yes || test ! -f /etc/redhat-release; then
+ if test "$sysconfdir" != "/etc" || test "$cross_compiling" = yes \
+ || test ! -f /etc/redhat-release; then
with_init_script=none
else
with_init_script=redhat
fi
fi
-AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_RED_HAT], test x$with_init_script = xredhat)
-AC_MSG_RESULT($with_init_script)
+AM_CONDITIONAL([LIBVIRT_INIT_SCRIPT_RED_HAT],
+ [test x$with_init_script = xredhat])
+AC_MSG_RESULT([$with_init_script])
dnl RHEL-5 has a peculiar version of Xen, which requires some special casing
AC_ARG_WITH([rhel5-api],
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 71a54a5..8289141 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -983,7 +983,7 @@ qemuCapsComputeCmdFlags(const char *help,
qemuCapsSet(flags, QEMU_CAPS_VNET_HDR);
if (strstr(help, ",vhost=")) {
- qemuCapsSet(flags, QEMU_CAPS_VNET_HOST);
+ qemuCapsSet(flags, QEMU_CAPS_VHOST_NET);
}
/*
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index ab47f22..4c1ad63 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -66,7 +66,7 @@ enum qemuCapsFlags {
QEMU_CAPS_SMP_TOPOLOGY = 28, /* Is sockets=s,cores=c,threads=t available for -smp? */
QEMU_CAPS_NETDEV = 29, /* The -netdev flag & netdev_add/remove monitor commands */
QEMU_CAPS_RTC = 30, /* The -rtc flag for clock options */
- QEMU_CAPS_VNET_HOST = 31, /* vnet-host support is available in qemu */
+ QEMU_CAPS_VHOST_NET = 31, /* vhost-net support is available in qemu */
QEMU_CAPS_RTC_TD_HACK = 32, /* -rtc-td-hack available */
QEMU_CAPS_NO_HPET = 33, /* -no-hpet flag is supported */
QEMU_CAPS_NO_KVM_PIT = 34, /* -no-kvm-pit-reinjection supported */
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2828823..a4a7e8e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -320,7 +320,7 @@ qemuOpenVhostNet(virDomainDefPtr def,
/* If qemu doesn't support vhost-net mode (including the -netdev command
* option), don't try to open the device.
*/
- if (!(qemuCapsGet(qemuCaps, QEMU_CAPS_VNET_HOST) &&
+ if (!(qemuCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) &&
qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 2522396..71780d8 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -333,7 +333,7 @@ mymain(void)
QEMU_CAPS_DEVICE,
QEMU_CAPS_SMP_TOPOLOGY,
QEMU_CAPS_RTC,
- QEMU_CAPS_VNET_HOST,
+ QEMU_CAPS_VHOST_NET,
QEMU_CAPS_NO_KVM_PIT,
QEMU_CAPS_TDF,
QEMU_CAPS_PCI_CONFIGFD,
@@ -374,7 +374,7 @@ mymain(void)
QEMU_CAPS_DEVICE,
QEMU_CAPS_SMP_TOPOLOGY,
QEMU_CAPS_RTC,
- QEMU_CAPS_VNET_HOST,
+ QEMU_CAPS_VHOST_NET,
QEMU_CAPS_NO_HPET,
QEMU_CAPS_NO_KVM_PIT,
QEMU_CAPS_TDF,
@@ -415,7 +415,7 @@ mymain(void)
QEMU_CAPS_SMP_TOPOLOGY,
QEMU_CAPS_NETDEV,
QEMU_CAPS_RTC,
- QEMU_CAPS_VNET_HOST,
+ QEMU_CAPS_VHOST_NET,
QEMU_CAPS_NO_HPET,
QEMU_CAPS_NO_KVM_PIT,
QEMU_CAPS_TDF,
@@ -456,7 +456,7 @@ mymain(void)
QEMU_CAPS_DEVICE,
QEMU_CAPS_SMP_TOPOLOGY,
QEMU_CAPS_RTC,
- QEMU_CAPS_VNET_HOST,
+ QEMU_CAPS_VHOST_NET,
QEMU_CAPS_NO_KVM_PIT,
QEMU_CAPS_TDF,
QEMU_CAPS_PCI_CONFIGFD,
--
1.7.3.4
13 years, 6 months