[libvirt] [PATCH] LXC: check whether we get MemSwap[Total|Usage]
by Chen Hanxiao
Signed-off-by: Chen Hanxiao <chenhanxiao(a)cn.fujitsu.com>
---
src/lxc/lxc_cgroup.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index 8dfdc60..39e30ad 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -288,8 +288,11 @@ int virLXCCgroupGetMeminfo(virLXCMeminfoPtr meminfo)
if (virLXCCgroupGetMemUsage(cgroup, meminfo) < 0)
goto cleanup;
- virLXCCgroupGetMemSwapTotal(cgroup, meminfo);
- virLXCCgroupGetMemSwapUsage(cgroup, meminfo);
+ if (virLXCCgroupGetMemSwapTotal(cgroup, meminfo) < 0)
+ goto cleanup;
+
+ if (virLXCCgroupGetMemSwapUsage(cgroup, meminfo) < 0)
+ goto cleanup;
ret = 0;
cleanup:
--
1.9.0
10 years, 5 months
[libvirt] [PATCH] LXC: update comments of lxcDomainCreateXMLWithFiles() and lxcDomainCreateXML()
by Wangrui (K)
update comments of lxcDomainCreateXMLWithFiles() and lxcDomainCreateXML()
Signed-off-by: Yue wenyuan <yuewenyuan(a)huawei.com>
Signed-off-by: Wang Rui <moon.wangrui(a)huawei.com>
---
src/lxc/lxc_driver.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 06f3e18..11bfb80 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1122,14 +1122,16 @@ static int lxcDomainCreateWithFlags(virDomainPtr dom,
}
/**
- * lxcDomainCreateXML:
+ * lxcDomainCreateXMLWithFiles:
* @conn: pointer to connection
+ * @nfiles: number of file descriptors passed
+ * @files: list of file descriptors passed
* @xml: XML definition of domain
* @flags: Must be 0 for now
*
* Creates a domain based on xml and starts it
*
- * Returns 0 on success or -1 in case of error
+ * Returns a new domain object or NULL in case of failure.
*/
static virDomainPtr
lxcDomainCreateXMLWithFiles(virConnectPtr conn,
@@ -1209,7 +1211,16 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn,
return dom;
}
-
+/**
+ * lxcDomainCreateXML:
+ * @conn: pointer to connection
+ * @xml: XML definition of domain
+ * @flags: Must be 0 for now
+ *
+ * Creates a domain based on xml and starts it
+ *
+ * Returns a new domain object or NULL in case of failure.
+ */
static virDomainPtr
lxcDomainCreateXML(virConnectPtr conn,
const char *xml,
--
1.7.12.4
10 years, 5 months
[libvirt] libvirt domblkstat result is quite different from the info acquired from "/proc/[pid]/io"
by coperd
Hi, all. I’m current doing monitoring jobs(CPU, memory and disk utilisation) on some KVM-based VMs using libvirt, but i came to some confusions.
For the disk data(blkstat), I find that the results acquired by virDomainBlockStats is not consistent with the value read from /proc/[vm_pid]/io(i only
care “rd_bytes" and “wr_bytes"), since libvirt doesn’t support host level monitoring, i have to calculate the host’s disk utilisation by using the /proc/diskstats. The weird thing
is that individual VM’s disk data can be greater that the total disk’s during some sampling time. Can someone explain this ?
10 years, 5 months
[libvirt] [PATCH libvirt] xen: handle root= in xen-xm configuration files.
by Ian Campbell
In addition to extra= xm supported a root= option which was supposed
to be incorporated into the final command line. Handle that for "virsh
domxml-from-native xen-xm". Tested with the libxl backend.
Signed-off-by: Ian Campbell <ian.campbell(a)citrix.com>
---
.gnulib | 2 +-
src/xenxs/xen_xm.c | 14 +++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/.gnulib b/.gnulib
index d55899f..e8e0eb6 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit d55899fd2c5794ac85ecb14d5e2f646a89e4b4dd
+Subproject commit e8e0eb6bfb728685ec8d5afd924e41b18e9d928d
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index b2db97d..2cd6d4c 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -339,6 +339,8 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
def->os.nBootDevs++;
}
} else {
+ const char *extra, *root;
+
if (xenXMConfigCopyStringOpt(conf, "bootloader", &def->os.bootloader) < 0)
goto cleanup;
if (xenXMConfigCopyStringOpt(conf, "bootargs", &def->os.bootloaderArgs) < 0)
@@ -348,8 +350,18 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
goto cleanup;
if (xenXMConfigCopyStringOpt(conf, "ramdisk", &def->os.initrd) < 0)
goto cleanup;
- if (xenXMConfigCopyStringOpt(conf, "extra", &def->os.cmdline) < 0)
+ if (xenXMConfigGetString(conf, "extra", &extra, NULL) < 0)
+ goto cleanup;
+ if (xenXMConfigGetString(conf, "root", &root, NULL) < 0)
goto cleanup;
+
+ if (root) {
+ if (virAsprintf(&def->os.cmdline, "root=%s %s", root, extra) < 0)
+ goto cleanup;
+ } else {
+ if (VIR_STRDUP(def->os.cmdline, extra) < 0)
+ goto cleanup;
+ }
}
if (xenXMConfigGetULongLong(conf, "memory", &def->mem.cur_balloon,
--
1.7.10.4
10 years, 5 months
[libvirt] [PATCH 1/2] qemu: enum cleanups in "src/qemu/*"
by Julio Faracco
As we are doing with the enum structures, a cleanup in "src/qemu/"
directory was done now. All the enums that were defined in the
header files were converted to typedefs in this directory. This
patch includes all the adjustments to remove conflicts when you do
this kind of change. "Enum-to-typedef"'s conversions were made in
"src/qemu/qemu_{capabilities, domain, migration, hotplug}.h".
Signed-off-by: Julio Faracco <jcfaracco(a)gmail.com>
---
src/qemu/qemu_capabilities.c | 8 ++++----
src/qemu/qemu_capabilities.h | 10 +++++-----
src/qemu/qemu_domain.c | 28 ++++++++++++++--------------
src/qemu/qemu_domain.h | 24 ++++++++++++------------
src/qemu/qemu_driver.c | 8 ++++----
src/qemu/qemu_hotplug.c | 2 +-
src/qemu/qemu_hotplug.h | 2 +-
src/qemu/qemu_migration.c | 24 ++++++++++++------------
src/qemu/qemu_migration.h | 14 +++++++-------
src/qemu/qemu_process.c | 8 ++++----
src/qemu/qemu_process.h | 4 ++--
11 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 08c3d04..a50ca41 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1886,7 +1886,7 @@ void virQEMUCapsDispose(void *obj)
void
virQEMUCapsSet(virQEMUCapsPtr qemuCaps,
- enum virQEMUCapsFlags flag)
+ virQEMUCapsFlags flag)
{
ignore_value(virBitmapSetBit(qemuCaps->flags, flag));
}
@@ -1907,7 +1907,7 @@ virQEMUCapsSetList(virQEMUCapsPtr qemuCaps, ...)
void
virQEMUCapsClear(virQEMUCapsPtr qemuCaps,
- enum virQEMUCapsFlags flag)
+ virQEMUCapsFlags flag)
{
ignore_value(virBitmapClearBit(qemuCaps->flags, flag));
}
@@ -1921,7 +1921,7 @@ char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps)
bool
virQEMUCapsGet(virQEMUCapsPtr qemuCaps,
- enum virQEMUCapsFlags flag)
+ virQEMUCapsFlags flag)
{
bool b;
@@ -2279,7 +2279,7 @@ virQEMUCapsProbeQMPCPUDefinitions(virQEMUCapsPtr qemuCaps,
struct tpmTypeToCaps {
int type;
- enum virQEMUCapsFlags caps;
+ virQEMUCapsFlags caps;
};
static const struct tpmTypeToCaps virQEMUCapsTPMTypesToCaps[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d755caa..53ebe90 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -30,7 +30,7 @@
# include "qemu_monitor.h"
/* Internal flags to keep track of qemu command line capabilities */
-enum virQEMUCapsFlags {
+typedef enum {
QEMU_CAPS_KQEMU = 0, /* Whether KQEMU is compiled in */
QEMU_CAPS_VNC_COLON = 1, /* VNC takes or address + display */
QEMU_CAPS_NO_REBOOT = 2, /* Is the -no-reboot flag available */
@@ -208,7 +208,7 @@ enum virQEMUCapsFlags {
QEMU_CAPS_MSG_TIMESTAMP = 167, /* -msg timestamp */
QEMU_CAPS_LAST, /* this must always be the last item */
-};
+} virQEMUCapsFlags;
typedef struct _virQEMUCaps virQEMUCaps;
typedef virQEMUCaps *virQEMUCapsPtr;
@@ -231,15 +231,15 @@ int virQEMUCapsProbeQMP(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon);
void virQEMUCapsSet(virQEMUCapsPtr qemuCaps,
- enum virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1);
+ virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1);
void virQEMUCapsSetList(virQEMUCapsPtr qemuCaps, ...) ATTRIBUTE_NONNULL(1);
void virQEMUCapsClear(virQEMUCapsPtr qemuCaps,
- enum virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1);
+ virQEMUCapsFlags flag) ATTRIBUTE_NONNULL(1);
bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps,
- enum virQEMUCapsFlags flag);
+ virQEMUCapsFlags flag);
bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
virDomainDefPtr def);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e40c5ec..fcbff29 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -76,7 +76,7 @@ VIR_ENUM_IMPL(qemuDomainAsyncJob, QEMU_ASYNC_JOB_LAST,
const char *
-qemuDomainAsyncJobPhaseToString(enum qemuDomainAsyncJob job,
+qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
int phase ATTRIBUTE_UNUSED)
{
switch (job) {
@@ -96,7 +96,7 @@ qemuDomainAsyncJobPhaseToString(enum qemuDomainAsyncJob job,
}
int
-qemuDomainAsyncJobPhaseFromString(enum qemuDomainAsyncJob job,
+qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
const char *phase)
{
if (!phase)
@@ -205,7 +205,7 @@ qemuDomainObjFreeJob(qemuDomainObjPrivatePtr priv)
}
static bool
-qemuDomainTrackJob(enum qemuDomainJob job)
+qemuDomainTrackJob(qemuDomainJob job)
{
return (QEMU_DOMAIN_TRACK_JOBS & JOB_MASK(job)) != 0;
}
@@ -278,7 +278,7 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
{
qemuDomainObjPrivatePtr priv = data;
const char *monitorpath;
- enum qemuDomainJob job;
+ qemuDomainJob job;
/* priv->monitor_chr is set only for qemu */
if (priv->monConfig) {
@@ -1033,13 +1033,13 @@ qemuDomainObjReleaseAsyncJob(virDomainObjPtr obj)
}
static bool
-qemuDomainNestedJobAllowed(qemuDomainObjPrivatePtr priv, enum qemuDomainJob job)
+qemuDomainNestedJobAllowed(qemuDomainObjPrivatePtr priv, qemuDomainJob job)
{
return !priv->job.asyncJob || (priv->job.mask & JOB_MASK(job)) != 0;
}
bool
-qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv, enum qemuDomainJob job)
+qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv, qemuDomainJob job)
{
return !priv->job.active && qemuDomainNestedJobAllowed(priv, job);
}
@@ -1053,8 +1053,8 @@ qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv, enum qemuDomainJob job)
static int ATTRIBUTE_NONNULL(1)
qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainJob job,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainJob job,
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
unsigned long long now;
@@ -1170,7 +1170,7 @@ qemuDomainObjBeginJobInternal(virQEMUDriverPtr driver,
*/
int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainJob job)
+ qemuDomainJob job)
{
if (qemuDomainObjBeginJobInternal(driver, obj, job,
QEMU_ASYNC_JOB_NONE) < 0)
@@ -1181,7 +1181,7 @@ int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
if (qemuDomainObjBeginJobInternal(driver, obj, QEMU_JOB_ASYNC,
asyncJob) < 0)
@@ -1193,7 +1193,7 @@ int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
static int ATTRIBUTE_RETURN_CHECK
qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
@@ -1226,7 +1226,7 @@ qemuDomainObjBeginNestedJob(virQEMUDriverPtr driver,
bool qemuDomainObjEndJob(virQEMUDriverPtr driver, virDomainObjPtr obj)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
- enum qemuDomainJob job = priv->job.active;
+ qemuDomainJob job = priv->job.active;
priv->jobs_queued--;
@@ -1285,7 +1285,7 @@ qemuDomainObjAbortAsyncJob(virDomainObjPtr obj)
static int
qemuDomainObjEnterMonitorInternal(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = obj->privateData;
@@ -1378,7 +1378,7 @@ void qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
int
qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
return qemuDomainObjEnterMonitorInternal(driver, obj, asyncJob);
}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 8615f74..8bf3d69 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -67,7 +67,7 @@
/* Only 1 job is allowed at any time
* A job includes *all* monitor commands, even those just querying
* information, not merely actions */
-enum qemuDomainJob {
+typedef enum {
QEMU_JOB_NONE = 0, /* Always set to 0 for easy if (jobActive) conditions */
QEMU_JOB_QUERY, /* Doesn't change any state */
QEMU_JOB_DESTROY, /* Destroys the domain (cannot be masked out) */
@@ -81,14 +81,14 @@ enum qemuDomainJob {
QEMU_JOB_ASYNC_NESTED, /* Normal job within an async job */
QEMU_JOB_LAST
-};
+} qemuDomainJob;
VIR_ENUM_DECL(qemuDomainJob)
/* Async job consists of a series of jobs that may change state. Independent
* jobs that do not change state (and possibly others if explicitly allowed by
* current async job) are allowed to be run even if async job is active.
*/
-enum qemuDomainAsyncJob {
+typedef enum {
QEMU_ASYNC_JOB_NONE = 0,
QEMU_ASYNC_JOB_MIGRATION_OUT,
QEMU_ASYNC_JOB_MIGRATION_IN,
@@ -97,16 +97,16 @@ enum qemuDomainAsyncJob {
QEMU_ASYNC_JOB_SNAPSHOT,
QEMU_ASYNC_JOB_LAST
-};
+} qemuDomainAsyncJob;
VIR_ENUM_DECL(qemuDomainAsyncJob)
struct qemuDomainJobObj {
virCond cond; /* Use to coordinate jobs */
- enum qemuDomainJob active; /* Currently running job */
+ qemuDomainJob active; /* Currently running job */
unsigned long long owner; /* Thread id which set current job */
virCond asyncCond; /* Use to coordinate with async jobs */
- enum qemuDomainAsyncJob asyncJob; /* Currently active async job */
+ qemuDomainAsyncJob asyncJob; /* Currently active async job */
unsigned long long asyncOwner; /* Thread which set current async job */
int phase; /* Job phase (mainly for migrations) */
unsigned long long mask; /* Jobs allowed during async job */
@@ -193,9 +193,9 @@ struct qemuProcessEvent {
void *data;
};
-const char *qemuDomainAsyncJobPhaseToString(enum qemuDomainAsyncJob job,
+const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job,
int phase);
-int qemuDomainAsyncJobPhaseFromString(enum qemuDomainAsyncJob job,
+int qemuDomainAsyncJobPhaseFromString(qemuDomainAsyncJob job,
const char *phase);
void qemuDomainEventFlush(int timer, void *opaque);
@@ -205,11 +205,11 @@ void qemuDomainEventQueue(virQEMUDriverPtr driver,
int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainJob job)
+ qemuDomainJob job)
ATTRIBUTE_RETURN_CHECK;
int qemuDomainObjBeginAsyncJob(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
ATTRIBUTE_RETURN_CHECK;
bool qemuDomainObjEndJob(virQEMUDriverPtr driver,
@@ -239,7 +239,7 @@ void qemuDomainObjExitMonitor(virQEMUDriverPtr driver,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int qemuDomainObjEnterMonitorAsync(virQEMUDriverPtr driver,
virDomainObjPtr obj,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
@@ -344,7 +344,7 @@ void qemuDomainSetFakeReboot(virQEMUDriverPtr driver,
bool value);
bool qemuDomainJobAllowed(qemuDomainObjPrivatePtr priv,
- enum qemuDomainJob job);
+ qemuDomainJob job);
int qemuDomainCheckDiskPresence(virQEMUDriverPtr driver,
virDomainObjPtr vm,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7bf2020..6b363ed 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2908,7 +2908,7 @@ qemuDomainSaveMemory(virQEMUDriverPtr driver,
int compressed,
bool was_running,
unsigned int flags,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
virQEMUSaveHeader header;
bool bypassSecurityDriver = false;
@@ -3387,7 +3387,7 @@ qemuDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
}
static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm,
- int fd, enum qemuDomainAsyncJob asyncJob,
+ int fd, qemuDomainAsyncJob asyncJob,
const char *dumpformat)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -12839,7 +12839,7 @@ qemuDomainSnapshotCreateSingleDiskActive(virQEMUDriverPtr driver,
virDomainDiskDefPtr persistDisk,
virJSONValuePtr actions,
bool reuse,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
char *device = NULL;
@@ -13076,7 +13076,7 @@ qemuDomainSnapshotCreateDiskActive(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainSnapshotObjPtr snap,
unsigned int flags,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virJSONValuePtr actions = NULL;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7289055..ed86520 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -195,7 +195,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
int
qemuDomainCheckEjectableMedia(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virHashTablePtr table = NULL;
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index 9ed630a..beaa332 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -35,7 +35,7 @@ int qemuDomainChangeEjectableMedia(virQEMUDriverPtr driver,
bool force);
int qemuDomainCheckEjectableMedia(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuDomainAsyncJob asyncJob);
+ qemuDomainAsyncJob asyncJob);
int qemuDomainAttachControllerDevice(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainControllerDefPtr controller);
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 842f782..7684aec 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1585,7 +1585,7 @@ qemuMigrationSetOffline(virQEMUDriverPtr driver,
static int
qemuMigrationSetCompression(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuDomainAsyncJob job)
+ qemuDomainAsyncJob job)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret;
@@ -1625,7 +1625,7 @@ qemuMigrationSetCompression(virQEMUDriverPtr driver,
static int
qemuMigrationSetAutoConverge(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuDomainAsyncJob job)
+ qemuDomainAsyncJob job)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret;
@@ -1704,7 +1704,7 @@ static int
qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
virDomainObjPtr vm,
const char *job,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret;
@@ -1788,7 +1788,7 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
*/
static int
qemuMigrationWaitForCompletion(virQEMUDriverPtr driver, virDomainObjPtr vm,
- enum qemuDomainAsyncJob asyncJob,
+ qemuDomainAsyncJob asyncJob,
virConnectPtr dconn, bool abort_on_error)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -2006,7 +2006,7 @@ qemuMigrationCleanup(virDomainObjPtr vm,
" was closed; canceling the migration",
vm->def->name);
- switch ((enum qemuMigrationJobPhase) priv->job.phase) {
+ switch ((qemuMigrationJobPhase) priv->job.phase) {
case QEMU_MIGRATION_PHASE_BEGIN3:
/* just forget we were about to migrate */
qemuDomainObjDiscardAsyncJob(driver, vm);
@@ -2154,7 +2154,7 @@ qemuMigrationBegin(virConnectPtr conn,
{
virQEMUDriverPtr driver = conn->privateData;
char *xml = NULL;
- enum qemuDomainAsyncJob asyncJob;
+ qemuDomainAsyncJob asyncJob;
if ((flags & VIR_MIGRATE_CHANGE_PROTECTION)) {
if (qemuMigrationJobStart(driver, vm, QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
@@ -2892,7 +2892,7 @@ qemuMigrationConfirm(virConnectPtr conn,
int cancelled)
{
virQEMUDriverPtr driver = conn->privateData;
- enum qemuMigrationJobPhase phase;
+ qemuMigrationJobPhase phase;
virQEMUDriverConfigPtr cfg = NULL;
int ret = -1;
@@ -4694,7 +4694,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
int fd, off_t offset, const char *path,
const char *compressor,
bool bypassSecurityDriver,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int rc;
@@ -4865,7 +4865,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
int
qemuMigrationJobStart(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuDomainAsyncJob job)
+ qemuDomainAsyncJob job)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -4888,7 +4888,7 @@ qemuMigrationJobStart(virQEMUDriverPtr driver,
void
qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuMigrationJobPhase phase)
+ qemuMigrationJobPhase phase)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -4905,7 +4905,7 @@ qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
void
qemuMigrationJobStartPhase(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuMigrationJobPhase phase)
+ qemuMigrationJobPhase phase)
{
virObjectRef(vm);
qemuMigrationJobSetPhase(driver, vm, phase);
@@ -4920,7 +4920,7 @@ qemuMigrationJobContinue(virDomainObjPtr vm)
bool
qemuMigrationJobIsActive(virDomainObjPtr vm,
- enum qemuDomainAsyncJob job)
+ qemuDomainAsyncJob job)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index a802fb7..3fa68dc 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -53,7 +53,7 @@
NULL
-enum qemuMigrationJobPhase {
+typedef enum {
QEMU_MIGRATION_PHASE_NONE = 0,
QEMU_MIGRATION_PHASE_PERFORM2,
QEMU_MIGRATION_PHASE_BEGIN3,
@@ -66,25 +66,25 @@ enum qemuMigrationJobPhase {
QEMU_MIGRATION_PHASE_FINISH3,
QEMU_MIGRATION_PHASE_LAST
-};
+} qemuMigrationJobPhase;
VIR_ENUM_DECL(qemuMigrationJobPhase)
int qemuMigrationJobStart(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuDomainAsyncJob job)
+ qemuDomainAsyncJob job)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
void qemuMigrationJobSetPhase(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuMigrationJobPhase phase)
+ qemuMigrationJobPhase phase)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
void qemuMigrationJobStartPhase(virQEMUDriverPtr driver,
virDomainObjPtr vm,
- enum qemuMigrationJobPhase phase)
+ qemuMigrationJobPhase phase)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
bool qemuMigrationJobContinue(virDomainObjPtr obj)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
bool qemuMigrationJobIsActive(virDomainObjPtr vm,
- enum qemuDomainAsyncJob job)
+ qemuDomainAsyncJob job)
ATTRIBUTE_NONNULL(1);
bool qemuMigrationJobFinish(virQEMUDriverPtr driver, virDomainObjPtr obj)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_RETURN_CHECK;
@@ -172,7 +172,7 @@ int qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
int fd, off_t offset, const char *path,
const char *compressor,
bool bypassSecurityDriver,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5)
ATTRIBUTE_RETURN_CHECK;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index e4845ba..6960cb8 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2762,7 +2762,7 @@ qemuProcessPrepareMonitorChr(virQEMUDriverConfigPtr cfg,
int
qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
virConnectPtr conn, virDomainRunningReason reason,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -2804,7 +2804,7 @@ qemuProcessStartCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
int qemuProcessStopCPUs(virQEMUDriverPtr driver, virDomainObjPtr vm,
virDomainPausedReason reason,
- enum qemuDomainAsyncJob asyncJob)
+ qemuDomainAsyncJob asyncJob)
{
int ret = -1;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -2928,8 +2928,8 @@ static int
qemuProcessRecoverMigration(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virConnectPtr conn,
- enum qemuDomainAsyncJob job,
- enum qemuMigrationJobPhase phase,
+ qemuDomainAsyncJob job,
+ qemuMigrationJobPhase phase,
virDomainState state,
int reason)
{
diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h
index d99978f..9c78736 100644
--- a/src/qemu/qemu_process.h
+++ b/src/qemu/qemu_process.h
@@ -33,11 +33,11 @@ int qemuProcessStartCPUs(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virConnectPtr conn,
virDomainRunningReason reason,
- enum qemuDomainAsyncJob asyncJob);
+ qemuDomainAsyncJob asyncJob);
int qemuProcessStopCPUs(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virDomainPausedReason reason,
- enum qemuDomainAsyncJob asyncJob);
+ qemuDomainAsyncJob asyncJob);
void qemuProcessAutostartAll(virQEMUDriverPtr driver);
void qemuProcessReconnectAll(virConnectPtr conn, virQEMUDriverPtr driver);
--
1.7.10.4
10 years, 5 months
[libvirt] [PATCH] libxl: fix version annotation of migration functions
by Jim Fehlig
Commit 9b8d6e1e missed updating the libvirt version which
introduced support for domainMigrate*3Params functions.
Signed-off-by: Jim Fehlig <jfehlig(a)suse.com>
---
This patch only changes the comments describing when these functions
were introduced. Pushing under the trivial rule.
src/libxl/libxl_driver.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index c62c55e..1ea99e2 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -4650,11 +4650,11 @@ static virDriver libxlDriver = {
.nodeDeviceDetachFlags = libxlNodeDeviceDetachFlags, /* 1.2.3 */
.nodeDeviceReAttach = libxlNodeDeviceReAttach, /* 1.2.3 */
.nodeDeviceReset = libxlNodeDeviceReset, /* 1.2.3 */
- .domainMigrateBegin3Params = libxlDomainMigrateBegin3Params, /* 1.2.3 */
- .domainMigratePrepare3Params = libxlDomainMigratePrepare3Params, /* 1.2.3 */
- .domainMigratePerform3Params = libxlDomainMigratePerform3Params, /* 1.2.3 */
- .domainMigrateFinish3Params = libxlDomainMigrateFinish3Params, /* 1.2.3 */
- .domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.3 */
+ .domainMigrateBegin3Params = libxlDomainMigrateBegin3Params, /* 1.2.6 */
+ .domainMigratePrepare3Params = libxlDomainMigratePrepare3Params, /* 1.2.6 */
+ .domainMigratePerform3Params = libxlDomainMigratePerform3Params, /* 1.2.6 */
+ .domainMigrateFinish3Params = libxlDomainMigrateFinish3Params, /* 1.2.6 */
+ .domainMigrateConfirm3Params = libxlDomainMigrateConfirm3Params, /* 1.2.6 */
};
static virStateDriver libxlStateDriver = {
--
1.8.4.5
10 years, 5 months
[libvirt] Regarding guest-file-write
by Puneet Bakshi
Hi,
>From host, I wrote 26 alphabets in guest file (/tmp/testqga) using
guest-file-write guest agent command (logs pasted below). I faced 2 issues
when doing that.
1a. It could wrote only 18bytes! Why could it not write all 26 characters?
Are we supposed to track how much data is written and need to resend the
remaining one?
1b. What is the limit of data, I can send in one guest-file-write command?
2. In the guest, file data seems to be different. Am I doing something
wrong here?
Host (file write)
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"w
+"}}'
{"return":1000}
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-write",
"arguments":{"handle":1000,"buf-b64":"abcdefghijklmnopqrstuvwxyz"}}'
{"return":{"count":18,"eof":false}}
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-close", "arguments":{"handle":1000}}'
{"return":{}}
Host (file read)
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-open", "arguments":{"path":"/tmp/testqga","mode":"r"}}'
{"return":1001}
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-read", "arguments":{"handle":1001,"count":18}}'
{"return":{"count":18,"buf-b64":"abcdefghijklmnopqrstuvwx","eof":false}}
[root@sdsr720-14 ~]# virsh qemu-agent-command vm_04 '{"
execute":"guest-file-close", "arguments":{"handle":1001}}'
{"return":{}}
Guest
[root@vm04 qga]# ll /tmp/testqga
-rw-rw-rw-. 1 root root 18 Jun 24 15:06 /tmp/testqga
[root@vm04 qga]# cat /tmp/testqga
i�^]y�!�9%�z)��-��1[root@vm04 qga]#
[root@vm04 qga]# od -x /tmp/testqga
0000000 b769 791d 21f8 398a 9a25 297a bbaa ba2d
0000020 31fc
0000022
[root@vm04 qga]# strings /tmp/testqga
[root@vm04 qga]# hexdump /tmp/testqga
0000000 b769 791d 21f8 398a 9a25 297a bbaa ba2d
0000010 31fc
0000012
[root@vm04 qga]# hexdump -c /tmp/testqga
0000000 i 267 035 y 370 ! 212 9 % 232 z ) 252 273 - 272
0000010 374 1
0000012
[root@vm04 qga]#
Regards,
~Puneet
10 years, 5 months
[libvirt] [PATCH 0/5] Outline of rewriting vbox driver, with common code support.
by Taowei
Michal asked me to try working out a sample of vbox driver's common code. Here
it is. As the PATCHv2 is pending, I merged it.
Taowei (5):
define interface with vbox_common
a sample of vbox_common function : vboxInitialize
implement vboxUniformedAPI in vbox_tmpl.c and remove common codes
install vbox api register in vbox_driver
make new files be compiled by libvirt
po/POTFILES.in | 1 +
src/Makefile.am | 4 +-
src/vbox/vbox_common.c | 89 ++++++++++++++++++++++++++++
src/vbox/vbox_common.h | 108 ++++++++++++++++++++++++++++++++++
src/vbox/vbox_commondef.h | 32 ++++++++++
src/vbox/vbox_driver.c | 35 +++++++++--
src/vbox/vbox_tmpl.c | 142 +++++++++++++++++----------------------------
7 files changed, 316 insertions(+), 95 deletions(-)
create mode 100644 src/vbox/vbox_common.c
create mode 100644 src/vbox/vbox_common.h
create mode 100644 src/vbox/vbox_commondef.h
--
1.7.9.5
10 years, 5 months
[libvirt] [PATCH] bridge: leases: Fix potential crash caused by use after free
by Peter Krempa
Don't free individual JSON array members as the array will be freed at
the end. This may potentially lead to a crash although it didn't crash
on my setup.
---
src/network/bridge_driver.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index d5577e0..f3aff1c 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3437,10 +3437,8 @@ networkGetDHCPLeasesHelper(virNetworkObjPtr obj,
goto error;
}
- if (mac && virMacAddrCompare(mac, mac_tmp)) {
- virJSONValueFree(lease_tmp);
+ if (mac && virMacAddrCompare(mac, mac_tmp))
continue;
- }
if (virJSONValueObjectGetNumberLong(lease_tmp, "expiry-time", &expirytime_tmp) < 0) {
/* A lease cannot be present without expiry-time */
--
1.9.3
10 years, 5 months
[libvirt] [PATCH 0/3] Make libvirt leak less memory
by Ján Tomko
Ján Tomko (3):
Free file header in virStorageFileGetMetadataRecurse
Rework remoteSerializeDHCPLease
Free DHCP leases file in networkGetDHCPLeasesHelper
daemon/remote.c | 53 ++++++++++++++++++++++++++++----------------
src/network/bridge_driver.c | 1 +
src/storage/storage_driver.c | 1 +
3 files changed, 36 insertions(+), 19 deletions(-)
--
1.8.5.5
10 years, 5 months