[libvirt] [RFC Patch 0/3]virsh: Enable env support for virsh logging
by Supriya Kannery
Defining environment variables for debug log-level and log-file will avoid
specifying the same in each virsh command. Following is a patchset
for enabling env variable support for virsh logging.
Two new environment variables are defined:
a. VIRSH_DEBUG=<log_level>
log_level can be a value between 0 - 4, where
0 -> "ERROR"
1 -> "WARNING"
2 -> "NOTICE"
3 -> "INFO"
4 -> "DEBUG"
b. VIRSH_LOG_FILE=<logfile-path-and-name>
logfile-path-and-name is the name and complete path for the log file.
The above two variables are independent.
if log_level is specified without setting a log file name,
then, logs will be displayed in stdio.
If logfile-path-and-name specified without setting log_level,
then, default log_level (DEBUG) will be used to log to the specified file.
virsh commandline parameters (-l and -d) get precedence over environment
variables and will override respective env variable values.
1/3 - Use env variables to control virsh logging
2/3 - Change log level order to make "DEBUG" the superset
3/3 - Related changes to virsh manpage
13 years, 6 months
[libvirt] [PATCH v2] storage: List directory volumes for dir/fs/netfs pools
by Cole Robinson
Since directories can be used for <filesystem> passthrough, they are
basically storage volumes.
v2:
Skip ., .., lost+found dirs
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/storage/storage_backend.c | 44 +++++++++++++++++++++++++++++++------
src/storage/storage_backend.h | 7 +++++-
src/storage/storage_backend_fs.c | 14 ++++++++---
src/util/storage_file.c | 30 +++++++++++++++++++++++++-
4 files changed, 82 insertions(+), 13 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 02e455f..77095f2 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -994,6 +994,7 @@ virStorageBackendVolOpenCheckMode(const char *path, unsigned int flags)
{
int fd, mode = 0;
struct stat sb;
+ char *base = basename(path);
if ((fd = open(path, O_RDONLY|O_NONBLOCK|O_NOCTTY)) < 0) {
if ((errno == ENOENT || errno == ELOOP) &&
@@ -1022,9 +1023,21 @@ virStorageBackendVolOpenCheckMode(const char *path, unsigned int flags)
mode = VIR_STORAGE_VOL_OPEN_CHAR;
else if (S_ISBLK(sb.st_mode))
mode = VIR_STORAGE_VOL_OPEN_BLOCK;
+ else if (S_ISDIR(sb.st_mode)) {
+ mode = VIR_STORAGE_VOL_OPEN_DIR;
+
+ if (STREQ(base, ".") ||
+ STREQ(base, "..") ||
+ STREQ(base, "lost+found")) {
+ VIR_FORCE_CLOSE(fd);
+ VIR_INFO("Skipping special dir '%s'", base);
+ return -2;
+ }
+ }
if (!(mode & flags)) {
VIR_FORCE_CLOSE(fd);
+ VIR_INFO("Skipping volume '%s'", path);
if (mode & VIR_STORAGE_VOL_OPEN_ERROR) {
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
@@ -1047,11 +1060,13 @@ int virStorageBackendVolOpen(const char *path)
int
virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
unsigned long long *allocation,
- unsigned long long *capacity)
+ unsigned long long *capacity,
+ unsigned int openflags)
{
int ret, fd;
- if ((ret = virStorageBackendVolOpen(target->path)) < 0)
+ if ((ret = virStorageBackendVolOpenCheckMode(target->path,
+ openflags)) < 0)
return ret;
fd = ret;
@@ -1066,24 +1081,34 @@ virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
}
int
-virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
- int withCapacity)
+virStorageBackendUpdateVolInfoFlags(virStorageVolDefPtr vol,
+ int withCapacity,
+ unsigned int openflags)
{
int ret;
if ((ret = virStorageBackendUpdateVolTargetInfo(&vol->target,
- &vol->allocation,
- withCapacity ? &vol->capacity : NULL)) < 0)
+ &vol->allocation,
+ withCapacity ? &vol->capacity : NULL,
+ openflags)) < 0)
return ret;
if (vol->backingStore.path &&
(ret = virStorageBackendUpdateVolTargetInfo(&vol->backingStore,
- NULL, NULL)) < 0)
+ NULL, NULL,
+ VIR_STORAGE_VOL_OPEN_DEFAULT)) < 0)
return ret;
return 0;
}
+int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
+ int withCapacity)
+{
+ return virStorageBackendUpdateVolInfoFlags(vol, withCapacity,
+ VIR_STORAGE_VOL_OPEN_DEFAULT);
+}
+
/*
* virStorageBackendUpdateVolTargetInfoFD:
* @conn: connection to report errors on
@@ -1125,6 +1150,11 @@ virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
*/
if (capacity)
*capacity = sb.st_size;
+ } else if (S_ISDIR(sb.st_mode)) {
+ *allocation = 0;
+ if (capacity)
+ *capacity = 0;
+
} else {
off_t end;
/* XXX this is POSIX compliant, but doesn't work for CHAR files,
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index fcfbed0..67ac32c 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -93,6 +93,7 @@ enum {
VIR_STORAGE_VOL_OPEN_REG = 1 << 1, /* regular files okay */
VIR_STORAGE_VOL_OPEN_BLOCK = 1 << 2, /* block files okay */
VIR_STORAGE_VOL_OPEN_CHAR = 1 << 3, /* char files okay */
+ VIR_STORAGE_VOL_OPEN_DIR = 1 << 4, /* directories okay */
};
# define VIR_STORAGE_VOL_OPEN_DEFAULT (VIR_STORAGE_VOL_OPEN_ERROR |\
@@ -107,9 +108,13 @@ ATTRIBUTE_NONNULL(1);
int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
int withCapacity);
+int virStorageBackendUpdateVolInfoFlags(virStorageVolDefPtr vol,
+ int withCapacity,
+ unsigned int openflags);
int virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
unsigned long long *allocation,
- unsigned long long *capacity);
+ unsigned long long *capacity,
+ unsigned int openflags);
int virStorageBackendUpdateVolTargetInfoFD(virStorageVolTargetPtr target,
int fd,
unsigned long long *allocation,
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index b8d4d63..3f4d978 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -48,6 +48,11 @@
#define VIR_FROM_THIS VIR_FROM_STORAGE
+#define VIR_STORAGE_VOL_FS_OPEN_FLAGS (VIR_STORAGE_VOL_OPEN_DEFAULT |\
+ VIR_STORAGE_VOL_OPEN_DIR)
+#define VIR_STORAGE_VOL_FS_REFRESH_FLAGS (VIR_STORAGE_VOL_FS_OPEN_FLAGS &\
+ ~VIR_STORAGE_VOL_OPEN_ERROR)
+
static int ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
virStorageBackendProbeTarget(virStorageVolTargetPtr target,
char **backingStore,
@@ -65,7 +70,7 @@ virStorageBackendProbeTarget(virStorageVolTargetPtr target,
*encryption = NULL;
if ((ret = virStorageBackendVolOpenCheckMode(target->path,
- (VIR_STORAGE_VOL_OPEN_DEFAULT & ~VIR_STORAGE_VOL_OPEN_ERROR))) < 0)
+ VIR_STORAGE_VOL_FS_REFRESH_FLAGS)) < 0)
return ret; /* Take care to propagate ret, it is not always -1 */
fd = ret;
@@ -676,8 +681,8 @@ virStorageBackendFileSystemRefresh(virConnectPtr conn ATTRIBUTE_UNUSED,
vol->backingStore.format = backingStoreFormat;
if (virStorageBackendUpdateVolTargetInfo(&vol->backingStore,
- NULL,
- NULL) < 0) {
+ NULL, NULL,
+ VIR_STORAGE_VOL_OPEN_DEFAULT) < 0) {
/* The backing file is currently unavailable, the capacity,
* allocation, owner, group and mode are unknown. Just log the
* error an continue.
@@ -941,7 +946,8 @@ virStorageBackendFileSystemVolRefresh(virConnectPtr conn,
int ret;
/* Refresh allocation / permissions info in case its changed */
- ret = virStorageBackendUpdateVolInfo(vol, 0);
+ ret = virStorageBackendUpdateVolInfoFlags(vol, 0,
+ VIR_STORAGE_VOL_FS_OPEN_FLAGS);
if (ret < 0)
return ret;
diff --git a/src/util/storage_file.c b/src/util/storage_file.c
index ede79fa..8dbd933 100644
--- a/src/util/storage_file.c
+++ b/src/util/storage_file.c
@@ -24,6 +24,7 @@
#include <config.h>
#include "storage_file.h"
+#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#ifdef __linux__
@@ -736,6 +737,19 @@ virStorageFileProbeFormatFromFD(const char *path, int fd)
unsigned char *head;
ssize_t len = STORAGE_MAX_HEAD;
int ret = -1;
+ struct stat sb;
+
+ if (fstat(fd, &sb) < 0) {
+ virReportSystemError(errno,
+ _("cannot stat file '%s'"),
+ path);
+ return -1;
+ }
+
+ /* No header to probe for directories */
+ if (S_ISDIR(sb.st_mode)) {
+ return VIR_STORAGE_FILE_DIR;
+ }
if (VIR_ALLOC_N(head, len) < 0) {
virReportOOMError();
@@ -812,9 +826,10 @@ virStorageFileGetMetadataFromFD(const char *path,
int format,
virStorageFileMetadata *meta)
{
- unsigned char *head;
+ unsigned char *head = NULL;
ssize_t len = STORAGE_MAX_HEAD;
int ret = -1;
+ struct stat sb;
if (VIR_ALLOC_N(head, len) < 0) {
virReportOOMError();
@@ -823,6 +838,19 @@ virStorageFileGetMetadataFromFD(const char *path,
memset(meta, 0, sizeof (*meta));
+ if (fstat(fd, &sb) < 0) {
+ virReportSystemError(errno,
+ _("cannot stat file '%s'"),
+ path);
+ return -1;
+ }
+
+ /* No header to probe for directories */
+ if (S_ISDIR(sb.st_mode)) {
+ ret = 0;
+ goto cleanup;
+ }
+
if (lseek(fd, 0, SEEK_SET) == (off_t)-1) {
virReportSystemError(errno, _("cannot seek to start of '%s'"), path);
goto cleanup;
--
1.7.4.4
13 years, 6 months
[libvirt] Modules executed during Live Migration of Virtual machines
by prakash hr
Hi,
I am trying to write the patch file for live migration which uses UDP as the
transport protocol.
---So I prepare to edit the existing API which uses the TCP as the transport
protocol for the migration.I want to know the modules executing during live
migration in current libvirt.(I m using ubuntu10.10 as the guest and
suitable latest version of libvirt)
----If any document which clearly shows the actual migration process. I mean
which are the functions called during live migration and how the data flow
occurs between the two physical machines or the hypervisor.
--In LAN the UDP can be used for the live migration as the loss of packets
and collision of packets are negligibly less.
--Even RUDP can also be used instead of TCP, as RUDP is reliable.
--The complete set of the code which responsible for live migration is
required where I can get that..?
Thanks and Regards
Prakash H.R
M.Tech Student at RVCE, Bangalore
+91-8904301073
13 years, 6 months
Re: [libvirt] [Bug 702602] [PATCH] OpenVZ configuration files parsing
by Taisuke Yamada
Hi.
As reported by Diego Blanco in
- https://bugzilla.redhat.com/show_bug.cgi?id=702602
commit f0443765 which replaced openvz_readline to getline(3)
broke OpenVZ driver as it changed semantics of EOF-handling
when parsing OpenVZ configuration.
There're several other issues reported with current OpenVZ driver:
#1: unclear error message when parsing "CPUS=" line
#2: openvz driver goes into crashing loop
#3: "NETIF=" line in configuration is not parsed correctly
#4: aborts even when optional parameter is missing
#5: there's a potential memory leak
In this email, I'm sending in updated patch to fix #[145].
This patch does not fix #[23] as I haven't verified these yet,
but this at least got me to run OpenVZ on libvirt once again.
This patch applies to latest git, and I verified that both
"make check" and "make syntax-check" passes (except
for check_author_list check).
Best Regards,
> --- Comment #3 from Cole Robinson <crobinso(a)redhat.com> 2011-05-18 09:34:21 EDT ---
> Thanks for the report and the patch. However, libvirt devs generally don't
> review patches in bugzilla. Can you please send your patch to
> libvirt-list(a)redhat.com, and ensure that it applied against latest upstream,
> and that make check and make syntax-check both pass?
>
> When the patch is applied, we can close this bug. Thanks!
>
> --
> Configure bugmail: https://bugzilla.redhat.com/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
>
13 years, 6 months
[libvirt] [PATCH] audit: fix minor off-by-one
by Eric Blake
Coverity spotted this off-by-one. Thankfully, no one in libvirt
was ever calling virAuditSend with an argument of 3.
* src/util/virtaudit.c (virAuditSend): Use correct comparison.
---
src/util/virtaudit.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virtaudit.c b/src/util/virtaudit.c
index 2f1a529..560f7b7 100644
--- a/src/util/virtaudit.c
+++ b/src/util/virtaudit.c
@@ -1,7 +1,7 @@
/*
* virtaudit.c: auditing support
*
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -123,7 +123,7 @@ void virAuditSend(const char *file ATTRIBUTE_UNUSED, const char *func,
[VIR_AUDIT_RECORD_RESOURCE] = AUDIT_VIRT_RESOURCE,
};
- if (type > ARRAY_CARDINALITY(record_types) || record_types[type] == 0)
+ if (type >= ARRAY_CARDINALITY(record_types) || record_types[type] == 0)
VIR_WARN("Unknown audit record type %d", type);
else if (audit_log_user_message(auditfd, record_types[type], str, NULL,
clientaddr, clienttty, success) < 0) {
--
1.7.4.4
13 years, 6 months
[libvirt] [PATCH] qemu: allow blkstat/blkinfo calls during migration
by Federico Simoncelli
References:
- https://www.redhat.com/archives/libvir-list/2011-May/msg00210.html
- https://www.redhat.com/archives/libvir-list/2011-May/msg00287.html
---
src/qemu/qemu_domain.c | 6 +++
src/qemu/qemu_domain.h | 7 ++++
src/qemu/qemu_driver.c | 86 +++++++++++++++++++++++++++++++--------------
src/qemu/qemu_migration.c | 31 ++++++++++++++++
4 files changed, 103 insertions(+), 27 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c61f9bf..d4e53c4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -526,6 +526,12 @@ int qemuDomainObjBeginJob(virDomainObjPtr obj)
priv->jobStart = timeval_to_ms(now);
memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
+ if (virCondInit(&priv->signalCond) < 0) {
+ virReportSystemError(errno,
+ "%s", _("cannot initialize signal condition"));
+ return -1;
+ }
+
return 0;
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 6d24f53..b82986c 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -47,11 +47,17 @@ enum qemuDomainJobSignals {
QEMU_JOB_SIGNAL_SUSPEND = 1 << 1, /* Request VM suspend to finish live migration offline */
QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME = 1 << 2, /* Request migration downtime change */
QEMU_JOB_SIGNAL_MIGRATE_SPEED = 1 << 3, /* Request migration speed change */
+ QEMU_JOB_SIGNAL_BLKSTAT = 1 << 4, /* Request blkstat during migration */
+ QEMU_JOB_SIGNAL_BLKINFO = 1 << 5, /* Request blkinfo during migration */
};
struct qemuDomainJobSignalsData {
unsigned long long migrateDowntime; /* Data for QEMU_JOB_SIGNAL_MIGRATE_DOWNTIME */
unsigned long migrateBandwidth; /* Data for QEMU_JOB_SIGNAL_MIGRATE_SPEED */
+ char *devname; /* Device name used by blkstat/blkinfo calls */
+ int returnCode; /* Return code for the blkstat/blkinfo calls */
+ virDomainBlockStatsPtr blockStat; /* Block statistics for QEMU_JOB_SIGNAL_BLKSTAT */
+ virDomainBlockInfoPtr blockInfo; /* Block information for QEMU_JOB_SIGNAL_BLKINFO */
};
typedef struct _qemuDomainPCIAddressSet qemuDomainPCIAddressSet;
@@ -61,6 +67,7 @@ typedef struct _qemuDomainObjPrivate qemuDomainObjPrivate;
typedef qemuDomainObjPrivate *qemuDomainObjPrivatePtr;
struct _qemuDomainObjPrivate {
virCond jobCond; /* Use in conjunction with main virDomainObjPtr lock */
+ virCond signalCond; /* Use in conjunction with main virDomainObjPtr lock */
enum qemuDomainJob jobActive; /* Currently running job */
unsigned int jobSignals; /* Signals for running job */
struct qemuDomainJobSignalsData jobSignalsData; /* Signal specific data */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0fd0f10..f9f5e83 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5031,13 +5031,10 @@ qemudDomainBlockStats (virDomainPtr dom,
goto cleanup;
}
- if (qemuDomainObjBeginJob(vm) < 0)
- goto cleanup;
-
if (!virDomainObjIsActive(vm)) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
- goto endjob;
+ goto cleanup;
}
for (i = 0 ; i < vm->def->ndisks ; i++) {
@@ -5050,29 +5047,48 @@ qemudDomainBlockStats (virDomainPtr dom,
if (!disk) {
qemuReportError(VIR_ERR_INVALID_ARG,
_("invalid path: %s"), path);
- goto endjob;
+ goto cleanup;
}
if (!disk->info.alias) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("missing disk device alias name for %s"), disk->dst);
- goto endjob;
+ goto cleanup;
}
priv = vm->privateData;
- qemuDomainObjEnterMonitor(vm);
- ret = qemuMonitorGetBlockStatsInfo(priv->mon,
- disk->info.alias,
- &stats->rd_req,
- &stats->rd_bytes,
- &stats->wr_req,
- &stats->wr_bytes,
- &stats->errs);
- qemuDomainObjExitMonitor(vm);
+ if ((priv->jobActive == QEMU_JOB_MIGRATION_OUT)
+ || (priv->jobActive == QEMU_JOB_SAVE)) {
-endjob:
- if (qemuDomainObjEndJob(vm) == 0)
- vm = NULL;
+ while (priv->jobSignals)
+ ignore_value(virCondWait(&priv->signalCond, &vm->lock));
+
+ priv->jobSignals |= QEMU_JOB_SIGNAL_BLKSTAT;
+ priv->jobSignalsData.devname = disk->info.alias;
+ priv->jobSignalsData.blockStat = stats;
+ priv->jobSignalsData.returnCode = -1;
+
+ while (priv->jobSignals & QEMU_JOB_SIGNAL_BLKSTAT)
+ ignore_value(virCondWait(&priv->signalCond, &vm->lock));
+
+ ret = priv->jobSignalsData.returnCode;
+ } else {
+ if (qemuDomainObjBeginJob(vm) < 0)
+ goto cleanup;
+
+ qemuDomainObjEnterMonitor(vm);
+ ret = qemuMonitorGetBlockStatsInfo(priv->mon,
+ disk->info.alias,
+ &stats->rd_req,
+ &stats->rd_bytes,
+ &stats->wr_req,
+ &stats->wr_bytes,
+ &stats->errs);
+ qemuDomainObjExitMonitor(vm);
+
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
+ }
cleanup:
if (vm)
@@ -5473,23 +5489,39 @@ static int qemuDomainGetBlockInfo(virDomainPtr dom,
disk format and on a block device, then query
highest allocated extent from QEMU */
if (disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK &&
- format != VIR_STORAGE_FILE_RAW &&
- S_ISBLK(sb.st_mode)) {
+ format != VIR_STORAGE_FILE_RAW && S_ISBLK(sb.st_mode)) {
qemuDomainObjPrivatePtr priv = vm->privateData;
- if (qemuDomainObjBeginJob(vm) < 0)
- goto cleanup;
- if (!virDomainObjIsActive(vm))
+
+ if (!virDomainObjIsActive(vm)) {
ret = 0;
- else {
+ } else if ((priv->jobActive == QEMU_JOB_MIGRATION_OUT)
+ || (priv->jobActive == QEMU_JOB_SAVE)) {
+
+ while (priv->jobSignals)
+ ignore_value(virCondWait(&priv->signalCond, &vm->lock));
+
+ priv->jobSignals |= QEMU_JOB_SIGNAL_BLKINFO;
+ priv->jobSignalsData.devname = disk->info.alias;
+ priv->jobSignalsData.blockInfo = info;
+ priv->jobSignalsData.returnCode = -1;
+
+ while (priv->jobSignals & QEMU_JOB_SIGNAL_BLKINFO)
+ ignore_value(virCondWait(&priv->signalCond, &vm->lock));
+
+ ret = priv->jobSignalsData.returnCode;
+ } else {
+ if (qemuDomainObjBeginJob(vm) < 0)
+ goto cleanup;
+
qemuDomainObjEnterMonitor(vm);
ret = qemuMonitorGetBlockExtent(priv->mon,
disk->info.alias,
&info->allocation);
qemuDomainObjExitMonitor(vm);
- }
- if (qemuDomainObjEndJob(vm) == 0)
- vm = NULL;
+ if (qemuDomainObjEndJob(vm) == 0)
+ vm = NULL;
+ }
} else {
ret = 0;
}
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 6738a53..54e41f9 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -156,6 +156,34 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
qemuDomainObjExitMonitorWithDriver(driver, vm);
if (rc < 0)
VIR_WARN0("Unable to set migration speed");
+ } else if (priv->jobSignals & QEMU_JOB_SIGNAL_BLKSTAT) {
+ qemuDomainObjEnterMonitorWithDriver(driver, vm);
+ rc = qemuMonitorGetBlockStatsInfo(priv->mon,
+ priv->jobSignalsData.devname,
+ &priv->jobSignalsData.blockStat->rd_req,
+ &priv->jobSignalsData.blockStat->rd_bytes,
+ &priv->jobSignalsData.blockStat->wr_req,
+ &priv->jobSignalsData.blockStat->wr_bytes,
+ &priv->jobSignalsData.blockStat->errs);
+ qemuDomainObjExitMonitorWithDriver(driver, vm);
+
+ priv->jobSignalsData.returnCode = rc;
+ priv->jobSignals ^= QEMU_JOB_SIGNAL_BLKSTAT;
+
+ if (rc < 0)
+ VIR_WARN0("Unable to get block statistics");
+ } else if (priv->jobSignals & QEMU_JOB_SIGNAL_BLKINFO) {
+ qemuDomainObjEnterMonitorWithDriver(driver, vm);
+ rc = qemuMonitorGetBlockExtent(priv->mon,
+ priv->jobSignalsData.devname,
+ &priv->jobSignalsData.blockInfo->allocation);
+ qemuDomainObjExitMonitorWithDriver(driver, vm);
+
+ priv->jobSignalsData.returnCode = rc;
+ priv->jobSignals ^= QEMU_JOB_SIGNAL_BLKINFO;
+
+ if (rc < 0)
+ VIR_WARN0("Unable to get block information");
}
/* Repeat check because the job signals might have caused
@@ -223,6 +251,8 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
break;
}
+ virCondSignal(&priv->signalCond);
+
virDomainObjUnlock(vm);
qemuDriverUnlock(driver);
@@ -233,6 +263,7 @@ qemuMigrationWaitForCompletion(struct qemud_driver *driver, virDomainObjPtr vm)
}
cleanup:
+ virCondBroadcast(&priv->signalCond);
return ret;
}
--
1.7.1
13 years, 6 months
[libvirt] [PATCHv2 0/7] interface: new public API for network config change transactions
by Laine Stump
(I'm sending v2 of this patch series for Michal Privoznik, as I had to
tweak some things while integrating with the netcf part that I'm
writing, and he will be out of the office tomorrow and thus unable to
resend. In addition to the few small things I needed to change to make
everything compile and work properly once the build system had a
version of netcf supporting the new API, Michal incorporated all the
comments from reviewers of the first version before forwarding the
patches to me for integration.)
This patch series implements three new APIs for the interface
driver which support transactional changes to the host's network
config - at any point you can begin a transaction (which saves a
snapshot of the current config), then make any changes you like to the
config, and later either commit those changes (the current
implementation just removes the snapshotted files) or rollback to the
original config.
The actual implementation of this functionality lives in the netcf
library; these patches create pass-through functions that call out to
netcf on the machine that's running libvirtd.
Most importantly, note that uses of "start" in the API names have been
changed to "begin", and rather than a single virsh command with
multiple subcommands, there are now three separate commands:
iface-begin, iface-commit, and iface-rollback.
Thanks to using AC_CHECK_LIB in configure.ac, this code can safely be
pushed and built on systems that don't yet have a new enough netcf to
contain the API extensions - those functions are simply not
implemented in that case (and return the appropriate error).
13 years, 6 months
[libvirt] [PATCH] Fix modifying disk devices in qemu driver
by Markus Groß
When modifying the disk devices of a live domain and the domain
configuration, the function qemuDomainAttachDeviceConfig
first sets dev->data->disk to NULL. Later qemuDomainAttachDeviceLive
accesses dev->data.disk and causes a segfault.
---
src/qemu/qemu_driver.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b8d9c92..55e6314 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4278,12 +4278,13 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
"%s", _("cannot modify device on transient domain"));
goto endjob;
}
- dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
- VIR_DOMAIN_XML_INACTIVE);
- if (dev == NULL)
- goto endjob;
if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
+ dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
+ VIR_DOMAIN_XML_INACTIVE);
+ if (dev == NULL)
+ goto endjob;
+
/* Make a copy for updated domain. */
vmdef = virDomainObjCopyPersistentDef(driver->caps, vm);
if (!vmdef)
@@ -4307,6 +4308,11 @@ qemuDomainModifyDeviceFlags(virDomainPtr dom, const char *xml,
ret = 0;
if (!ret && (flags & VIR_DOMAIN_DEVICE_MODIFY_LIVE)) {
+ dev = virDomainDeviceDefParse(driver->caps, vm->def, xml,
+ VIR_DOMAIN_XML_INACTIVE);
+ if (dev == NULL)
+ goto endjob;
+
switch (action) {
case QEMU_DEVICE_ATTACH:
ret = qemuDomainAttachDeviceLive(vm, dev, dom);
--
1.7.5.1
13 years, 6 months
[libvirt] [PATCH] schema: Add graphics element passwdValidTo attribute to schema
by Michal Privoznik
We support this in code, but forgot to add this to RNG schema as well.
According to documentation, the value match the dateTime type.
---
docs/schemas/domain.rng | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 1ae5b36..c270815 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -1222,6 +1222,11 @@
<text/>
</attribute>
</optional>
+ <optional>
+ <attribute name="passwdValidTo">
+ <data type="dateTime"/>
+ </attribute>
+ </optional>
</group>
<group>
<attribute name="type">
@@ -1260,6 +1265,11 @@
<text/>
</attribute>
</optional>
+ <optional>
+ <attribute name="passwdValidTo">
+ <data type="dateTime"/>
+ </attribute>
+ </optional>
<interleave>
<zeroOrMore>
<element name="channel">
--
1.7.5.rc3
13 years, 6 months
[libvirt] [PATCH] tests: Add more complex domain scheme test data
by Michal Privoznik
---
tests/domainschemadata/domain-complex-1.xml | 87 +++++++++++++++++++++++++++
1 files changed, 87 insertions(+), 0 deletions(-)
create mode 100644 tests/domainschemadata/domain-complex-1.xml
diff --git a/tests/domainschemadata/domain-complex-1.xml b/tests/domainschemadata/domain-complex-1.xml
new file mode 100644
index 0000000..542181c
--- /dev/null
+++ b/tests/domainschemadata/domain-complex-1.xml
@@ -0,0 +1,87 @@
+<domain type='kvm'>
+ <name>f14</name>
+ <uuid>553effab-b5e1-2d80-dfe3-da4344826c43</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type arch='x86_64' machine='pc-0.13'>hvm</type>
+ <boot dev='cdrom'/>
+ <boot dev='hd'/>
+ <bootmenu enable='yes'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <pae/>
+ </features>
+ <cpu match='exact'>
+ <model>Westmere</model>
+ <vendor>Intel</vendor>
+ <feature policy='require' name='tm2'/>
+ <feature policy='require' name='est'/>
+ <feature policy='require' name='monitor'/>
+ <feature policy='require' name='ss'/>
+ <feature policy='require' name='vme'/>
+ <feature policy='require' name='rdtscp'/>
+ <feature policy='require' name='ht'/>
+ <feature policy='require' name='ds'/>
+ <feature policy='require' name='pbe'/>
+ <feature policy='require' name='tm'/>
+ <feature policy='require' name='vmx'/>
+ <feature policy='require' name='ds_cpl'/>
+ <feature policy='require' name='xtpr'/>
+ <feature policy='require' name='acpi'/>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/libvirt/images/f14.img'/>
+ <target dev='vda' bus='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source file='/var/lib/libvirt/Fedora-14-x86_64-Live-KDE.iso'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ <address type='drive' controller='0' bus='1' unit='0'/>
+ </disk>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+ </controller>
+ <controller type='virtio-serial' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+ </controller>
+ <interface type='network'>
+ <mac address='52:54:00:71:70:89'/>
+ <source network='default'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+ </interface>
+ <serial type='pty'>
+ <target port='0'/>
+ </serial>
+ <console type='pty'>
+ <target type='serial' port='0'/>
+ </console>
+ <input type='tablet' bus='usb'/>
+ <input type='mouse' bus='ps2'/>
+ <graphics type='spice' port='-1' autoport='yes' passwdValidTo="2010-04-09T15:51:00"/>
+ <sound model='ac97'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </sound>
+ <video>
+ <model type='vga' vram='9216' heads='1'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </video>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
+
--
1.7.5.rc3
13 years, 6 months