[libvirt] [PATCH] vbox: Fix typo in error message
by Matthias Bolte
---
I'm pushing this under the trivial rule.
src/vbox/vbox_XPCOMCGlue.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 0caeef9..e7e9c37 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -97,7 +97,7 @@ tryLoadOne(const char *dir, bool setAppHome, bool ignoreMissing,
if (!virFileExists(name)) {
if (!ignoreMissing) {
- VIR_ERROR(_("Libaray '%s' doesn't exist"), name);
+ VIR_ERROR(_("Library '%s' doesn't exist"), name);
}
VIR_FREE(name);
--
1.7.0.4
13 years, 7 months
[libvirt] [PATCH] Don't raise an error if the migration cookie is NULL
by Daniel P. Berrange
The v2 migration protocol doesn't use cookies, so we should not
be raising an error if the cookie parameters are NULL.
* src/qemu/qemu_migration.c: Don't raise error if cookie is NULL
---
src/qemu/qemu_migration.c | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index aa74d86..fa506e2 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -618,11 +618,8 @@ qemuMigrationBakeCookie(qemuMigrationCookiePtr mig,
int *cookieoutlen,
int flags)
{
- if (!cookieout || !cookieoutlen) {
- qemuReportError(VIR_ERR_INVALID_ARG, "%s",
- _("missing migration cookie data"));
- return -1;
- }
+ if (!cookieout || !cookieoutlen)
+ return 0;
*cookieoutlen = 0;
--
1.7.4.4
13 years, 7 months
[libvirt] [PATCH] Fix check of virKillProcess return status
by Daniel P. Berrange
The error code for virKillProcess is returned in the errno variable
not the return value. THis mistake caused the logs to be filled with
errors when shutting down QEMU processes
* src/qemu/qemu_process.c: Fix process kill check.
---
src/qemu/qemu_process.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 116253e..ce05133 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2513,7 +2513,6 @@ cleanup:
void qemuProcessKill(virDomainObjPtr vm)
{
int i;
- int rc;
VIR_DEBUG("vm=%s pid=%d", vm->def->name, vm->pid);
if (!virDomainObjIsActive(vm)) {
@@ -2535,9 +2534,8 @@ void qemuProcessKill(virDomainObjPtr vm)
else
signum = 0; /* Just check for existence */
- rc = virKillProcess(vm->pid, signum);
- if (rc < 0) {
- if (rc != -ESRCH) {
+ if (virKillProcess(vm->pid, signum) < 0) {
+ if (errno != -ESRCH) {
char ebuf[1024];
VIR_WARN("Failed to kill process %d %s",
vm->pid, virStrerror(errno, ebuf, sizeof ebuf));
--
1.7.4.4
13 years, 7 months
[libvirt] [PATCH] vbox: Fix version extraction on Windows for newer VirtualBox versions
by Matthias Bolte
VirtualBox 4.0.8 changed the registry key layout. Before the version
number was in a Version key. Now the Version key contains %VER% and
the actual version number is in VersionExt now.
Move value lookup code into its own function: vboxLookupRegistryValue.
---
src/vbox/vbox_MSCOMGlue.c | 87 +++++++++++++++++++++++++++++++--------------
1 files changed, 60 insertions(+), 27 deletions(-)
diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c
index e31a763..8aef266 100644
--- a/src/vbox/vbox_MSCOMGlue.c
+++ b/src/vbox/vbox_MSCOMGlue.c
@@ -2,7 +2,7 @@
/*
* vbox_MSCOMGlue.c: glue to the MSCOM based VirtualBox API
*
- * Copyright (C) 2010 Matthias Bolte <matthias.bolte(a)googlemail.com>
+ * Copyright (C) 2010-2011 Matthias Bolte <matthias.bolte(a)googlemail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -338,45 +338,31 @@ static nsIEventQueue vboxEventQueue = {
-static int
-vboxLookupVersionInRegistry(void)
+static char *
+vboxLookupRegistryValue(HKEY key, const char *keyName, const char *valueName)
{
- int result = -1;
- const char *keyName = VBOX_REGKEY_ORACLE;
LONG status;
- HKEY key;
DWORD type;
DWORD length;
char *value = NULL;
- status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &key);
+ status = RegQueryValueEx(key, valueName, NULL, &type, NULL, &length);
if (status != ERROR_SUCCESS) {
- keyName = VBOX_REGKEY_SUN;
- status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &key);
-
- if (status != ERROR_SUCCESS) {
- /* Both keys aren't there, or we cannot open them. In general this
- * indicates that VirtualBox is not installed, so we just silently
- * fail here making vboxRegister() register the dummy driver. */
- return -1;
- }
- }
-
- status = RegQueryValueEx(key, "Version", NULL, &type, NULL, &length);
-
- if (status != ERROR_SUCCESS) {
- VIR_ERROR(_("Could not query registry value '%s\\Version'"), keyName);
+ VIR_ERROR(_("Could not query registry value '%s\\%s'"),
+ keyName, valueName);
goto cleanup;
}
if (type != REG_SZ) {
- VIR_ERROR(_("Registry value '%s\\Version' has unexpected type"), keyName);
+ VIR_ERROR(_("Registry value '%s\\%s' has unexpected type"),
+ keyName, valueName);
goto cleanup;
}
if (length < 2) {
- VIR_ERROR(_("Registry value '%s\\Version' is too short"), keyName);
+ VIR_ERROR(_("Registry value '%s\\%s' is too short"),
+ keyName, valueName);
goto cleanup;
}
@@ -386,10 +372,12 @@ vboxLookupVersionInRegistry(void)
goto cleanup;
}
- status = RegQueryValueEx(key, "Version", NULL, NULL, (LPBYTE)value, &length);
+ status = RegQueryValueEx(key, valueName, NULL, NULL, (LPBYTE)value, &length);
if (status != ERROR_SUCCESS) {
- VIR_ERROR(_("Could not query registry value '%s\\Version'"), keyName);
+ VIR_FREE(value);
+ VIR_ERROR(_("Could not query registry value '%s\\%s'"),
+ keyName, valueName);
goto cleanup;
}
@@ -397,7 +385,52 @@ vboxLookupVersionInRegistry(void)
value[length] = '\0';
}
- if (virParseVersionString(value, &vboxVersion)) {
+ cleanup:
+ return value;
+}
+
+static int
+vboxLookupVersionInRegistry(void)
+{
+ int result = -1;
+ const char *keyName = VBOX_REGKEY_ORACLE;
+ LONG status;
+ HKEY key;
+ char *value = NULL;
+
+ status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &key);
+
+ if (status != ERROR_SUCCESS) {
+ keyName = VBOX_REGKEY_SUN;
+ status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName, 0, KEY_READ, &key);
+
+ if (status != ERROR_SUCCESS) {
+ /* Both keys aren't there, or we cannot open them. In general this
+ * indicates that VirtualBox is not installed, so we just silently
+ * fail here making vboxRegister() register the dummy driver. */
+ return -1;
+ }
+ }
+
+ /* The registry key layout changed around version 4.0.8. Before the version
+ * number was in the Version key, now the Version key can contain %VER% and
+ * the actual version number is in the VersionExt key then. */
+ value = vboxLookupRegistryValue(key, keyName, "Version");
+
+ if (value == NULL) {
+ goto cleanup;
+ }
+
+ if (STREQ(value, "%VER%")) {
+ VIR_FREE(value);
+ value = vboxLookupRegistryValue(key, keyName, "VersionExt");
+
+ if (value == NULL) {
+ goto cleanup;
+ }
+ }
+
+ if (virParseVersionString(value, &vboxVersion) < 0) {
VIR_ERROR(_("Could not parse version number from '%s'"), value);
goto cleanup;
}
--
1.7.0.4
13 years, 7 months
[libvirt] [PATCH] API: consolidate common unreleased enums
by Eric Blake
This commit is safe precisely because there has been no release
for any of the enum values being deleted (they were added post-0.9.1).
After the 0.9.2 release, we can then take advantage of
virDomainModificationImpact in more places.
* include/libvirt/libvirt.h.in (virDomainModificationImpact): New
enum.
(virDomainSchedParameterFlags, virMemoryParamFlags): Delete, since
these were never released, and the new enum works fine here.
* src/libvirt.c (virDomainGetMemoryParameters)
(virDomainSetMemoryParameters)
(virDomainGetSchedulerParametersFlags)
(virDomainSetSchedulerParametersFlags): Update documentation.
* src/qemu/qemu_driver.c (qemuDomainSetMemoryParameters)
(qemuDomainGetMemoryParameters, qemuSetSchedulerParametersFlags)
(qemuSetSchedulerParameters, qemuGetSchedulerParametersFlags)
(qemuGetSchedulerParameters): Adjust clients.
* tools/virsh.c (cmdSchedinfo, cmdMemtune): Likewise.
Based on ideas by Daniel Veillard and Hu Tao.
---
This has to be applied before 0.9.2 if we like the idea.
See https://www.redhat.com/archives/libvir-list/2011-June/msg00177.html
for more details about why this is safe. I am intentionally not touching
any enums that existed in 0.9.1 at this point in the release cycle.
include/libvirt/libvirt.h.in | 30 ++++++++------
src/libvirt.c | 18 ++++----
src/qemu/qemu_driver.c | 84 +++++++++++++++++++++---------------------
tools/virsh.c | 12 +++---
4 files changed, 74 insertions(+), 70 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 8058229..df213f1 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -142,6 +142,23 @@ typedef enum {
} virDomainCrashedReason;
/**
+ * virDomainModificationImpact:
+ *
+ * Several APIs take flags to determine whether a change to the domain
+ * affects just the running instance, just the persistent definition,
+ * or both. The use of VIR_DOMAIN_AFFECT_CURRENT will resolve to
+ * either VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG according
+ * to current domain state. VIR_DOMAIN_AFFECT_LIVE requires a running
+ * domain, and VIR_DOMAIN_AFFECT_CONFIG requires a persistent domain
+ * (whether or not it is running).
+ */
+typedef enum {
+ VIR_DOMAIN_AFFECT_CURRENT = 0, /* Affect current domain state. */
+ VIR_DOMAIN_AFFECT_LIVE = 1 << 0, /* Affect running domain state. */
+ VIR_DOMAIN_AFFECT_CONFIG = 1 << 1, /* Affect persistent domain state. */
+} virDomainModificationImpact;
+
+/**
* virDomainInfoPtr:
*
* a virDomainInfo is a structure filled by virDomainGetInfo() and extracting
@@ -338,12 +355,6 @@ typedef virTypedParameter *virTypedParameterPtr;
/* Management of scheduler parameters */
-typedef enum {
- VIR_DOMAIN_SCHEDPARAM_CURRENT = 0, /* affect current domain state */
- VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 0), /* Affect active domain */
- VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 1), /* Affect next boot */
-} virDomainSchedParameterFlags;
-
/*
* Fetch scheduler parameters, caller allocates 'params' field of size 'nparams'
*/
@@ -799,13 +810,6 @@ int virDomainGetBlkioParameters(virDomainPtr domain,
/* Manage memory parameters. */
-/* flags for setting memory parameters */
-typedef enum {
- VIR_DOMAIN_MEMORY_PARAM_CURRENT = 0, /* affect current domain state */
- VIR_DOMAIN_MEMORY_PARAM_LIVE = (1 << 0), /* affect active domain */
- VIR_DOMAIN_MEMORY_PARAM_CONFIG = (1 << 1) /* affect next boot */
-} virMemoryParamFlags;
-
/**
* VIR_DOMAIN_MEMORY_PARAM_UNLIMITED:
*
diff --git a/src/libvirt.c b/src/libvirt.c
index eaae0ec..cbe1926 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2994,7 +2994,7 @@ error:
* @params: pointer to memory parameter objects
* @nparams: number of memory parameter (this value can be the same or
* less than the number of parameters supported)
- * @flags: currently unused, for future extension
+ * @flags: bitwise-OR of virDomainModificationImpact
*
* Change all or a subset of the memory tunables.
* This function requires privileged access to the hypervisor.
@@ -3049,7 +3049,7 @@ error:
* @params: pointer to memory parameter object
* (return value, allocated by the caller)
* @nparams: pointer to number of memory parameters
- * @flags: currently unused, for future extension
+ * @flags: one of virDomainModificationImpact
*
* Get all memory parameters, the @params array will be filled with the values
* equal to the number of parameters suggested by @nparams
@@ -5480,13 +5480,13 @@ error:
* @nparams: pointer to number of scheduler parameter
* (this value should be same than the returned value
* nparams of virDomainGetSchedulerType)
- * @flags: virDomainSchedParameterFlags
+ * @flags: one of virDomainModificationImpact
*
* Get the scheduler parameters, the @params array will be filled with the
* values.
*
- * The value of @flags can be exactly VIR_DOMAIN_SCHEDPARAM_CURRENT,
- * VIR_DOMAIN_SCHEDPARAM_LIVE, or VIR_DOMAIN_SCHEDPARAM_CONFIG.
+ * The value of @flags can be exactly VIR_DOMAIN_AFFECT_CURRENT,
+ * VIR_DOMAIN_AFFECT_LIVE, or VIR_DOMAIN_AFFECT_CONFIG.
*
* Returns -1 in case of error, 0 in case of success.
*/
@@ -5596,12 +5596,12 @@ error:
* @nparams: number of scheduler parameter objects
* (this value can be the same or less than the returned value
* nparams of virDomainGetSchedulerType)
- * @flags: virDomainSchedParameterFlags
+ * @flags: bitwise-OR of virDomainModificationImpact
*
* Change a subset or all scheduler parameters. The value of @flags
- * should be either VIR_DOMAIN_SCHEDPARAM_CURRENT, or a bitwise-or of
- * values from VIR_DOMAIN_SCHEDPARAM_LIVE and
- * VIR_DOMAIN_SCHEDPARAM_CURRENT, although hypervisors vary in which
+ * should be either VIR_DOMAIN_AFFECT_CURRENT, or a bitwise-or of
+ * values from VIR_DOMAIN_AFFECT_LIVE and
+ * VIR_DOMAIN_AFFECT_CURRENT, although hypervisors vary in which
* flags are supported.
*
* Returns -1 in case of error, 0 in case of success.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ec23bb3..2957467 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4921,8 +4921,8 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
int ret = -1;
bool isActive;
- virCheckFlags(VIR_DOMAIN_MEMORY_PARAM_LIVE |
- VIR_DOMAIN_MEMORY_PARAM_CONFIG, -1);
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
qemuDriverLock(driver);
@@ -4936,14 +4936,14 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
isActive = virDomainObjIsActive(vm);
- if (flags == VIR_DOMAIN_MEMORY_PARAM_CURRENT) {
+ if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
if (isActive)
- flags = VIR_DOMAIN_MEMORY_PARAM_LIVE;
+ flags = VIR_DOMAIN_AFFECT_LIVE;
else
- flags = VIR_DOMAIN_MEMORY_PARAM_CONFIG;
+ flags = VIR_DOMAIN_AFFECT_CONFIG;
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!isActive) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
@@ -4963,7 +4963,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
}
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (!vm->persistent) {
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot change persistent config of a transient domain"));
@@ -4986,7 +4986,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
continue;
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
rc = virCgroupSetMemoryHardLimit(group, params[i].value.ul);
if (rc != 0) {
virReportSystemError(-rc, "%s",
@@ -4995,7 +4995,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
}
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
persistentDef->mem.hard_limit = params[i].value.ul;
}
} else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SOFT_LIMIT)) {
@@ -5007,7 +5007,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
continue;
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
rc = virCgroupSetMemorySoftLimit(group, params[i].value.ul);
if (rc != 0) {
virReportSystemError(-rc, "%s",
@@ -5016,7 +5016,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
}
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
persistentDef->mem.soft_limit = params[i].value.ul;
}
} else if (STREQ(param->field, VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT)) {
@@ -5028,7 +5028,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
continue;
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
rc = virCgroupSetMemSwapHardLimit(group, params[i].value.ul);
if (rc != 0) {
virReportSystemError(-rc, "%s",
@@ -5036,7 +5036,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
ret = -1;
}
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
persistentDef->mem.swap_hard_limit = params[i].value.ul;
}
} else if (STREQ(param->field, VIR_DOMAIN_MEMORY_MIN_GUARANTEE)) {
@@ -5050,7 +5050,7 @@ static int qemuDomainSetMemoryParameters(virDomainPtr dom,
}
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
ret = virDomainSaveConfig(driver->configDir, persistentDef);
}
@@ -5077,8 +5077,8 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
int rc;
bool isActive;
- virCheckFlags(VIR_DOMAIN_MEMORY_PARAM_LIVE |
- VIR_DOMAIN_MEMORY_PARAM_CONFIG, -1);
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
qemuDriverLock(driver);
@@ -5092,14 +5092,14 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
isActive = virDomainObjIsActive(vm);
- if (flags == VIR_DOMAIN_MEMORY_PARAM_CURRENT) {
+ if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
if (isActive)
- flags = VIR_DOMAIN_MEMORY_PARAM_LIVE;
+ flags = VIR_DOMAIN_AFFECT_LIVE;
else
- flags = VIR_DOMAIN_MEMORY_PARAM_CONFIG;
+ flags = VIR_DOMAIN_AFFECT_CONFIG;
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!isActive) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
@@ -5119,7 +5119,7 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
}
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (!vm->persistent) {
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot change persistent config of a transient domain"));
@@ -5142,12 +5142,12 @@ static int qemuDomainGetMemoryParameters(virDomainPtr dom,
goto cleanup;
}
- if (flags & VIR_DOMAIN_MEMORY_PARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
for (i = 0; i < *nparams; i++) {
virMemoryParameterPtr param = ¶ms[i];
val = 0;
param->value.ul = 0;
- param->type = VIR_DOMAIN_MEMORY_PARAM_ULLONG;
+ param->type = VIR_TYPED_PARAM_ULLONG;
switch (i) {
case 0: /* fill memory hard limit here */
@@ -5269,8 +5269,8 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom,
int ret = -1;
bool isActive;
- virCheckFlags(VIR_DOMAIN_SCHEDPARAM_LIVE |
- VIR_DOMAIN_SCHEDPARAM_CONFIG, -1);
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
qemuDriverLock(driver);
@@ -5284,20 +5284,20 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom,
isActive = virDomainObjIsActive(vm);
- if (flags == VIR_DOMAIN_SCHEDPARAM_CURRENT) {
+ if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
if (isActive)
- flags = VIR_DOMAIN_SCHEDPARAM_LIVE;
+ flags = VIR_DOMAIN_AFFECT_LIVE;
else
- flags = VIR_DOMAIN_SCHEDPARAM_CONFIG;
+ flags = VIR_DOMAIN_AFFECT_CONFIG;
}
- if ((flags & VIR_DOMAIN_SCHEDPARAM_CONFIG) && !vm->persistent) {
+ if ((flags & VIR_DOMAIN_AFFECT_CONFIG) && !vm->persistent) {
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot change persistent config of a transient domain"));
goto cleanup;
}
- if (flags & VIR_DOMAIN_SCHEDPARAM_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
if (!isActive) {
qemuReportError(VIR_ERR_OPERATION_INVALID,
"%s", _("domain is not running"));
@@ -5328,7 +5328,7 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom,
goto cleanup;
}
- if (flags & VIR_DOMAIN_SCHEDPARAM_LIVE) {
+ if (flags & VIR_DOMAIN_AFFECT_LIVE) {
rc = virCgroupSetCpuShares(group, params[i].value.ul);
if (rc != 0) {
virReportSystemError(-rc, "%s",
@@ -5339,7 +5339,7 @@ static int qemuSetSchedulerParametersFlags(virDomainPtr dom,
vm->def->cputune.shares = params[i].value.ul;
}
- if (flags & VIR_DOMAIN_SCHEDPARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
persistentDef = virDomainObjGetPersistentDef(driver->caps, vm);
if (!persistentDef) {
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -5378,7 +5378,7 @@ static int qemuSetSchedulerParameters(virDomainPtr dom,
return qemuSetSchedulerParametersFlags(dom,
params,
nparams,
- VIR_DOMAIN_SCHEDPARAM_LIVE);
+ VIR_DOMAIN_AFFECT_LIVE);
}
static int
@@ -5395,11 +5395,11 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
int rc;
bool isActive;
- virCheckFlags(VIR_DOMAIN_SCHEDPARAM_LIVE |
- VIR_DOMAIN_SCHEDPARAM_CONFIG, -1);
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
- if ((flags & (VIR_DOMAIN_SCHEDPARAM_LIVE | VIR_DOMAIN_SCHEDPARAM_CONFIG)) ==
- (VIR_DOMAIN_SCHEDPARAM_LIVE | VIR_DOMAIN_SCHEDPARAM_CONFIG)) {
+ if ((flags & (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) ==
+ (VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG)) {
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
_("cannot query live and config together"));
goto cleanup;
@@ -5422,14 +5422,14 @@ qemuGetSchedulerParametersFlags(virDomainPtr dom,
isActive = virDomainObjIsActive(vm);
- if (flags == VIR_DOMAIN_SCHEDPARAM_CURRENT) {
+ if (flags == VIR_DOMAIN_AFFECT_CURRENT) {
if (isActive)
- flags = VIR_DOMAIN_SCHEDPARAM_LIVE;
+ flags = VIR_DOMAIN_AFFECT_LIVE;
else
- flags = VIR_DOMAIN_SCHEDPARAM_CONFIG;
+ flags = VIR_DOMAIN_AFFECT_CONFIG;
}
- if (flags & VIR_DOMAIN_SCHEDPARAM_CONFIG) {
+ if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (!vm->persistent) {
qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("cannot query persistent config of a transient domain"));
@@ -5502,7 +5502,7 @@ qemuGetSchedulerParameters(virDomainPtr dom,
int *nparams)
{
return qemuGetSchedulerParametersFlags(dom, params, nparams,
- VIR_DOMAIN_SCHEDPARAM_CURRENT);
+ VIR_DOMAIN_AFFECT_CURRENT);
}
/* This uses the 'info blockstats' monitor command which was
diff --git a/tools/virsh.c b/tools/virsh.c
index 5679a2d..d98be1c 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -1732,12 +1732,12 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
vshError(ctl, "%s", _("--current must be specified exclusively"));
return false;
}
- flags = VIR_DOMAIN_SCHEDPARAM_CURRENT;
+ flags = VIR_DOMAIN_AFFECT_CURRENT;
} else {
if (config)
- flags |= VIR_DOMAIN_SCHEDPARAM_CONFIG;
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (live)
- flags |= VIR_DOMAIN_SCHEDPARAM_LIVE;
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
}
if (!vshConnectionUsability(ctl, ctl->conn))
@@ -3505,12 +3505,12 @@ cmdMemtune(vshControl * ctl, const vshCmd * cmd)
vshError(ctl, "%s", _("--current must be specified exclusively"));
return false;
}
- flags = VIR_DOMAIN_MEMORY_PARAM_CURRENT;
+ flags = VIR_DOMAIN_AFFECT_CURRENT;
} else {
if (config)
- flags |= VIR_DOMAIN_MEMORY_PARAM_CONFIG;
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (live)
- flags |= VIR_DOMAIN_MEMORY_PARAM_LIVE;
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
}
if (!vshConnectionUsability(ctl, ctl->conn))
--
1.7.4.4
13 years, 7 months
[libvirt] [PATCH] security driver: ignore EINVAL when chowning an image file
by Laine Stump
This fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=702044
https://bugzilla.redhat.com/show_bug.cgi?id=709454
Both of these complain of a failure to use an image file that resides
on a read-only NFS volume. The function in the DAC security driver
that chowns image files to the qemu user:group before using them
already has special cases to ignore failure of chown on read-only file
systems, and in a few other cases, but it hadn't been checking for
EINVAL, which is what is returned if the qemu user doesn't even exist
on the NFS server.
Since the explanation of EINVAL in the chown man page almost exactly
matches the log message already present for the case of EOPNOTSUPP,
I've just added EINVAL to that same conditional.
---
src/security/security_dac.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index b8642d2..24b50e6 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -110,7 +110,7 @@ virSecurityDACSetOwnership(const char *path, int uid, int gid)
}
}
- if (chown_errno == EOPNOTSUPP) {
+ if (chown_errno == EOPNOTSUPP || chown_errno == EINVAL) {
VIR_INFO("Setting user and group to '%d:%d' on '%s' not supported by filesystem",
uid, gid, path);
} else if (chown_errno == EPERM) {
--
1.7.3.4
13 years, 7 months
[libvirt] [PATCH] qemu: Avoid use after free in qemuCaps parsing
by Jiri Denemark
---
src/qemu/qemu_domain.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 46414cd..332c09e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -264,12 +264,13 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
char *str = virXMLPropString(nodes[i], "name");
if (str) {
int flag = qemuCapsTypeFromString(str);
- VIR_FREE(str);
if (flag < 0) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown qemu capabilities flag %s"), str);
+ VIR_FREE(str);
goto error;
}
+ VIR_FREE(str);
qemuCapsSet(qemuCaps, flag);
}
}
--
1.7.5.3
13 years, 7 months
[libvirt] [PATCH] virsh: Document nodeinfo output
by Jiri Denemark
---
tools/virsh.pod | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/tools/virsh.pod b/tools/virsh.pod
index 9251db6..1f41652 100644
--- a/tools/virsh.pod
+++ b/tools/virsh.pod
@@ -235,7 +235,9 @@ Print the XML representation of the hypervisor sysinfo, if available.
=item B<nodeinfo>
Returns basic information about the node, like number and type of CPU,
-and size of the physical memory.
+and size of the physical memory. The output corresponds to virNodeInfo
+structure. Specifically, the "CPU socket(s)" field means number of CPU
+sockets per NUMA cell.
=item B<capabilities>
--
1.7.5.3
13 years, 7 months
[libvirt] Libvirt 0.9.2 week freeze, RC1 version to test
by Daniel Veillard
So we are entering the week freeze for the new version.
I have made an rc1 tarball available at:
ftp://libvirt.org/libvirt/libvirt-0.9.2-rc1.tar.gz
I also made rpms too for those interested.
I didn't included the locking patches from Dan Berrange, though I had
given a review and ACK on the previous version. Maybe we can push this
soon and then I will made an rc2. It would be nice to try to identify
the OpenSolaris portability issues,a dn if someone could give it a try
on Win32 that would be great (along other linux builds of course !)
I have tried it locally and basic operations seems to work fine,
please give it a try too.
thanks !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
13 years, 7 months