[libvirt] [PATCH 2/2] uml:release config object when uml driver shutdown
by Guannan Ren
---
src/uml/uml_driver.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index b08212d..09a777c 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -640,6 +640,7 @@ umlShutdown(void) {
virEventRemoveHandle(uml_driver->inotifyWatch);
VIR_FORCE_CLOSE(uml_driver->inotifyFD);
virObjectUnref(uml_driver->caps);
+ virObjectUnref(uml_driver->xmlconf);
/* shutdown active VMs
* XXX allow them to stay around & reconnect */
--
1.7.11.2
11 years, 7 months
[libvirt] [PATCHv2 1/2] Optimize machine option to set more options with it.
by Li Zhang
From: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
Currently, -machine option is used only when dump-guest-core is set.
To use options defined in machine option for newer version of QEMU,
it needs to use -machine xxx, and to be compatible with older version
-M, this patch addes QEMU_CAPS_MACHINE_OPT capability for newer version,
say 1.2.0.
Signed-off-by: Li Zhang <zhlcindy(a)linux.vnet.ibm.com>
---
v2 -> v1:
* Split the patch to 2 parts suggested by Daniel P.Berrange
* Rename QEMU_CAPS_MACH_OPT to QEMU_CAPS_MACHINE_OPT
* Remove version 1.1 assertion for QEMU_CAPS_MACHINE_OPT
src/qemu/qemu_capabilities.c | 6 +++++-
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 30 +++++++++++++++++++-----------
tests/qemuxml2argvtest.c | 6 +++---
4 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 519d2c5..778e825 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -210,7 +210,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"rng-random", /* 130 */
"rng-egd",
- "virtio-ccw"
+ "virtio-ccw",
+ "machine-opt"
);
struct _virQEMUCaps {
@@ -2442,6 +2443,9 @@ virQEMUCapsInitQMP(virQEMUCapsPtr qemuCaps,
virQEMUCapsInitQMPBasic(qemuCaps);
+ /* machine option is supported for newer version */
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT);
+
if (!(archstr = qemuMonitorGetTargetArch(mon)))
goto cleanup;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index da06e27..66df556 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -172,6 +172,7 @@ enum virQEMUCapsFlags {
virtio rng */
QEMU_CAPS_OBJECT_RNG_EGD = 131, /* EGD protocol daemon for rng */
QEMU_CAPS_VIRTIO_CCW = 132, /* -device virtio-*-ccw */
+ QEMU_CAPS_MACHINE_OPT = 133, /* -machine xxxx*/
QEMU_CAPS_LAST, /* this must always be the last item */
};
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index dc49d44..c39faf0 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4941,6 +4941,8 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
const virDomainDefPtr def,
virQEMUCapsPtr qemuCaps)
{
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
+
/* This should *never* be NULL, since we always provide
* a machine in the capabilities data for QEMU. So this
* check is just here as a safety in case the unexpected
@@ -4948,27 +4950,33 @@ qemuBuildMachineArgStr(virCommandPtr cmd,
if (!def->os.machine)
return 0;
- if (!def->mem.dump_core) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_OPT)) {
/* if no parameter to the machine type is needed, we still use
* '-M' to keep the most of the compatibility with older versions.
*/
virCommandAddArgList(cmd, "-M", def->os.machine, NULL);
} else {
- if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- "%s", _("dump-guest-core is not available "
- " with this QEMU binary"));
- return -1;
- }
/* However, in case there is a parameter to be added, we need to
* use the "-machine" parameter because qemu is not parsing the
* "-M" correctly */
+
virCommandAddArg(cmd, "-machine");
- virCommandAddArgFormat(cmd,
- "%s,dump-guest-core=%s",
- def->os.machine,
- virDomainMemDumpTypeToString(def->mem.dump_core));
+ virBufferAsprintf(&buf, "%s", def->os.machine);
+
+ if (def->mem.dump_core) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ "%s", _("dump-guest-core is not available "
+ " with this QEMU binary"));
+ return -1;
+ }
+
+ virBufferAsprintf(&buf, ",dump-guest-core=%s",
+ virDomainMemDumpTypeToString(def->mem.dump_core));
+ }
+
+ virCommandAddArg(cmd, virBufferContentAndReset(&buf));
}
return 0;
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index c77b73f..352b41f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -363,9 +363,9 @@ mymain(void)
DO_TEST("minimal-s390", QEMU_CAPS_NAME);
DO_TEST("machine-aliases1", NONE);
DO_TEST("machine-aliases2", QEMU_CAPS_KVM);
- DO_TEST("machine-core-on", QEMU_CAPS_DUMP_GUEST_CORE);
- DO_TEST("machine-core-off", QEMU_CAPS_DUMP_GUEST_CORE);
- DO_TEST_FAILURE("machine-core-on", NONE);
+ DO_TEST("machine-core-on", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DUMP_GUEST_CORE);
+ DO_TEST("machine-core-off", QEMU_CAPS_MACHINE_OPT, QEMU_CAPS_DUMP_GUEST_CORE);
+ DO_TEST_FAILURE("machine-core-on", QEMU_CAPS_MACHINE_OPT, NONE);
DO_TEST("boot-cdrom", NONE);
DO_TEST("boot-network", NONE);
DO_TEST("boot-floppy", NONE);
--
1.7.10.1
11 years, 7 months
[libvirt] [libvirt-sandbox][PATCH] Docs: update network options configuration
by Alex Jia
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
bin/virt-sandbox-service-create.pod | 7 ++++++-
bin/virt-sandbox.c | 7 ++++++-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/bin/virt-sandbox-service-create.pod b/bin/virt-sandbox-service-create.pod
index 84cbf0a..1f82e1d 100644
--- a/bin/virt-sandbox-service-create.pod
+++ b/bin/virt-sandbox-service-create.pod
@@ -56,7 +56,12 @@ key=val pairs, separated by commas. The following options are valid
=item dhcp
Configure the network interface using dhcp. This key takes no value.
-No other keys may be specified.
+No other keys may be specified. eg
+
+ -N dhcp,source=default
+ --network dhcp,source=lan
+
+where 'source' is the name of any libvirt virtual network.
=item source=NETWORK
diff --git a/bin/virt-sandbox.c b/bin/virt-sandbox.c
index 0396d9e..88c4333 100644
--- a/bin/virt-sandbox.c
+++ b/bin/virt-sandbox.c
@@ -335,7 +335,12 @@ key=val pairs, separated by commas. The following options are valid
=item dhcp
Configure the network interface using dhcp. This key takes no value.
-No other keys may be specified.
+No other keys may be specified. eg
+
+ -N dhcp,source=default
+ --network dhcp,source=lan
+
+where 'source' is the name of any libvirt virtual network.
=item source=NETWORK
--
1.7.1
11 years, 7 months
[libvirt] [libvirt-sandbox][PATCH v2] Avoid segfault in gvir_sandbox_config_add_host_include_file
by Alex Jia
RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=924574
Valgrind defects memory error:
==19297== Invalid free() / delete / delete[] / realloc()
==19297== at 0x4A077A6: free (vg_replace_malloc.c:446)
==19297== by 0x350F24D79E: g_free (in /usr/lib64/libglib-2.0.so.0.3400.2)
==19297== by 0x4C2C03F: gvir_sandbox_config_add_host_include_file (libvirt-sandbox-config.c:1319)
==19297== by 0x401FB7: main (virt-sandbox.c:171)
==19297== Address 0x4f2094c is 12 bytes inside a block of size 18 alloc'd
==19297== at 0x4A0883C: malloc (vg_replace_malloc.c:270)
==19297== by 0x350F24D68E: g_malloc (in /usr/lib64/libglib-2.0.so.0.3400.2)
==19297== by 0x350F263F0B: g_strdup (in /usr/lib64/libglib-2.0.so.0.3400.2)
==19297== by 0x4C2BF95: gvir_sandbox_config_add_host_include_file (libvirt-sandbox-config.c:1292)
==19297== by 0x401FB7: main (virt-sandbox.c:171)
Signed-off-by: Alex Jia <ajia(a)redhat.com>
---
libvirt-sandbox/libvirt-sandbox-config.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libvirt-sandbox/libvirt-sandbox-config.c b/libvirt-sandbox/libvirt-sandbox-config.c
index fc852f5..a98f40b 100644
--- a/libvirt-sandbox/libvirt-sandbox-config.c
+++ b/libvirt-sandbox/libvirt-sandbox-config.c
@@ -1337,6 +1337,7 @@ gboolean gvir_sandbox_config_add_host_include_file(GVirSandboxConfig *config,
error))) {
const gchar *host;
gchar *guest;
+ const gchar *relguest;
GVirSandboxConfigMount *mnt = NULL;
GList *mnts = NULL;
gchar *tmp;
@@ -1354,8 +1355,10 @@ gboolean gvir_sandbox_config_add_host_include_file(GVirSandboxConfig *config,
mnt = GVIR_SANDBOX_CONFIG_MOUNT(mnts->data);
const gchar *target = gvir_sandbox_config_mount_get_target(mnt);
if (g_str_has_prefix(guest, target)) {
- guest = guest + strlen(target);
+ relguest = guest + strlen(target);
break;
+ } else {
+ relguest = guest;
}
mnt = NULL;
mnts = mnts->next;
@@ -1367,7 +1370,7 @@ gboolean gvir_sandbox_config_add_host_include_file(GVirSandboxConfig *config,
return FALSE;
}
- gvir_sandbox_config_mount_add_include(GVIR_SANDBOX_CONFIG_MOUNT(mnt), host, guest);
+ gvir_sandbox_config_mount_add_include(GVIR_SANDBOX_CONFIG_MOUNT(mnt), host, relguest);
g_free(guest);
g_free(line);
}
--
1.7.1
11 years, 7 months
[libvirt] [PATCH 0/5] Add domain modification impact flags to hot-management commands
by Peter Krempa
As promised in the RFC, this series adds the --live, --config, --current and
--persistent flags to virsh commands that were lacking them.
Peter Krempa (5):
virsh-domain: Fix declarations of flag variables in cmdChangeMedia
virsh: Fix semantics of --config for "update-device" command
virsh-domain: Add --live, --config, --current logic to
cmdDetachInterface
virsh-domain: Add --live, --config, --current logic to cmdDetachDevice
virsh-domain: Add --live, --config, --current logic to cmdDetachDisk
tools/virsh-domain.c | 225 ++++++++++++++++++++++++++++++++++++---------------
tools/virsh.pod | 66 ++++++++++-----
2 files changed, 206 insertions(+), 85 deletions(-)
--
1.8.1.5
11 years, 7 months
[libvirt] ocaml: prototype bindings for event callbacks
by David Scott
Hi,
I've made an prototype set of ocaml bindings for the libvirt event
mechanism -- here is what I've got so far.
It's possible to register for all the types supported by
virConnectDomainEventRegisterAny
I've not tested each type of event yet, but the basics are all working.
For every distinct callback function signature it maintains:
1. OCaml: a hashtable mapping callback_id (int64) to a specific closure
2. OCaml: a function registered with Callback.register
3. C: a function registered with libvirt, which upcalls to OCaml
There's still some missing polish, for example I've not implemented a
means to actually deregister a callback :-) I thought it would be best
to get feedback on the overall approach, style of the mapping etc first.
Comments and criticism greatly appreciated!
Thanks,
Dave
11 years, 7 months
[libvirt] [PATCH 0/3 RESENT] Fix virsh race and coredump
by Viktor Mihajlovski
Please consider for 1.0.4 as this prevents a potential data
corruption or segfault. The race is caused by referencing a
disposed connection object in a callback.
In the first patch we make sure that the object reference count
is reflecting the callback registration. This prevents a premature
disposal.
The second patch prevents the invocation of a NULL callback.
The last one tries to ensure that we don't leak connection
references in virsh.
Viktor Mihajlovski (3):
libvirt: Increase connection reference count for callbacks
remote: Don't call NULL closeFreeCallback
virsh: Unregister the connection close notifier upon termination
src/libvirt.c | 5 +++++
src/remote/remote_driver.c | 3 ++-
tools/virsh.c | 23 +++++++++++++++++------
3 files changed, 24 insertions(+), 7 deletions(-)
--
1.7.9.5
11 years, 7 months
[libvirt] How to get iteration time & downtime?
by Yuan, Ye A
Hi all,
I'm a graduate student in Shanghai, and will do experiment about live migration using KVM as hypervisor.
Due to my demand, I want to get each iteration time and downtime in migration.
I found there is no API to implement it, and how can I obtain data I want?
Thanks very much.
Best wishes,
Yale Yuan
11 years, 7 months
[libvirt] [PATCHv2] virsh-domain: Simplify usage of --current, --live and --config flags
by Peter Krempa
This patch uses the new helper to avoid the more complex check for
domain state modification flags.
---
Notes:
Version 2:
- remove unecessary usage of "if (current)"
- fix cmdSetmaxmem
- convert cmdMemtune too
tools/virsh-domain.c | 300 ++++++++++++++++++++-------------------------------
1 file changed, 118 insertions(+), 182 deletions(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 128e516..11db36b 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -1021,25 +1021,21 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd)
int nparams = 0;
int maxparams = 0;
virTypedParameterPtr params = NULL;
- unsigned int flags = 0, i = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
+ unsigned int i = 0;
int rv = 0;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool ret = false;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
goto cleanup;
@@ -1206,23 +1202,18 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd)
unsigned int i = 0;
virTypedParameterPtr params = NULL;
bool ret = false;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -2475,7 +2466,7 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd)
virDomainPtr dom;
const char *name = NULL, *device = NULL,
*inboundStr = NULL, *outboundStr = NULL;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
int nparams = 0;
int maxparams = 0;
virTypedParameterPtr params = NULL;
@@ -2486,18 +2477,13 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd)
virNetDevBandwidthRate inbound, outbound;
int i;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
return false;
@@ -4027,23 +4013,18 @@ cmdSchedinfo(vshControl *ctl, const vshCmd *cmd)
int nupdates = 0;
int i, ret;
bool ret_val = false;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -5478,23 +5459,18 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd)
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
bool query = false; /* Query mode if no cpulist */
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config)
+ flags = -1;
if (vshCommandOptStringReq(ctl, cmd, "cpulist", &cpulist) < 0)
return false;
@@ -5712,23 +5688,18 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd)
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
bool query = false; /* Query mode if no cpulist */
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config)
+ flags = -1;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -5911,23 +5882,18 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd)
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config && !maximum)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config && !maximum)
+ flags = -1;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -6608,18 +6574,13 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
bool ret = false;
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -7025,23 +6986,18 @@ cmdSetmem(vshControl *ctl, const vshCmd *cmd)
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config)
+ flags = -1;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -7127,22 +7083,18 @@ cmdSetmaxmem(vshControl *ctl, const vshCmd *cmd)
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
bool current = vshCommandOptBool(cmd, "current");
- unsigned int flags = VIR_DOMAIN_MEM_MAXIMUM;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT | VIR_DOMAIN_MEM_MAXIMUM;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- /* neither option is specified */
- if (!live && !config)
- flags = -1;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
+ /* none of the options were specified */
+ if (!current && !live && !config)
+ flags = -1;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -7264,23 +7216,18 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd)
unsigned int i = 0;
virTypedParameterPtr params = NULL;
bool ret = false;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -7435,24 +7382,19 @@ cmdNumatune(vshControl * ctl, const vshCmd * cmd)
virTypedParameterPtr params = NULL;
const char *nodeset = NULL;
bool ret = false;
- unsigned int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool current = vshCommandOptBool(cmd, "current");
bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
const char *mode = NULL;
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
@@ -9961,7 +9903,7 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
const char *doc = NULL;
xmlNodePtr disk_node = NULL;
const char *disk_xml = NULL;
- int flags = 0;
+ unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
bool config, live, current, force = false;
bool eject, insert, update = false;
bool ret = false;
@@ -9997,19 +9939,13 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd)
action = "update";
}
- if (current) {
- if (live || config) {
- vshError(ctl, "%s", _("--current must be specified exclusively"));
- return false;
- }
- flags = VIR_DOMAIN_AFFECT_CURRENT;
- } else {
- if (config)
- flags |= VIR_DOMAIN_AFFECT_CONFIG;
- if (live)
- flags |= VIR_DOMAIN_AFFECT_LIVE;
- }
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
+ if (live)
+ flags |= VIR_DOMAIN_AFFECT_LIVE;
if (force)
flags |= VIR_DOMAIN_DEVICE_MODIFY_FORCE;
--
1.8.1.5
11 years, 7 months
[libvirt] [PATCH] log: Separate thread ID from timestemp in ring buffer
by Jiri Denemark
When we write a log message into a log, we separate thread ID from
timestamp using ": ". However, when storing the message into the ring
buffer, we omitted the separator, e.g.:
2013-02-27 11:49:11.852+00003745: ...
---
src/util/virlog.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 957d993..721c9bd 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -850,6 +850,7 @@ virLogVMessage(virLogSource source,
*/
virLogLock();
virLogStr(timestamp);
+ virLogStr(": ");
virLogStr(msg);
virLogUnlock();
if (emit == 0)
--
1.8.1.5
11 years, 7 months