[libvirt] qemu or kvm?
by Jun Koi
Hi,
Given a virDomainPtr variable, how can we know that it is a QEMU or
KVM machine? Is there any API for that?
Many thanks,
Jun
16 years, 2 months
[libvirt] [PATCH] Fix segfault if no qemu emulator passed
by Cole Robinson
There is unfortunately a pretty prevalent
segfault in the latest libvirt. If a qemu
domain is defined without an emulator
specified, libvirtd crashes.
This is doubly unfortunate since current
virtinst generates an emulator-less config
for all qemu and kvm guests (I'm about to fix
this upstream though).
Attached patch fixes this.
Thanks,
Cole
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index d742c32..23ef050 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -790,7 +790,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
if (!emulator)
return -1;
- ADD_ARG_LIT(vm->def->emulator);
+ ADD_ARG_LIT(emulator);
ADD_ARG_LIT("-S");
ADD_ARG_LIT("-M");
ADD_ARG_LIT(vm->def->os.machine);
16 years, 2 months
[libvirt] Sharing file between host and guest
by Yushu Yao
Hi All,
Question not very related to libvirt but I think most of the real VM
experts are in this list.
What is the best and fastest way to share files between guest and host?
Something like the share folders-hgfs in vmware might work, but is there a
way that works on all hypervisors?
Network based file sharing (NFS/Samba) are limited by the speed of the
virtual network interfaces. Maybe one can do it through USB?
Thanks a lot!
-yushu
16 years, 2 months
[libvirt] [PATCH] make consistent assumptions about libvirtd dependence
by David Lively
Hi -
Currently src/Makefile.am says that only the QEMU, LXC, and storage
drivers are dependent on libvirtd. But the driver registration code in
virInitialize wasn't registering the remote or openVz driver when
WITH_LIBVIRTD was not defined. The attached patch makes the
virInitialize code consistent with the assumptions stated in
src/Makefile.am.
But note I'm assuming the assumptions in src/Makefile.am are correct.
I'm not sure what's really dependent on libvirtd, so Someone Who Knows
Better should verify this.
Thanks,
Dave
commit 24d5708877fce90c4e85e3b2ede07b74f4a98224
Author: David Lively <dlively(a)virtualiron.com>
Date: Thu Sep 11 11:56:20 2008 -0400
Make driver registration assume the same libvirtd dependences
expressed in src/Makefile.am (i.e., that only the QEMU, LXC, and storage
drivers depend on libvirtd).
diff --git a/src/libvirt.c b/src/libvirt.c
index 54ed8cf..3d66f5a 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -286,20 +286,20 @@ virInitialize(void)
#ifdef WITH_XEN
if (xenUnifiedRegister () == -1) return -1;
#endif
-#ifdef WITH_LIBVIRTD
-#ifdef WITH_QEMU
- if (qemudRegister() == -1) return -1;
+#ifdef WITH_REMOTE
+ if (remoteRegister () == -1) return -1;
#endif
#ifdef WITH_OPENVZ
if (openvzRegister() == -1) return -1;
#endif
+#ifdef WITH_LIBVIRTD
+#ifdef WITH_QEMU
+ if (qemudRegister() == -1) return -1;
+#endif
#ifdef WITH_LXC
if (lxcRegister() == -1) return -1;
#endif
if (storageRegister() == -1) return -1;
-#ifdef WITH_REMOTE
- if (remoteRegister () == -1) return -1;
-#endif
#endif
return(0);
16 years, 2 months
[libvirt] PATCH: Latest MinGW patches
by Daniel P. Berrange
I've got a MinGW build environment setup on Fedora 10 now, so just checked
out what the latest state of libvirt CVS is.
With the attached patch, I can run configure with:
./configure \
--build=i686-pc-linux-gnu \
--host=i686-pc-mingw32 \
--prefix=/usr/i686-pc-mingw32/sys-root/mingw \
--without-libvirtd \
--without-xen \
--without-qemu \
--without-sasl \
--without-lxc \
--without-openvz \
--without-python
So, basically only the 'test' and 'remote' drivers are turned on. And do
a build which produces a libvirt-0.dll and a virsh.exe which is I can
run under Wine successfully.
The changes:
- The src/Makefile.am was conditionally turning off individual storage
driver backends, based on the WITH_LIBVIRTD conditional. THis gave
confusing diagnositics, since the configure summary said they were
turned on.
So, now configure itself turns off the storage drivers if libvirtd
is disabled.
- The storage_backend.c file is used by storage_Conf.c, so we need
to compile this even if all storage backends are disabled. So we
tweak src/Makefile.am to achieve this, and add a few more bits of
conditional logic inside storage_backend.c to cope with the base
directory pool driver not being available.
- Mingw is missing regex.h and sys/wait.h, which are used in the
generic storage_backend.c file. We check for those in configure
and conditionalize their inclusion. Furthermore we disable the
virStorageBackendRunProgRegex and virStorageBackendRunProgNul
functions on Windows, since they're not required and not compilable
without regex.h / sys/wait.h
- Mingw is mising getuid() and getgid() which are used in the storage_conf
XML parser. We check for and optionally disable them and initialize
uid/gid to 0 if missing.
- The virExec() stub routine for Mingw didn't have its signature updated
when i did the recent virExe changes. THis fixes that.
configure.in | 18 +++++++++++++---
qemud/remote_protocol.c | 1
qemud/remote_protocol.h | 1
qemud/remote_protocol.x | 1
src/Makefile.am | 6 ++---
src/storage_backend.c | 53 +++++++++++++++++++++++++++++++++++++++++++-----
src/storage_conf.c | 22 +++++++++++++++++--
src/util.c | 17 +++------------
8 files changed, 92 insertions(+), 27 deletions(-)
Daniel
diff -r 74dd97c354cc configure.in
--- a/configure.in Tue Sep 02 10:49:53 2008 -0400
+++ b/configure.in Wed Sep 03 08:24:04 2008 -0400
@@ -65,10 +65,10 @@
AC_SYS_LARGEFILE
dnl Availability of various common functions (non-fatal if missing).
-AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity])
+AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity getuid getgid])
dnl Availability of various common headers (non-fatal if missing).
-AC_CHECK_HEADERS([pwd.h paths.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h])
+AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h])
dnl Where are the XDR functions?
dnl If portablexdr is installed, prefer that.
@@ -648,6 +648,18 @@
[ --with-storage-iscsi with iSCSI backend for the storage driver (on)],[],[with_storage_iscsi=check])
AC_ARG_WITH([storage-disk],
[ --with-storage-disk with GPartd Disk backend for the storage driver (on)],[],[with_storage_disk=check])
+
+with_storage_dir=yes
+if test "$with_libvirtd" = "no"; then
+ with_storage_dir=no
+ with_storage_fs=no
+ with_storage_lvm=no
+ with_storage_iscsi=no
+ with_storage_disk=no
+fi
+
+AM_CONDITIONAL([WITH_STORAGE_DIR], [test "$with_storage_dir" = "yes"])
+
if test "$with_storage_fs" = "yes" -o "$with_storage_fs" = "check"; then
AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin])
@@ -1053,7 +1065,7 @@
AC_MSG_NOTICE([])
AC_MSG_NOTICE([Storage Drivers])
AC_MSG_NOTICE([])
-AC_MSG_NOTICE([ Dir: yes])
+AC_MSG_NOTICE([ Dir: $with_storage_dir])
AC_MSG_NOTICE([ FS: $with_storage_fs])
AC_MSG_NOTICE([ NetFS: $with_storage_fs])
AC_MSG_NOTICE([ LVM: $with_storage_lvm])
diff -r 74dd97c354cc qemud/remote_protocol.c
--- a/qemud/remote_protocol.c Tue Sep 02 10:49:53 2008 -0400
+++ b/qemud/remote_protocol.c Wed Sep 03 08:24:04 2008 -0400
@@ -6,6 +6,7 @@
#include "remote_protocol.h"
#include <config.h>
#include "internal.h"
+#include "socketcompat.h"
bool_t
xdr_remote_nonnull_string (XDR *xdrs, remote_nonnull_string *objp)
diff -r 74dd97c354cc qemud/remote_protocol.h
--- a/qemud/remote_protocol.h Tue Sep 02 10:49:53 2008 -0400
+++ b/qemud/remote_protocol.h Wed Sep 03 08:24:04 2008 -0400
@@ -15,6 +15,7 @@
#include <config.h>
#include "internal.h"
+#include "socketcompat.h"
#define REMOTE_MESSAGE_MAX 262144
#define REMOTE_STRING_MAX 65536
diff -r 74dd97c354cc qemud/remote_protocol.x
--- a/qemud/remote_protocol.x Tue Sep 02 10:49:53 2008 -0400
+++ b/qemud/remote_protocol.x Wed Sep 03 08:24:04 2008 -0400
@@ -38,6 +38,7 @@
%#include <config.h>
%#include "internal.h"
+%#include "socketcompat.h"
/*----- Data types. -----*/
diff -r 74dd97c354cc src/Makefile.am
--- a/src/Makefile.am Tue Sep 02 10:49:53 2008 -0400
+++ b/src/Makefile.am Wed Sep 03 08:24:04 2008 -0400
@@ -58,7 +58,8 @@
# Storage driver generic impl APIs
STORAGE_CONF_SOURCES = \
- storage_conf.h storage_conf.c
+ storage_conf.h storage_conf.c \
+ storage_backend.h storage_backend.c
# The remote RPC driver, covering domains, storage, networks, etc
@@ -109,8 +110,7 @@
# And finally storage backend specific impls
STORAGE_DRIVER_SOURCES = \
- storage_driver.h storage_driver.c \
- storage_backend.h storage_backend.c
+ storage_driver.h storage_driver.c
STORAGE_DRIVER_FS_SOURCES = \
storage_backend_fs.h storage_backend_fs.c
diff -r 74dd97c354cc src/storage_backend.c
--- a/src/storage_backend.c Tue Sep 02 10:49:53 2008 -0400
+++ b/src/storage_backend.c Wed Sep 03 08:24:04 2008 -0400
@@ -24,9 +24,13 @@
#include <config.h>
#include <string.h>
+#if HAVE_REGEX_H
#include <regex.h>
+#endif
#include <sys/types.h>
+#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
+#endif
#include <unistd.h>
#include <fcntl.h>
#include <stdint.h>
@@ -38,6 +42,10 @@
#endif
#include "internal.h"
+#include "util.h"
+#include "memory.h"
+
+#include "storage_backend.h"
#if WITH_STORAGE_LVM
#include "storage_backend_logical.h"
@@ -48,15 +56,14 @@
#if WITH_STORAGE_DISK
#include "storage_backend_disk.h"
#endif
-
-#include "util.h"
-#include "memory.h"
-
-#include "storage_backend.h"
+#if WITH_STORAGE_DIR
#include "storage_backend_fs.h"
+#endif
static virStorageBackendPtr backends[] = {
+#if WITH_STORAGE_DIR
&virStorageBackendDirectory,
+#endif
#if WITH_STORAGE_FS
&virStorageBackendFileSystem,
&virStorageBackendNetFileSystem,
@@ -209,8 +216,12 @@
return -2;
if (S_ISREG(sb.st_mode)) {
+#ifndef __MINGW32__
vol->allocation = (unsigned long long)sb.st_blocks *
(unsigned long long)sb.st_blksize;
+#else
+ vol->allocation = sb.st_size;
+#endif
/* Regular files may be sparse, so logical size (capacity) is not same
* as actual allocation above
*/
@@ -337,6 +348,8 @@
return devpath;
}
+
+#ifndef __MINGW32__
/*
* Run an external program.
*
@@ -620,3 +633,33 @@
return 0;
}
+
+#else
+
+int
+virStorageBackendRunProgRegex(virConnectPtr conn,
+ virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+ const char *const*prog ATTRIBUTE_UNUSED,
+ int nregex ATTRIBUTE_UNUSED,
+ const char **regex ATTRIBUTE_UNUSED,
+ int *nvars ATTRIBUTE_UNUSED,
+ virStorageBackendListVolRegexFunc func ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED,
+ int *outexit ATTRIBUTE_UNUSED)
+{
+ virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s no implemented on Win32", __FUNCTION__);
+ return -1;
+}
+
+int
+virStorageBackendRunProgNul(virConnectPtr conn,
+ virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
+ const char **prog ATTRIBUTE_UNUSED,
+ size_t n_columns ATTRIBUTE_UNUSED,
+ virStorageBackendListVolNulFunc func ATTRIBUTE_UNUSED,
+ void *data ATTRIBUTE_UNUSED)
+{
+ virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s no implemented on Win32", __FUNCTION__);
+ return -1;
+}
+#endif
diff -r 74dd97c354cc src/storage_conf.c
--- a/src/storage_conf.c Tue Sep 02 10:49:53 2008 -0400
+++ b/src/storage_conf.c Wed Sep 03 08:24:04 2008 -0400
@@ -188,7 +188,11 @@
}
if (virXPathNode(conn, "/pool/permissions/owner", ctxt) == NULL) {
+#if HAVE_GETUID
perms->uid = getuid();
+#else
+ perms->uid = 0;
+#endif
} else {
if (virXPathLong(conn, "number(/pool/permissions/owner)", ctxt, &v) < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
@@ -199,7 +203,11 @@
}
if (virXPathNode(conn, "/pool/permissions/group", ctxt) == NULL) {
- perms->uid = getgid();
+#if HAVE_GETGID
+ perms->gid = getgid();
+#else
+ perms->gid = 0;
+#endif
} else {
if (virXPathLong(conn, "number(/pool/permissions/group)", ctxt, &v) < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
@@ -407,7 +415,7 @@
if (!xml) {
if (conn && conn->err.code == VIR_ERR_NONE)
virStorageReportError(conn, VIR_ERR_XML_ERROR,
- _("failed to parse xml document"));
+ "%s",_("failed to parse xml document"));
goto cleanup;
}
@@ -569,7 +577,11 @@
}
if (virXPathNode(conn, "/volume/permissions/owner", ctxt) == NULL) {
+#if HAVE_GETUID
perms->uid = getuid();
+#else
+ perms->uid = 0;
+#endif
} else {
if (virXPathLong(conn, "number(/volume/permissions/owner)", ctxt, &v) < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
@@ -579,7 +591,11 @@
perms->uid = (int)v;
}
if (virXPathNode(conn, "/volume/permissions/group", ctxt) == NULL) {
+#if HAVE_GETGID
perms->gid = getgid();
+#else
+ perms->gid = 0;
+#endif
} else {
if (virXPathLong(conn, "number(/volume/permissions/group)", ctxt, &v) < 0) {
virStorageReportError(conn, VIR_ERR_XML_ERROR,
@@ -778,7 +794,7 @@
if (!xml) {
if (conn && conn->err.code == VIR_ERR_NONE)
virStorageReportError(conn, VIR_ERR_XML_ERROR,
- _("failed to parse xml document"));
+ "%s", _("failed to parse xml document"));
goto cleanup;
}
diff -r 74dd97c354cc src/util.c
--- a/src/util.c Tue Sep 02 10:49:53 2008 -0400
+++ b/src/util.c Wed Sep 03 08:24:04 2008 -0400
@@ -440,22 +440,13 @@
int
virExec(virConnectPtr conn,
const char *const*argv ATTRIBUTE_UNUSED,
+ const char *const*envp ATTRIBUTE_UNUSED,
+ const fd_set *keepfd ATTRIBUTE_UNUSED,
int *retpid ATTRIBUTE_UNUSED,
int infd ATTRIBUTE_UNUSED,
int *outfd ATTRIBUTE_UNUSED,
- int *errfd ATTRIBUTE_UNUSED)
-{
- ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
- return -1;
-}
-
-int
-virExecNonBlock(virConnectPtr conn,
- const char *const*argv ATTRIBUTE_UNUSED,
- int *retpid ATTRIBUTE_UNUSED,
- int infd ATTRIBUTE_UNUSED,
- int *outfd ATTRIBUTE_UNUSED,
- int *errfd ATTRIBUTE_UNUSED)
+ int *errfd ATTRIBUTE_UNUSED,
+ int flags ATTRIBUTE_UNUSED)
{
ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
return -1;
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
16 years, 2 months
[libvirt] [RFC][PATCH] virt-manager calls migration API
by S.Sakamoto
Hi, I just make the proto patch that calls migration API from virt-manager.
Form unity point of view,
This proto patch adds Migrate in as same layer as operations for the Domain.
Fisrt, this patch adds "Migrate" to the right-click menu when selected a domain.
Run Run
Pause Pause
Shutdown Shutdown
--------- ---> --------
Open(O) Migrate
--------
Open(O)
When "Migrate" selected, it goes on new window open which shows available(have
been connecting) hosts. Of course, I have been knowing that there is Drag&Drop way.
By the way,
(1)It is necessary to migrate a domain that users modify an environmental setting.
(ex. for XenD xend-config, ...)
And
(2)I think it that is necessary to improve usability that there is "precheking" beofre migrating.
(ex. same cpu family/processor number?, enough free memory?, ...)
Do you already have a idea that virt-manager servies above (1)(2) ?
Finally,
I understand that migrated domain's state switches Running and Shutoff alternately,
because current virt-maneger manages domains by UUID.
Is there a plan that this problem is solved?
virtManager/domain.py | 27 ++++++
virtManager/engine.py | 82 ++++++++++++++++++++
virtManager/hostlist.py | 172 ++++++++++++++++++++++++++++++++++++++++++
virtManager/manager.py | 27 ++!!!!
vmm-hostlist.glade | 195 ++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 488 insertions(+), 15 modifications(!)
Thanks,
Shigeki Sakamoto.
16 years, 2 months
[libvirt] ANNOUNCE: New release virtinst 0.400.0
by Cole Robinson
I'm happy to announce a new virtinst release, version 0.400.0. It can be
downloaded at:
http://virt-manager.org/download.html
The direct link is:
http://virt-manager.org/download/sources/virtinst/virtinst-0.400.0.tar.gz
New in this release:
- New tool 'virt-convert': Allows converting between different types of
virt configuration files. Currently only supports vmx -> virt-image.
- New tool 'virt-pack': Converts virt-image xml format to vmx and packs
in a tar.gz. (Note this will likely be merged with virt-convert in
the future).
- virt-install: Support for remote VM installation. Can use install media
and disk images on remote host if shared via libvirt. Allows
provisioning storage on remote pools.
- virt-install new options:
new --wait option, allows putting a hard time limit on installs.
new --sound option, to create VM with soundcard emulation.
new --disk option, allows specifying media as a path, storage volume, or
a pool to provision storage on, device type, and several other options.
Deprecates --file, --size, --nonsparse.
new --prompt option. Input prompting is no longer the default, this
option turns it back on.
- virt-install: allow setting cpu pinning information for qemu/kvm VMs.
- virt-install: numa support via --cpuset=auto option.
- virt-image: --replace option to overwrite existing VM image file.
- virt-image: support multiple network interfaces in virt-image format.
- use virtio disk/net drivers if chosen os entry supports it (Fedora 9/10,
Ubuntu Hardy).
- Numerous bug fixes and minor improvements.
Thanks to everyone who has contributed to this release whether by testing,
bug reporting, submitting patches, and otherwise sending feedback!
Thanks,
Cole
16 years, 2 months
[libvirt] ANNOUNCE: New release virt-manager 0.6.0
by Cole Robinson
I'm happy to announce a new virt-manager release, version 0.6.0. The
release can be downloaded from:
http://virt-manager.org/download.html
The direct download link is:
http://virt-manager.org/download/sources/virt-manager/virt-manager-0.6.0....
This release includes:
- Remote storage management and provisioning: View, add, remove, and
provision libvirt managed storage. Attach managed storage to a
remote VM.
- Remote VM installation support: Install from managed media (cdrom)
or PXE. Simple install time storage provisioning.
- VM details and console windows merged: each VM is now represented by a
single tabbed window.
- Use Avahi to list libvirtd instances on network.
- Hypervisor Autoconnect: Option to connect to hypervisor at virt-manager
start up.
- Option to add sound device emulation when creating new guests.
- Virtio and USB options when adding a disk device.
- Allow viewing and removing VM sound, serial, parallel, and console devices.
- Specifying a specific keymap when adding display device.
- Allow app to keep running with only a VM window open.
- Allow limiting amount of stored stats history.
- Numerous bug fixes and minor improvements.
Thanks to everyone who has contributed to this release through testing, bug
reporting, submitting patches, and otherwise sending in feedback!
Thanks,
Cole
16 years, 2 months
[libvirt] [PATCH] fix a error message and coding-style cleanup
by Nguyen Anh Quynh
Hi,
This patch fixes a "copy&paste" error message in MemoryPeek() function
of qemu driver.
And while I am at it, this patch does some clean-up on coding style.
Without this, my vim goes crazy while browsing the source.
Please enforce the coding style (more or less similar to GNU style?)
when merging.
Thanks,
Quynh
# diffstat fix5.patch
qemu_driver.c | 261 ++++++++++++++++++++++++++++++++++++++--------------------
1 file changed, 175 insertions(+), 86 deletions(-)
16 years, 2 months
[libvirt] [PATCH] Use gcc style for structure fields declaration
by Nguyen Anh Quynh
Hi,
This patch uses gcc style to declare fields in virDriver structures.
This also makes it easier to spot bugs.
$ diffstat fix3.patch
lxc_driver.c | 118 ++++++++++++++++++++++++++--------------------------
openvz_driver.c | 118 ++++++++++++++++++++++++++--------------------------
qemu_driver.c | 126 ++++++++++++++++++++++++++++----------------------------
test.c | 118 ++++++++++++++++++++++++++--------------------------
4 files changed, 240 insertions(+), 240 deletions(-)
Thanks,
Quynh
16 years, 2 months