[libvirt] LIBVIRT migration
by Marcela Castro León
Hello
I'm having problem using migration. I'm working on ubuntu 10.4 and this
versions of libvirt and virsh:
virsh # version
Compiled against library: libvir 0.7.5
Using library: libvir 0.7.5
Using API: QEMU 0.7.5
Running hypervisor: QEMU 0.12.3
This is the error.
*virsh # migrate scompi1 qemu+ssh://rionegro/system
error: Unknown failure
*
This is the log on the destination, that show that there is no communication
problem, but it has a problem starting the guest on destination.
radic@rionegro:~$ sudo cat /var/log/libvirt/qemu/scompi1.log
[sudo] password for radic:
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
QEMU_AUDIO_DRV=none /usr/bin/qemu-system-x86_64 -S -M pc-0.12 -enable-kvm -m
4096 -smp 4 -name scompi1 -uuid 355123af-b683-9fa6-ca31-10506c9ab9da
-chardev
socket,id=monitor,path=/var/lib/libvirt/qemu/scompi1.monitor,server,nowait
-monitor chardev:monitor -boot c -drive
file=/home/radic/mvdata/imagenes/scompi1.img,if=ide,index=0,boot=on,format=raw
-drive if=ide,media=cdrom,index=2,format=raw -net
nic,macaddr=52:54:00:05:d1:2a,vlan=0,model=virtio,name=virtio.0 -net
tap,fd=33,vlan=0,name=tap.0 -chardev pty,id=serial0 -serial chardev:serial0
-parallel none -usb -vnc 127.0.0.1:0 -vga cirrus -incoming tcp:0.0.0.0:49153
char device redirected to /dev/pts/1
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
QEMU_AUDIO_DRV=none /usr/bin/qemu-system-x86_64 -S -M pc-0.12 -enable-kvm -m
4096 -smp 4 -name scompi1 -uuid 355123af-b683-9fa6-ca31-10506c9ab9da
-chardev
socket,id=monitor,path=/var/lib/libvirt/qemu/scompi1.monitor,server,nowait
-monitor chardev:monitor -boot c -drive
file=/home/radic/mvdata/imagenes/scompi1.img,if=ide,index=0,boot=on,format=raw
-drive if=ide,media=cdrom,index=2,format=raw -net
nic,macaddr=52:54:00:05:d1:2a,vlan=0,model=virtio,name=virtio.0 -net
tap,fd=33,vlan=0,name=tap.0 -chardev pty,id=serial0 -serial chardev:serial0
-parallel none -usb -vnc 127.0.0.1:0 -vga cirrus -incoming tcp:0.0.0.0:49154
char device redirected to /dev/pts/2
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
QEMU_AUDIO_DRV=none /usr/bin/qemu-system-x86_64 -S -M pc-0.12 -enable-kvm -m
4096 -smp 4 -name scompi1 -uuid 355123af-b683-9fa6-ca31-10506c9ab9da
-chardev
socket,id=monitor,path=/var/lib/libvirt/qemu/scompi1.monitor,server,nowait
-monitor chardev:monitor -boot c -drive
file=/home/radic/mvdata/imagenes/scompi1.img,if=ide,index=0,boot=on,format=raw
-drive if=ide,media=cdrom,index=2,format=raw -net
nic,macaddr=52:54:00:05:d1:2a,vlan=0,model=virtio,name=virtio.0 -net
tap,fd=33,vlan=0,name=tap.0 -chardev pty,id=serial0 -serial chardev:serial0
-parallel none -usb -vnc 127.0.0.1:0 -vga cirrus -incoming tcp:0.0.0.0:49155
char device redirected to /dev/pts/2
I'm attaching the xml of the scompi1 that i'm trying to migrate.
I'd apprciate a lot any help.
Marcela
13 years, 7 months
[libvirt] [libvirt-snmp][PATCH v4 0/4] Add SNMP trap/notification support
by Michal Privoznik
The fourth version.
In case we build against libvirt older than 0.9.0 (which have old event API),
we need to include some sources from libvirt git. So we are able to run even
on older RHELs, like 5.6. Those files were copied to our git and modified
very slighty.
Finally, we have a proof-of-concept implementation of SNMP trap.
Two new files were first generated using mib2c then edited, so be
careful when re-generating them.
Destination of traps is defined in snmpd.conf (trap2sink), and to
receive them snmptrapd must be configured and up.
The idea behind is - create a thread in which we poll for domain
events. Once we receive event notification, we just fire up
trap sending.
Michal Privoznik (4):
Add notification-type object to libvirt MIB
Add libvirt error handling function
Create functions to fill in and send notification packets.
Add SNMP trap/notification support.
INSTALL.1st | 9 +-
configure.ac | 17 +-
libvirt-snmp.spec.in | 7 +-
src/LIBVIRT-MIB.txt | 9 +
src/Makefile.am | 27 ++-
src/README.txt | 9 +-
src/event.c | 193 ++++++++++++
src/event.h | 101 ++++++
src/event_poll.c | 724 ++++++++++++++++++++++++++++++++++++++++++++
src/event_poll.h | 132 ++++++++
src/ignore-value.h | 64 ++++
src/internal.h | 265 ++++++++++++++++
src/libvirtNotifications.c | 122 ++++++++
src/libvirtNotifications.h | 33 ++
src/libvirtSnmp.c | 136 ++++++++-
src/libvirtSnmpError.c | 34 ++
src/libvirtSnmpError.h | 31 ++
src/memory.c | 313 +++++++++++++++++++
src/memory.h | 212 +++++++++++++
src/threads.c | 251 +++++++++++++++
src/threads.h | 101 ++++++
src/util.c | 105 +++++++
src/util.h | 38 +++
23 files changed, 2919 insertions(+), 14 deletions(-)
create mode 100644 src/event.c
create mode 100644 src/event.h
create mode 100644 src/event_poll.c
create mode 100644 src/event_poll.h
create mode 100644 src/ignore-value.h
create mode 100644 src/internal.h
create mode 100644 src/libvirtNotifications.c
create mode 100644 src/libvirtNotifications.h
create mode 100644 src/libvirtSnmpError.c
create mode 100644 src/libvirtSnmpError.h
create mode 100644 src/memory.c
create mode 100644 src/memory.h
create mode 100644 src/threads.c
create mode 100644 src/threads.h
create mode 100644 src/util.c
create mode 100644 src/util.h
--
1.7.4
13 years, 7 months
Re: [libvirt] [Qemu-devel] [PATCH v2 3/3] raw-posix: Re-open host CD-ROM after media change
by Stefan Hajnoczi
On Tue, Mar 29, 2011 at 8:04 PM, Stefan Hajnoczi
<stefanha(a)linux.vnet.ibm.com> wrote:
> Piggy-back on the guest CD-ROM polling to poll on the host. Open and
> close the host CD-ROM file descriptor to ensure we read the new size and
> not a stale size.
>
> Two things are going on here:
>
> 1. If hald/udisks is not already polling CD-ROMs on the host then
> re-opening the CD-ROM causes the host to read the new medium's size.
>
> 2. There is a bug in Linux which means the CD-ROM file descriptor must
> be re-opened in order for lseek(2) to see the new size. The
> inode size gets out of sync with the underlying device (which you can
> confirm by checking that /sys/block/sr0/size and lseek(2) do not
> match after media change). I have raised this with the
> maintainers but we need a workaround for the foreseeable future.
>
> Note that these changes are all in a #ifdef __linux__ section.
>
> Signed-off-by: Stefan Hajnoczi <stefanha(a)linux.vnet.ibm.com>
> ---
> block/raw-posix.c | 26 ++++++++++++++++++++++----
> 1 files changed, 22 insertions(+), 4 deletions(-)
>
> diff --git a/block/raw-posix.c b/block/raw-posix.c
> index 6b72470..8b5205c 100644
> --- a/block/raw-posix.c
> +++ b/block/raw-posix.c
> @@ -1238,10 +1238,28 @@ static int cdrom_is_inserted(BlockDriverState *bs)
> BDRVRawState *s = bs->opaque;
> int ret;
>
> - ret = ioctl(s->fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);
> - if (ret == CDS_DISC_OK)
> - return 1;
> - return 0;
> + /*
> + * Close the file descriptor if no medium is present and open it to poll
> + * again. This ensures the medium size is refreshed. If the file
> + * descriptor is kept open the size can become stale. This is essentially
> + * replicating CD-ROM polling but is driven by the guest. As the guest
> + * polls, we poll the host.
> + */
> +
> + if (s->fd == -1) {
> + s->fd = qemu_open(bs->filename, s->open_flags, 0644);
> + if (s->fd < 0) {
> + return 0;
> + }
> + }
> +
> + ret = (ioctl(s->fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) == CDS_DISC_OK);
> +
> + if (!ret) {
> + close(s->fd);
> + s->fd = -1;
> + }
> + return ret;
> }
>
> static int cdrom_eject(BlockDriverState *bs, int eject_flag)
> --
> 1.7.4.1
>
>
>
There is an issue with reopening host devices in QEMU when running
under libvirt. It appears that libvirt chowns image files (including
device nodes) so that the launched QEMU process can access them.
Unfortunately after media change on host devices udev will reset the
ownership of the device node. This causes open(2) to fail with EACCES
since the QEMU process does not have the right uid/gid/groups and
libvirt is unaware that the file's ownership has changed.
In order for media change to work with Linux host CD-ROM it is
necessary to reopen the file (otherwise the inode size will not
refresh, this is an issue with existing kernels).
How can libvirt's security model be made to support this case? In
theory udev could be temporarily configured with libvirt permissions
for the CD-ROM device while passed through to the guest, but is that
feasible?
Stefan
13 years, 7 months
[libvirt] [PATCH] qemu: unlock qemu driver before return
by Hu Tao
---
src/qemu/qemu_driver.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 104e92d..6e3edde 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2068,12 +2068,14 @@ static int qemudDomainSave(virDomainPtr dom, const char *path)
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Invalid save image format specified "
"in configuration file"));
+ qemuDriverUnlock(driver);
return -1;
}
if (!qemudCompressProgramAvailable(compressed)) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("Compression program for image format "
"in configuration file isn't available"));
+ qemuDriverUnlock(driver);
return -1;
}
}
--
1.7.3.1
13 years, 7 months
[libvirt] qemu: Add timeout for monitor to avoid virsh getting stuck when monitor gets die.
by Mark Wu
Hello Guys,
When the qemu process becomes hung, virsh will get stuck on the hung
guest and can't move forward. It can be reproduced by the following steps:
1. setup a virt guest with qemu-kvm, and start it
2. stop qemu process with following:
kill -STOP `ps aux | grep qemu | grep -v grep | awk '{print $2}'`
3. run the following command:
virsh list
I think we can add a timeout for qemu monitor to resolve this problem:
using virCondWaitUntil instead of virCondWait in qemuMonitorSend. What's
your opinions?
Thanks!
13 years, 7 months
[libvirt] [PATCH 0/2] Log enhancement
by Naoya Horiguchi
Hi,
Following patches improve logging feature of libvirt.
Please see individual patches for more details.
[PATCH 1/2] extend logging to record configuration-related events on host machine
[PATCH 2/2] qemu: extend logging to record guest configuration events
Thanks,
Naoya Horiguchi
13 years, 7 months
[libvirt] [PATCH] Allow relative path for qemu backing file
by Jesse Cook
This patch enables the relative backing file path support provided by
qemu-img create.
If a relative path is specified for the backing file, it is converted
to an absolute path using the storage pool path. The absolute path is
used to verify that the backing file exists. If the backing file exists,
the relative path is allowed and will be provided to qemu-img create.
This patch takes the place of a previous patch:
http://www.redhat.com/archives/libvir-list/2011-March/msg00179.html
---
src/storage/storage_backend.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 2eede74..abdc2dd 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -666,6 +666,9 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
}
if (vol->backingStore.path) {
+ int accessRetCode = -1;
+
+ char *absolutePath = NULL;
/* XXX: Not strictly required: qemu-img has an option a different
* backing store, not really sure what use it serves though, and it
@@ -686,7 +689,20 @@ virStorageBackendCreateQemuImg(virConnectPtr conn,
vol->backingStore.format);
return -1;
}
- if (access(vol->backingStore.path, R_OK) != 0) {
+
+ /* Convert relative backing store paths to absolute paths for access
+ * validation.
+ */
+ if ('/' != *(vol->backingStore.path)) {
+ virAsprintf(&absolutePath, "%s/%s", pool->def->target.path,
+ vol->backingStore.path);
+
+ } else {
+ virAsprintf(&absolutePath, "%s", vol->backingStore.path);
+ }
+ accessRetCode = access(absolutePath, R_OK);
+ VIR_FREE(absolutePath);
+ if (accessRetCode != 0) {
virReportSystemError(errno,
_("inaccessible backing store volume %s"),
vol->backingStore.path);
--
1.7.4.1
13 years, 7 months
[libvirt] [PATCH] libxl: avoid compiler warning
by Eric Blake
cc1: warnings being treated as errors
libxl/libxl_driver.c: In function 'libxlDomainSetVcpusFlags':
libxl/libxl_driver.c:1570:14: error: cast from function call of type 'double' to non-matching type 'unsigned int' [-Wbad-function-cast]
libxl/libxl_driver.c:1578:15: error: cast from function call of type 'double' to non-matching type 'unsigned int' [-Wbad-function-cast]
This was the only use of floor() and ceil(), and floating-point
is overkill for power-of-two manipulations.
* src/libxl/libxl_driver.c (libxlDomainSetVcpusFlags): Avoid -lm
for trivial computations.
---
Pushing under the build-breaker rule.
src/libxl/libxl_driver.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 75f99c1..8cc4469 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1567,15 +1567,14 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
if (!(def = virDomainObjGetPersistentDef(driver->caps, vm)))
goto cleanup;
- maplen = (unsigned int) ceil((double) nvcpus / 8);
+ maplen = VIR_CPU_MAPLEN(nvcpus);
if (VIR_ALLOC_N(bitmask, maplen) < 0) {
virReportOOMError();
goto cleanup;
}
- memset(bitmask, 0, maplen);
for (i = 0; i < nvcpus; ++i) {
- pos = (unsigned int) floor((double) i / 8);
+ pos = i / 8;
bitmask[pos] |= 1 << (i % 8);
}
--
1.7.4
13 years, 7 months
[libvirt] [PATCH] Fix typo in systemtap tapset directrory name
by Daniel P. Berrange
The systemtap directory for tapsets is called
/usr/share/systemtap/tapset
Not
/usr/share/systemtap/tapsets
* daemon/Makefile.am,libvirt.spec.in: s/tapsets/tapset/
---
daemon/Makefile.am | 2 +-
libvirt.spec.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 0fde04c..cacec1c 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -165,7 +165,7 @@ nodist_libvirtd_SOURCES = probes.h
BUILT_SOURCES += probes.h
-tapsetdir = $(datadir)/systemtap/tapsets
+tapsetdir = $(datadir)/systemtap/tapset
tapset_DATA = libvirtd.stp
probes.h: probes.d
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 724b9b7..4162fba 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -898,7 +898,7 @@ fi
%config(noreplace) %{_sysconfdir}/sysconfig/libvirtd
%config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf
%if %{with_dtrace}
-%{_datadir}/systemtap/tapsets/libvirtd.stp
+%{_datadir}/systemtap/tapset/libvirtd.stp
%endif
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/qemu/
%dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/lxc/
--
1.7.4
13 years, 7 months