[libvirt] snapshots += domain description?
by Philipp Hahn
Hello,
I just encountered a problem with the current snapshot implementation for
qemu/kvm: To revert back to a snapshot, the domain description must closely
match the domain description when the snapshot was created. If the ram-size
doesn't match or the VM now contains fewer CPUs or contains additional disks,
kvm will either not load the snapshot or the machine will be broken
afterwarts.
Is this a known problem?
Without looking into the implementation details I think saving the full domain
description instead of just a reference to the domain uuid as part of the
snapshot description would work better. Or am I supposed to save the domain
description myself in addition the the data saved
in /var/lib/libvirt/qemu/snapshot/$DOMAIN_NAME/$SNAPSHOT_NAME.xml. I think
this is very important feature, because when you - for example - notice that
you need additional disk space and would like to include an additional block
device, this is your ideal time to take a snapshot you can revert to when you
do something wrong.
Looking at VMware I see that reverting a VM there will not only revert the
disks and ram back to the saved state, but also the description including
name, ram size, etc.
Any comment or advise is appreciated.
Sincerely
Philipp Hahn
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH Linux for Your Business fon: +49 421 22 232- 0
Mary-Somerville-Str.1 28359 Bremen fax: +49 421 22 232-99
http://www.univention.de
13 years, 4 months
[libvirt] Is there smt missing at Java bindings?
by kadir yüceer
Hello all,
I've been posting questions about my issue to the user list but it seems
nobody can answer, so I had to try this list, sorry if there is any
disturbance.
Here is the case:
I've been trying to develop a java app that can register callbacks for
domain lifecycle events(suspend,resume,etc.). Only method that I've seen is
Connect.VirDomainEventRegisterAny, and there is an abstract callback method
inside VirConnectDomainEventGenericCallback. I implement the callback, and
register it for all the domains by passing the domain pointer as NULL.
Additionally for testing, I've added a println into the suspend function in
org.libvirt.Domain.java, and compiled the java bindings and used the new jar
file, and I was successful, I can see the message whenever I suspend the
domain either by clicking *pause* or by writing dom.suspend() in my java
app.
However, when I try to register a callback as I mentioned in the beginning
(with eventID 0, which is life_cycle ID), after the suspend operation, I get
the error that you can see at the end of the mail.
But before you check it out, I have to ask, are some of the event-related
features of libvirt missing in java bindings? For example;
VirEventAddHandleFunc, VirEventAddHandleCallback, and their derivatives. Is
this a problem or the only Connect.VirDomainEventRegisterAny method of java
binding suffice for providing callbacks for domain events?
Thanks in advance for your responses. The error is below.
Kind Regards
Kadir
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00000000, pid=5692, tid=3077520240
#
# JRE version: 6.0_20-b20
# Java VM: OpenJDK Server VM (19.0-b09 mixed mode linux-x86 )
# Derivative: IcedTea6 1.9.7
# Distribution: Ubuntu 10.10, package 6b20-1.9.7-0ubuntu1
# Problematic frame:
# C 0x00000000
#
# An error report file with more information is saved as:
# /root/NetBeansProjects/NovaTest_v0.3/hs_err_pid5692.log
#
# If you would like to submit a bug report, please include
# instructions how to reproduce the bug and visit:
# https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Java Result: 134
13 years, 4 months
[libvirt] [PATCH] qemu: Fix -chardev udp if parameters are omitted
by Cole Robinson
The following XML:
<serial type='udp'>
<source mode='connect' service='9999'/>
</serial>
is accepted by domain_conf.c but maps to the qemu command line:
-chardev udp,host=127.0.0.1,port=2222,localaddr=(null),localport=(null)
qemu can cope with everything omitting except the connection port, which
seems to also be the intent of domain_conf validation, so let's not
generate bogus command lines for that case.
Additionally, tweak the qemu cli parsing to handle omitted host parameters
for -serial udp
---
src/qemu/qemu_command.c | 48 +++++++++++---------
.../qemuxml2argv-serial-udp-chardev.args | 6 ++-
.../qemuxml2argv-serial-udp-chardev.xml | 4 ++
.../qemuxml2argvdata/qemuxml2argv-serial-udp.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml | 4 ++
5 files changed, 39 insertions(+), 25 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c9b9850..231d7c3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2119,14 +2119,17 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
break;
case VIR_DOMAIN_CHR_TYPE_UDP:
- virBufferVSprintf(&buf,
- "udp,id=char%s,host=%s,port=%s,localaddr=%s,"
- "localport=%s",
+ virBufferVSprintf(&buf, "udp,id=char%s,port=%s",
alias,
- dev->data.udp.connectHost,
- dev->data.udp.connectService,
- dev->data.udp.bindHost,
- dev->data.udp.bindService);
+ dev->data.udp.connectService);
+
+ if (dev->data.udp.connectHost)
+ virBufferVSprintf(&buf, ",host=%s", dev->data.udp.connectHost);
+ if (dev->data.udp.bindHost)
+ virBufferVSprintf(&buf, ",localaddr=%s", dev->data.udp.bindHost);
+ if (dev->data.udp.bindService)
+ virBufferVSprintf(&buf, ",localport=%s",
+ dev->data.udp.bindService);
break;
case VIR_DOMAIN_CHR_TYPE_TCP:
@@ -2216,11 +2219,13 @@ qemuBuildChrArgStr(virDomainChrSourceDefPtr dev, const char *prefix)
break;
case VIR_DOMAIN_CHR_TYPE_UDP:
- virBufferVSprintf(&buf, "udp:%s:%s@%s:%s",
- dev->data.udp.connectHost,
- dev->data.udp.connectService,
- dev->data.udp.bindHost,
- dev->data.udp.bindService);
+ virBufferVSprintf(&buf, "udp:%s:%s",
+ dev->data.udp.connectHost ?: "",
+ dev->data.udp.connectService);
+ if (dev->data.udp.bindService)
+ virBufferVSprintf(&buf, "@%s:%s",
+ dev->data.udp.bindHost ?: "",
+ dev->data.udp.bindService);
break;
case VIR_DOMAIN_CHR_TYPE_TCP:
@@ -5302,13 +5307,12 @@ qemuParseCommandLineChr(const char *val)
host2 = svc1 ? strchr(svc1, '@') : NULL;
svc2 = host2 ? strchr(host2, ':') : NULL;
- if (svc1)
+ if (svc1 && (svc1 != val)) {
def->source.data.udp.connectHost = strndup(val, svc1-val);
- else
- def->source.data.udp.connectHost = strdup(val);
- if (!def->source.data.udp.connectHost)
- goto no_memory;
+ if (!def->source.data.udp.connectHost)
+ goto no_memory;
+ }
if (svc1) {
svc1++;
@@ -5323,14 +5327,14 @@ qemuParseCommandLineChr(const char *val)
if (host2) {
host2++;
- if (svc2)
+ if (svc2 && (svc2 != host2)) {
def->source.data.udp.bindHost = strndup(host2, svc2-host2);
- else
- def->source.data.udp.bindHost = strdup(host2);
- if (!def->source.data.udp.bindHost)
- goto no_memory;
+ if (!def->source.data.udp.bindHost)
+ goto no_memory;
+ }
}
+
if (svc2) {
svc2++;
def->source.data.udp.bindService = strdup(svc2);
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.args
index 7525110..8c6a6d5 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.args
@@ -2,6 +2,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -chardev socket,\
id=charmonitor,path=/tmp/test-monitor,server,nowait -mon chardev=charmonitor,\
id=monitor,mode=readline -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -chardev \
-udp,id=charserial0,host=127.0.0.1,port=9998,localaddr=127.0.0.1,localport=9999 \
--device isa-serial,chardev=charserial0,id=serial0 -usb -device \
+udp,id=charserial0,port=9998,host=127.0.0.1,localaddr=127.0.0.1,localport=9999 \
+-device isa-serial,chardev=charserial0,id=serial0 \
+-chardev udp,id=charserial1,port=9999 \
+-device isa-serial,chardev=charserial1,id=serial1 -usb -device \
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x2
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml
index 12622d4..9627c67 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp-chardev.xml
@@ -25,6 +25,10 @@
<source mode='connect' host='127.0.0.1' service='9998'/>
<target port='0'/>
</serial>
+ <serial type='udp'>
+ <source mode='connect' service='9999'/>
+ <target port='1'/>
+ </serial>
<console type='udp'>
<source mode='bind' host='127.0.0.1' service='9999'/>
<source mode='connect' host='127.0.0.1' service='9998'/>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args
index 53c69bc..cf25fe0 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.args
@@ -1,4 +1,4 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait \
-no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \
-udp:127.0.0.1:9998@127.0.0.1:9999 -parallel none -usb
+udp:127.0.0.1:9998@127.0.0.1:9999 -serial udp::9999 -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
index 8697f5a..f606ea4 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
+++ b/tests/qemuxml2argvdata/qemuxml2argv-serial-udp.xml
@@ -25,6 +25,10 @@
<source mode='connect' host='127.0.0.1' service='9998'/>
<target port='0'/>
</serial>
+ <serial type='udp'>
+ <source mode='connect' service='9999'/>
+ <target port='1'/>
+ </serial>
<console type='udp'>
<source mode='bind' host='127.0.0.1' service='9999'/>
<source mode='connect' host='127.0.0.1' service='9998'/>
--
1.7.4
13 years, 4 months
[libvirt] [BUG] Re: [2/6] loadvm: improve tests before bdrv_snapshot_goto()
by Philipp Hahn
Hello,
Am Dienstag 03 August 2010 06:44:26 schrieb Kevin Wolf:
> From: Miguel Di Ciurcio Filho <miguel.filho(a)gmail.com>
>
> This patch improves the resilience of the load_vmstate() function, doing
> further and better ordered tests.
This patch broke restoring not-running VMs using libvirt-0.8.7 with qemu-0.14:
When the domain is not running while taking a snpshot, the sn.vm_state_size
== 0:
2021 } else if (sn.vm_state_size == 0) {
(gdb) print sn
$6 = {id_str = "1", '\0' <repeats 126 times>, name = "pre-update-flash", '\0'
<repeats 239 times>, vm_state_size = 0, date_sec = 1302698007, date_nsec =
711909000,
vm_clock_nsec = 0}
> The [old] process:
...
> - run bdrv_snapshot_goto() on devices
> - if fails, give an warning and goes to the next (not good!)
> - if fails on the VM state device, return zero (not good!)
> - check if the requested snapshot exists on the device that saves the VM
> state and the state is not zero
> - if fails return -error
Previously the qcow2 image was still reverted to the old state, so on the next
start of the domain the qcow2 image would be in the state of the snapshot
> New behavior:
...
> - check if the requested snapshot exists on the device that saves the VM
> state and the state is not zero
> - if fails return -error
...
> - run snapshot_goto() on devices
Now the qcow2 image is not reverted and when the domain is started, it is NOT
in the state of the snapshot.
I can't decide if this regression is an Qemu bug or libvirt should be adapted
to this new behavior.
I found the Bug also reported with Ubuntu and created a Bug in our own German
bugtracker:
<https://bugs.launchpad.net/qemu/+bug/726619>
<https://forge.univention.org/bugzilla/show_bug.cgi?id=22221>
Sincerely
Philipp Hahn
--
Philipp Hahn Open Source Software Engineer hahn(a)univention.de
Univention GmbH Linux for Your Business fon: +49 421 22 232- 0
Mary-Somerville-Str.1 D-28359 Bremen fax: +49 421 22 232-99
http://www.univention.de/
13 years, 4 months
[libvirt] [PATCH] freebsd: Fix build problem due to picking up the wrong libvirt.h
by Matthias Bolte
AM_GNU_GETTEXT calls AM_ICONV_LINK. AM_ICONV_LINK saves and alters
CPPFLAGS, but doesn't restore it when it finds libiconv. This
results in /usr/local/include ending up in the gcc command line
before the include path for the local include directory. This makes
gcc pick a previous installed libvirt.h instead of the correct one
from the source tree.
Workaround this problem by saving and restoring CPPFLAGS around
the AM_GNU_GETTEXT call.
---
configure.ac | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index b2ba930..8f46dbd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2011,8 +2011,16 @@ dnl Enable building libvirtd?
AM_CONDITIONAL([WITH_LIBVIRTD],[test "x$with_libvirtd" = "xyes"])
dnl Check for gettext - don't go any newer than what RHEL 5 supports
+dnl
+dnl save and restore CPPFLAGS around gettext check as the internal iconv
+dnl check might leave -I/usr/local/include in CPPFLAGS on FreeBSD resulting
+dnl in the build picking up previously installed libvirt/libvirt.h instead
+dnl of the correct one from the soucre tree
+
+save_CPPFLAGS="$CPPFLAGS"
AM_GNU_GETTEXT_VERSION([0.17])
AM_GNU_GETTEXT([external])
+CPPFLAGS="$save_CPPFLAGS"
ALL_LINGUAS=`cd "$srcdir/po" > /dev/null && ls *.po | sed 's+\.po$++'`
--
1.7.0.4
13 years, 4 months
[libvirt] [PATCH] storage: fix volDelete return when volume still being allocated
by Matthew Booth
volDelete used to return VIR_ERR_INTERNAL_ERROR when attempting to delete a
volume which was still being allocated. It should return
VIR_ERR_OPERATION_INVALID.
* src/storage/storage_driver.c: Fix return of volDelete.
---
src/storage/storage_driver.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 2da2feb..d9c2137 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1914,7 +1914,7 @@ storageVolumeDelete(virStorageVolPtr obj,
}
if (vol->building) {
- virStorageReportError(VIR_ERR_INTERNAL_ERROR,
+ virStorageReportError(VIR_ERR_OPERATION_INVALID,
_("volume '%s' is still being allocated."),
vol->name);
goto cleanup;
--
1.7.4.4
13 years, 5 months
[libvirt] [V2 Patch] virsh: Change log level order
by Supriya Kannery
Change log level order so that messages at all other levels get logged
for "DEBUG" level. Replace magic numbers with corresponding VSH_ERR_xx.
Signed-off-by: Supriya Kannery <supriyak(a)in.ibm.com>
---
tools/virsh.c | 119
++++++++++++++++++++++++++++++++--------------------------
1 file changed, 67 insertions(+), 52 deletions(-)
Index: libvirt/tools/virsh.c
===================================================================
--- libvirt.orig/tools/virsh.c
+++ libvirt/tools/virsh.c
@@ -91,11 +91,11 @@ static char *progname;
* Indicates the level of a log message
*/
typedef enum {
- VSH_ERR_DEBUG = 0,
- VSH_ERR_INFO,
- VSH_ERR_NOTICE,
+ VSH_ERR_ERROR = 0,
VSH_ERR_WARNING,
- VSH_ERR_ERROR
+ VSH_ERR_NOTICE,
+ VSH_ERR_INFO,
+ VSH_ERR_DEBUG
} vshErrorLevel;
/*
@@ -2146,7 +2146,8 @@ cmdDominfo(vshControl *ctl, const vshCmd
/* Check and display whether the domain is persistent or not */
persistent = virDomainIsPersistent(dom);
- vshDebug(ctl, 5, "Domain persistent flag value: %d\n", persistent);
+ vshDebug(ctl, VSH_ERR_DEBUG, "Domain persistent flag value: %d\n",
+ persistent);
if (persistent < 0)
vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown"));
else
@@ -2928,7 +2929,7 @@ cmdSetvcpus(vshControl *ctl, const vshCm
/* If the --maximum flag was given, we need to ensure only the
--config flag is in effect as well */
if (maximum) {
- vshDebug(ctl, 5, "--maximum flag was given\n");
+ vshDebug(ctl, VSH_ERR_DEBUG, "--maximum flag was given\n");
/* If neither the --config nor --live flags were given, OR
if just the --live flag was given, we need to error out
@@ -4020,7 +4021,7 @@ repoll:
if ( timeout && ((int)(curr.tv_sec - start.tv_sec) * 1000 + \
(int)(curr.tv_usec - start.tv_usec) / 1000) >
timeout * 1000 ) {
/* suspend the domain when migration timeouts. */
- vshDebug(ctl, 5, "suspend the domain when migration
timeouts\n");
+ vshDebug(ctl, VSH_ERR_DEBUG, "suspend the domain when
migration timeouts\n");
virDomainSuspend(dom);
timeout = 0;
}
@@ -6125,7 +6126,8 @@ cmdPoolList(vshControl *ctl, const vshCm
/* Retrieve the persistence status of the pool */
if (details) {
persistent = virStoragePoolIsPersistent(pool);
- vshDebug(ctl, 5, "Persistent flag value: %d\n", persistent);
+ vshDebug(ctl, VSH_ERR_DEBUG, "Persistent flag value: %d\n",
+ persistent);
if (persistent < 0)
poolInfoTexts[i].persistent = vshStrdup(ctl,
_("unknown"));
else
@@ -6316,19 +6318,19 @@ cmdPoolList(vshControl *ctl, const vshCm
availStrLength = stringLength;
/* Display the string lengths for debugging. */
- vshDebug(ctl, 5, "Longest name string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest name string = %lu chars\n",
(unsigned long) nameStrLength);
- vshDebug(ctl, 5, "Longest state string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest state string = %lu chars\n",
(unsigned long) stateStrLength);
- vshDebug(ctl, 5, "Longest autostart string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest autostart string = %lu chars\n",
(unsigned long) autostartStrLength);
- vshDebug(ctl, 5, "Longest persistent string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest persistent string = %lu chars\n",
(unsigned long) persistStrLength);
- vshDebug(ctl, 5, "Longest capacity string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest capacity string = %lu chars\n",
(unsigned long) capStrLength);
- vshDebug(ctl, 5, "Longest allocation string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest allocation string = %lu chars\n",
(unsigned long) allocStrLength);
- vshDebug(ctl, 5, "Longest available string = %lu chars\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "Longest available string = %lu chars\n",
(unsigned long) availStrLength);
/* Create the output template. Each column is sized according to
@@ -6600,7 +6602,8 @@ cmdPoolInfo(vshControl *ctl, const vshCm
/* Check and display whether the pool is persistent or not */
persistent = virStoragePoolIsPersistent(pool);
- vshDebug(ctl, 5, "Pool persistent flag value: %d\n", persistent);
+ vshDebug(ctl, VSH_ERR_DEBUG, "Pool persistent flag value: %d\n",
+ persistent);
if (persistent < 0)
vshPrint(ctl, "%-15s %s\n", _("Persistent:"), _("unknown"));
else
@@ -6608,7 +6611,7 @@ cmdPoolInfo(vshControl *ctl, const vshCm
/* Check and display whether the pool is autostarted or not */
virStoragePoolGetAutostart(pool, &autostart);
- vshDebug(ctl, 5, "Pool autostart flag value: %d\n", autostart);
+ vshDebug(ctl, VSH_ERR_DEBUG, "Pool autostart flag value: %d\n",
autostart);
if (autostart < 0)
vshPrint(ctl, "%-15s %s\n", _("Autostart:"), _("no
autostart"));
else
@@ -6806,31 +6809,37 @@ cmdVolCreateAs(vshControl *ctl, const vs
if (snapshotStrVol) {
/* Lookup snapshot backing volume. Try the backing-vol
* parameter as a name */
- vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as name\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Look up backing store volume '%s' as name\n",
cmd->def->name, snapshotStrVol);
virStorageVolPtr snapVol = virStorageVolLookupByName(pool,
snapshotStrVol);
if (snapVol)
- vshDebug(ctl, 5, "%s: Backing store volume found using
'%s' as name\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Backing store volume found using '%s' as
name\n",
cmd->def->name, snapshotStrVol);
if (snapVol == NULL) {
/* Snapshot backing volume not found by name. Try the
* backing-vol parameter as a key */
- vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as
key\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Look up backing store volume '%s' as key\n",
cmd->def->name, snapshotStrVol);
snapVol = virStorageVolLookupByKey(ctl->conn, snapshotStrVol);
if (snapVol)
- vshDebug(ctl, 5, "%s: Backing store volume found using
'%s' as key\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Backing store volume found using '%s' as
key\n",
cmd->def->name, snapshotStrVol);
}
if (snapVol == NULL) {
/* Snapshot backing volume not found by key. Try the
* backing-vol parameter as a path */
- vshDebug(ctl, 5, "%s: Look up backing store volume '%s' as
path\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Look up backing store volume '%s' as path\n",
cmd->def->name, snapshotStrVol);
snapVol = virStorageVolLookupByPath(ctl->conn,
snapshotStrVol);
if (snapVol)
- vshDebug(ctl, 5, "%s: Backing store volume found using
'%s' as path\n",
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "%s: Backing store volume found using '%s' as
path\n",
cmd->def->name, snapshotStrVol);
}
if (snapVol == NULL) {
@@ -7777,11 +7786,16 @@ cmdVolList(vshControl *ctl, const vshCmd
allocStrLength = stringLength;
/* Display the string lengths for debugging */
- vshDebug(ctl, 5, "Longest name string = %zu chars\n", nameStrLength);
- vshDebug(ctl, 5, "Longest path string = %zu chars\n", pathStrLength);
- vshDebug(ctl, 5, "Longest type string = %zu chars\n", typeStrLength);
- vshDebug(ctl, 5, "Longest capacity string = %zu chars\n",
capStrLength);
- vshDebug(ctl, 5, "Longest allocation string = %zu chars\n",
allocStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest name string = %zu chars\n", nameStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest path string = %zu chars\n", pathStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest type string = %zu chars\n", typeStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest capacity string = %zu chars\n", capStrLength);
+ vshDebug(ctl, VSH_ERR_DEBUG,
+ "Longest allocation string = %zu chars\n", allocStrLength);
/* Create the output template */
ret = virAsprintf(&outputStr,
@@ -11535,7 +11549,7 @@ vshCommandOptDomainBy(vshControl *ctl, c
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11544,20 +11558,20 @@ vshCommandOptDomainBy(vshControl *ctl, c
/* try it by ID */
if (flag & VSH_BYID) {
if (virStrToLong_i(n, NULL, 10, &id) == 0 && id >= 0) {
- vshDebug(ctl, 5, "%s: <%s> seems like domain ID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> seems like domain ID\n",
cmd->def->name, optname);
dom = virDomainLookupByID(ctl->conn, id);
}
}
/* try it by UUID */
if (dom==NULL && (flag & VSH_BYUUID) &&
strlen(n)==VIR_UUID_STRING_BUFLEN-1) {
- vshDebug(ctl, 5, "%s: <%s> trying as domain UUID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as domain UUID\n",
cmd->def->name, optname);
dom = virDomainLookupByUUIDString(ctl->conn, n);
}
/* try it by NAME */
if (dom==NULL && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as domain NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as domain NAME\n",
cmd->def->name, optname);
dom = virDomainLookupByName(ctl->conn, n);
}
@@ -11581,7 +11595,7 @@ vshCommandOptNetworkBy(vshControl *ctl,
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11589,13 +11603,13 @@ vshCommandOptNetworkBy(vshControl *ctl,
/* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
- vshDebug(ctl, 5, "%s: <%s> trying as network UUID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network UUID\n",
cmd->def->name, optname);
network = virNetworkLookupByUUIDString(ctl->conn, n);
}
/* try it by NAME */
if (network==NULL && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as network NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as network NAME\n",
cmd->def->name, optname);
network = virNetworkLookupByName(ctl->conn, n);
}
@@ -11620,7 +11634,7 @@ vshCommandOptNWFilterBy(vshControl *ctl,
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11628,13 +11642,13 @@ vshCommandOptNWFilterBy(vshControl *ctl,
/* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
- vshDebug(ctl, 5, "%s: <%s> trying as nwfilter UUID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter UUID\n",
cmd->def->name, optname);
nwfilter = virNWFilterLookupByUUIDString(ctl->conn, n);
}
/* try it by NAME */
if (nwfilter == NULL && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as nwfilter NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as nwfilter NAME\n",
cmd->def->name, optname);
nwfilter = virNWFilterLookupByName(ctl->conn, n);
}
@@ -11658,7 +11672,7 @@ vshCommandOptInterfaceBy(vshControl *ctl
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11666,13 +11680,13 @@ vshCommandOptInterfaceBy(vshControl *ctl
/* try it by NAME */
if ((flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as interface NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface NAME\n",
cmd->def->name, optname);
iface = virInterfaceLookupByName(ctl->conn, n);
}
/* try it by MAC */
if ((iface == NULL) && (flag & VSH_BYMAC)) {
- vshDebug(ctl, 5, "%s: <%s> trying as interface MAC\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as interface MAC\n",
cmd->def->name, optname);
iface = virInterfaceLookupByMACString(ctl->conn, n);
}
@@ -11693,7 +11707,7 @@ vshCommandOptPoolBy(vshControl *ctl, con
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11701,13 +11715,13 @@ vshCommandOptPoolBy(vshControl *ctl, con
/* try it by UUID */
if ((flag & VSH_BYUUID) && (strlen(n) == VIR_UUID_STRING_BUFLEN-1)) {
- vshDebug(ctl, 5, "%s: <%s> trying as pool UUID\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool UUID\n",
cmd->def->name, optname);
pool = virStoragePoolLookupByUUIDString(ctl->conn, n);
}
/* try it by NAME */
if (pool == NULL && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as pool NAME\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as pool NAME\n",
cmd->def->name, optname);
pool = virStoragePoolLookupByName(ctl->conn, n);
}
@@ -11739,7 +11753,7 @@ vshCommandOptVolBy(vshControl *ctl, cons
if (p)
pool = vshCommandOptPoolBy(ctl, cmd, pooloptname, name, flag);
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
cmd->def->name, optname, n);
if (name)
@@ -11747,19 +11761,19 @@ vshCommandOptVolBy(vshControl *ctl, cons
/* try it by name */
if (pool && (flag & VSH_BYNAME)) {
- vshDebug(ctl, 5, "%s: <%s> trying as vol name\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol name\n",
cmd->def->name, optname);
vol = virStorageVolLookupByName(pool, n);
}
/* try it by key */
if (vol == NULL && (flag & VSH_BYUUID)) {
- vshDebug(ctl, 5, "%s: <%s> trying as vol key\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol key\n",
cmd->def->name, optname);
vol = virStorageVolLookupByKey(ctl->conn, n);
}
/* try it by path */
if (vol == NULL && (flag & VSH_BYUUID)) {
- vshDebug(ctl, 5, "%s: <%s> trying as vol path\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: <%s> trying as vol path\n",
cmd->def->name, optname);
vol = virStorageVolLookupByPath(ctl->conn, n);
}
@@ -11786,7 +11800,8 @@ vshCommandOptSecret(vshControl *ctl, con
if (vshCommandOptString(cmd, optname, &n) <= 0)
return NULL;
- vshDebug(ctl, 5, "%s: found option <%s>: %s\n", cmd->def->name,
optname, n);
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: found option <%s>: %s\n",
+ cmd->def->name, optname, n);
if (name != NULL)
*name = n;
@@ -11991,7 +12006,7 @@ get_data:
last->next = arg;
last = arg;
- vshDebug(ctl, 4, "%s: %s(%s): %s\n",
+ vshDebug(ctl, VSH_ERR_DEBUG, "%s: %s(%s): %s\n",
cmd->name,
opt->name,
opt->type != VSH_OT_BOOL ? _("optdata") :
_("bool"),
@@ -12416,7 +12431,7 @@ vshInit(vshControl *ctl)
debugEnv = getenv("VIRSH_DEBUG");
if (debugEnv) {
if (virStrToLong_i(debugEnv, NULL, 10, &ctl->debug) < 0 ||
- ctl->debug < VSH_ERR_DEBUG || ctl->debug > VSH_ERR_ERROR) {
+ ctl->debug > VSH_ERR_DEBUG || ctl->debug < VSH_ERR_ERROR) {
vshError(ctl, "%s",
_("VIRSH_DEBUG not set with a valid numeric
value"));
ctl->debug = VSH_ERR_DEBUG;
@@ -13088,7 +13103,7 @@ vshParseArgv(vshControl *ctl, int argc,
/* parse command */
ctl->imode = false;
if (argc - optind == 1) {
- vshDebug(ctl, 2, "commands: \"%s\"\n", argv[optind]);
+ vshDebug(ctl, VSH_ERR_NOTICE, "commands: \"%s\"\n",
argv[optind]);
return vshCommandStringParse(ctl, argv[optind]);
} else {
return vshCommandArgvParse(ctl, argc - optind, argv + optind);
13 years, 5 months
[libvirt] Appending REJECT rules.
by Stephen O'Dor
Greetings folks,
I've patched the libvirt iptables interface to append it's REJECT
rules rather than insert at the head. Idea being that I'm not the only
person who usually puts the REJECTs at the end of a chain.
In my particular case any custom ACCEPT rules involving the bridge
interfaces would get pushed below the rules that libvirt puts in to
REJECT everything on the bridge interface.
I'm using the routed network mode, I have no idea if this hurts any
other network mode.
Thanks,
-Steve
--- iptables.c 2011-02-28 23:03:32.000000000 -0800
+++ iptables.c_new 2011-05-18 14:00:59.110855881 -0700
@@ -51,7 +51,8 @@
enum {
ADD = 0,
- REMOVE
+ REMOVE,
+ APPEND
};
typedef struct
@@ -111,7 +112,7 @@
? IP6TABLES_PATH : IPTABLES_PATH);
virCommandAddArgList(cmd, "--table", rules->table,
- action == ADD ? "--insert" : "--delete",
+ action == ADD ? "--insert" : action ==
REMOVE ? "--delete" : "--append",
rules->chain, arg, NULL);
va_start(args, arg);
@@ -666,7 +667,7 @@
int family,
const char *iface)
{
- return iptablesForwardRejectOut(ctx, family, iface, ADD);
+ return iptablesForwardRejectOut(ctx, family, iface, APPEND);
}
/**
@@ -722,7 +723,7 @@
int family,
const char *iface)
{
- return iptablesForwardRejectIn(ctx, family, iface, ADD);
+ return iptablesForwardRejectIn(ctx, family, iface, APPEND);
}
/**
13 years, 6 months
[libvirt] [PATCH 0/2] Replace all remaining setgid calls with virSetUIDGID
by Jiri Denemark
Should we also ban setgid/setuid usage since we probably want to call
initgroups after them anyway?
Jiri Denemark (2):
util: Keep errno set to the root error after when returning from
virSetUIDGID
Replace all remaining setgid/setuid calls with virSetUIDGID
src/storage/storage_backend.c | 15 +----------
src/util/util.c | 53 +++++++++++++++++------------------------
2 files changed, 24 insertions(+), 44 deletions(-)
--
1.7.5.rc3
13 years, 6 months
[libvirt] [PATCH 0/6] Add support for injecting NMI to guest
by Lai Jiangshan
This patch series implements a feature of injecting NMI to guest,
which is accessible via new virDomainInjectNMI API and
'inject-nmi' command in virsh.
Lai Jiangshan (6):
inject-nmi: Defining the public API
inject-nmi: Defining the internal API
inject-nmi: Implementing the public API
inject-nmi: Implementing the remote protocol
inject-nmi: Expose the new API in virsh
qemu,inject-nmi: Implement the driver methods
daemon/remote.c | 26 ++++++++++++++++++++
daemon/remote_dispatch_args.h | 1 +
daemon/remote_dispatch_prototypes.h | 8 ++++++
daemon/remote_dispatch_table.h | 5 ++++
include/libvirt/libvirt.h.in | 2 +
src/driver.h | 4 +++
src/esx/esx_driver.c | 1 +
src/libvirt.c | 44 +++++++++++++++++++++++++++++++++++
src/libvirt_public.syms | 5 ++++
src/libxl/libxl_driver.c | 1 +
src/lxc/lxc_driver.c | 1 +
src/openvz/openvz_driver.c | 1 +
src/phyp/phyp_driver.c | 3 +-
src/qemu/qemu_driver.c | 43 ++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor.c | 14 +++++++++++
src/qemu/qemu_monitor.h | 2 +
src/qemu/qemu_monitor_json.c | 29 +++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 1 +
src/qemu/qemu_monitor_text.c | 20 ++++++++++++++++
src/qemu/qemu_monitor_text.h | 1 +
src/remote/remote_driver.c | 25 +++++++++++++++++++
src/remote/remote_protocol.c | 11 ++++++++
src/remote/remote_protocol.h | 10 ++++++++
src/remote/remote_protocol.x | 8 +++++-
src/remote_protocol-structs | 4 +++
src/test/test_driver.c | 1 +
src/uml/uml_driver.c | 1 +
src/vbox/vbox_tmpl.c | 1 +
src/vmware/vmware_driver.c | 1 +
src/xen/xen_driver.c | 1 +
src/xen/xen_driver.h | 1 +
src/xen/xen_hypervisor.c | 1 +
src/xen/xen_inotify.c | 1 +
src/xen/xend_internal.c | 1 +
src/xen/xm_internal.c | 1 +
src/xen/xs_internal.c | 1 +
src/xenapi/xenapi_driver.c | 1 +
tools/virsh.c | 36 ++++++++++++++++++++++++++++
tools/virsh.pod | 4 +++
39 files changed, 320 insertions(+), 2 deletions(-)
--
1.7.4
13 years, 6 months