[libvirt] Are there interfaces to change IP address of given domain before it runn
by Ian jonhson
Dear all,
I has created a image file in local filesystem. And now,
I wrote a program based on libvirt to run two instances
of given image file. But I found they are using the same
IP address which make them cut off the network.
So, I wonder there are any solution to guarantee that
both VM instances would be given different IP address
after they are started.
Thanks in advance,
Ian
15 years, 11 months
[libvirt] [PATCH]: Give /dev/disk/by-{id,path} a chance to exist
by Chris Lalancette
All,
When refreshing a storage pool (say, an iSCSI pool), one of the things it
does is to generate the stable path for each of the LUNs via
virStorageBackendStablePath. That, in turn, has the following code:
/* The pool is pointing somewhere like /dev/disk/by-path
* or /dev/disk/by-id, so we need to check all symlinks in
* the target directory and figure out which one points
* to this device node
*/
if ((dh = opendir(pool->def->target.path)) == NULL) {
virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR,
_("cannot read dir %s: %s"),
pool->def->target.path,
strerror(errno));
return NULL;
}
For a normal machine, that code is totally legit; /dev/disk/by-{id,path} almost
certainly exists because of your hard drive, etc. However, this may not be the
case in the stateless ovirt environment, since /dev/disk/by-{id,path} is created
on-demand by udev. It's basically a race between udev creating the directory
and libvirt scanning the directory.
The following patch just adds a retry to the code above so that if it
doesn't exist when we first get there, we give it time to come into being. If
it still hasn't shown up 5 seconds after we started, we give up and throw the error.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
15 years, 11 months
[libvirt] Release of libvirt-0.5.0
by Daniel Veillard
This is a long expected release, with a lot of new features, as a
result the small version number is increased. The release was actually
done yesterday evening, and the tarballs and signed RPMs are at:
ftp://libvirt.org/libvirt/
As stated there is a huge amount of new features and improvement in this
release, as well as a lot of bug fixes, the list is quite long :
New features:
- CPU and scheduler support for LXC (Dan Smith)
- SDL display configuration (Daniel Berrange)
- domain lifecycle event support for QEmu and Xen with python bindings
(Ben Guthro and Daniel Berrange)
- KVM/QEmu migration support (Rich Jones and Chris Lalancette)
- User Mode Linux driver (Daniel Berrange)
- API for node device enumeration using HAL and DeviceKit with python
bindings (David Lively)
Portability:
- RHEL build fixes
- VPATH build (Guido Gunther)
- many MinGW related cleanups and fixes (Richard Jones)
- compilation without libvirtd (Richard Jones)
- Add a Windows icon (Richard Jones)
- sys/poll.h portability fixes (Daniel Berrange)
- gnulib and mingw cleanups (Jim Meyering)
Documentation:
- virsh man page cleanups (Mark McLoughlin)
- doc for NIC model selection (Richard Jones)
- monitoring section
- link to AMQP bindings
- new APIs
- UML driver docs (Daniel Berrange)
Bug fixes:
- Xen interfaces ordering (Jim Fehlig)
- startup timeout with multiple pty (Cole Robinson)
- segfault if QEmu without active virtual network (Cole Robinson)
- qemu small leak (Eduardo Habkost)
- index creation for more than 26 disks (Sanjay Rao and Chris Wright)
- virRealloc handling of 0 (Daniel Berrange)
- missing pointer initialization (Chris Lalancette)
- bus device index bug (Guido Gunther)
- avoid crash in some error patch (Chris Lalancette)
- fix a problem in storage back-end (Chris Lalancette)
- minimum domain memory size check for Xen (Shigeki Sakamoto)
- switch off QEmu cache if device is shared (Charles Duffy)
- logical volume definition before scan bug (Chris Lalancette)
- a couple of memory leaks on QEmu vnc (Jim Meyering)
- lvs parsing fixes (Cole Robinson)
Improvements:
- LXC resources control and internal cgroup API (Dan Smith)
- virDomainCreateLinux renamed virDomainDefineXML
- network driver modularization (Daniel Berrange)
- change the way domain and net are reported in errors (Jim Meyering)
- partition table scan on iSCSI (Chris Lalancette)
- qemudDiskDeviceName to handle normal disks (Guido Gunther)
- qemudDomainBlockStats improvement (Guido Gunther)
- scsi/virtio hotplug support for KVM (Guido Gunther)
- USB hot addition in QEmu (Guido Gunther)
- logical pool and storage backend XML dump improvement (Chris
Lalancette)
- MAC addresses prefix per driver (Daniel Berrange)
- OpenVZ getVersion support (Daniel Berrange)
- hot removal of scsi/virtio disks for KVM (Guido Gunther)
- test storage driver (Cole Robinson)
- iSCSI and disk storage driver improvement on path handling (Chris
Lalancette)
- UUID and ID support for Xenner (Daniel Berrange)
- better logging when when executing commands (Cole Robinson)
- bridged network for OpenVZ (Daniel Berrange)
- OpenVZ config file params (Evgeniy Sokolov)
- allow to build drivers as libtool convenience libs (Daniel Berrange)
- fully versioned linker script for exported ABI (Daniel Berrange)
- Push URI probing down into drivers open (Daniel Berrange)
- move all stateful drivers into the daemon binary (Daniel Berrange)
- improve domain event with a detail field (Daniel Berrange)
- domain events for QEMU driver (Daniel Berrange)
- event unregister callback crash (David Lively)
- plug a few leaks (Daniel Berrange)
- internal APIs for handling node device XML config (David Lively)
- tweaks to node device implementation (Daniel Berrange)
- OpenVZ vCPUs values init (Evgeniy Sokolov)
Cleanups:
- C99 initializers (Guido Gunther)
- test output (Cole Robinson)
- debug macro centralization (Cole Robinson)
- various error handling (Guido Gunther)
- safewrite use cleanup (Jim Meyering)
- centralize error reporting logic (Cole Robinson)
- avoid printf warnings (Daniel Berrange)
- use arrays instead of list for internal APIs (Daniel Berrange)
- remove many format string warnings Jim Meyering)
- avoid syntax check warnings (Chris Lalancette)
- improve po-check and list generation (Jim Meyering)
- .gitignore generation and handling (Jim Meyering)
- use ARRAY_CARDINALITY (Jim Meyering)
- gnulib updates and switch to use netdb.h (Jim Meyering)
- drop usage of socket_errno (Jim Meyering)
- remove socketcompat.h (Jim Meyering)
- more tests (Jim Meyering)
- drop virStringList (Daniel Berrange)
- reformatting and isolation of the error APIs (Daniel Berrange)
- cleanup internal.h and move internal APIs in specific headers (Daniel
Berrange)
- move domain events helpers into domain_events.c (Daniel Berrange)
- cleanup the way optional modules are compiled (Daniel Berrange)
- add new logging module
- optional dlopen of drivers (Daniel Berrange)
- various new tests (Jim Meyering)
- cleanups when Xen is not configured in (Daniel Berrange)
- add some missing functions comments (Jim Meyering)
With the amount of new feature and code I would not be surprized if a
new release was needed within the next couple of weeks, still people are
invited to upgrade and submit reports in case of troubles.
Thanks a lot to everybody who contributed to this release, it is
really great to see new people providing significant patches, and the
amount of feedback received on the list.
Again, thanks to everybody,
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
daniel(a)veillard.com | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
15 years, 11 months
[libvirt] Fedora 10 Release and Virtualization News
by Dale Bewley
Sorry for the annoying cross post.
The next Fedora Weekly News[1] will be published Monday, one day before
the release of Fedora 10. I would like dedicate a special section of the
Virtualization Beat[2] to touting the advances and new features in F10.
As with the release notes[3], I am seeking your input. (A little late, I
know.) I'm interested not only in the new virtualization features and
breakthroughs found in the F10 release, but also any updates that might
be right around the corner in f10-updates.
Perhaps you have some special insight into the upstream progress of
pv_ops, or maybe you know about a almost complete implementation of a
libvirt API feature into virt-manager or...
I'm sorry if this is a little scattershot. For sometime, I've considered
trying to present questions in interview style to each of these lists,
but I just haven't gotten that together.
The publication deadline is Sunday night, but I'll be able to use
anything in the next edition of FWN. Please contribute, even if you read
this on Monday.
[1] http://fedoraproject.org/wiki/FWN
[2] http://fedoraproject.org/wiki/FWN/Beats/Virtualization
[3] http://fedoraproject.org/wiki/Docs/Beats/Virtualization
--
Dale Bewley - Unix Administrator - Shields Library - UC Davis
GPG: 0xB098A0F3 0D5A 9AEB 43F4 F84C 7EFD 1753 064D 2583 B098 A0F3
15 years, 11 months
[libvirt] doc nits
by Jim Meyering
I noticed the following go by yesterday,
but won't have time to address them:
Function comment for virConnectDomainEventRegister lacks description of arg freecb
Function comment for virNodeDeviceGetName lacks description of the function
Function comment for virNodeDeviceGetParent lacks description of the function
Function comment for virNodeDeviceNumOfCaps lacks description of the function
Function comment for virNodeDeviceNumOfCaps lacks description of the function
Missing * in function comment for virDomainMigrateFinish
Missing * in function comment for virDomainMigrateFinish2
Missing * in function comment for virDomainMigratePerform
Missing * in function comment for virDomainMigratePrepare
Missing * in function comment for virDomainMigratePrepare2
Missing * in function comment for virDrvSupportsFeature
15 years, 11 months
[libvirt] build nits
by Jim Meyering
When running ../configure (note the leading ".."),
I saw these diagnostics go by:
cp: cannot stat `COPYING.LIB': No such file or directory
...
find: `/t/libvirt-0.4.6/tests/domainschemadata': No such file or directory
each indicated a small problem.
Here are fixes:
>From f5164f771c83fa85310d78a3cb137e4cb6f51e12 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 25 Nov 2008 13:28:04 +0100
Subject: [PATCH 1/2] don't silently skip a test
* tests/Makefile.am (EXTRA_DIST): Distribute domainschemadata/.
* tests/domainschematest: Fail the test if find invocation fails.
---
tests/Makefile.am | 3 ++-
tests/domainschematest | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9752cbf..fd319e1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -41,7 +41,8 @@ EXTRA_DIST = \
xmlrpcserver.py \
qemuxml2argvdata \
nodeinfodata \
- domainschematest
+ domainschematest \
+ domainschemadata
noinst_PROGRAMS = xmlrpctest virshtest conftest \
nodeinfotest statstest qparamtest
diff --git a/tests/domainschematest b/tests/domainschematest
index c841c86..d85d463 100755
--- a/tests/domainschematest
+++ b/tests/domainschematest
@@ -8,7 +8,7 @@ n=0
f=0
for dir in $DOMAINDIRS
do
- XML=`find $abs_srcdir/$dir -name '*.xml'`
+ XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
for xml in $XML
do
--
1.6.0.4.1044.g77718
>From 7af1784b7cddab292b087031cc409609c27db263 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Tue, 25 Nov 2008 13:20:38 +0100
Subject: [PATCH 2/2] configure.in: avoid the following diagnostic when running ../configure ...
cp: cannot stat `COPYING.LIB': No such file or directory
---
configure.in | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/configure.in b/configure.in
index a603c10..4db7204 100644
--- a/configure.in
+++ b/configure.in
@@ -1222,10 +1222,12 @@ then
fi
AM_CONDITIONAL([WITH_NODE_DEVICES], [test "$with_nodedev" = "yes"])
-
-# very annoying
-rm -f COPYING
-cp COPYING.LIB COPYING
+# Only COPYING.LIB is under version control, yet COPYING
+# is included as part of the distribution tarball.
+# Copy one to the other, but only if this is a srcdir-build.
+# You are unlikely to be doing distribution-related things in a non-srcdir build
+test "x$srcdir" = x. && ! test -f COPYING &&
+cp -f COPYING.LIB COPYING
AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
docs/examples/Makefile docs/devhelp/Makefile \
--
1.6.0.4.1044.g77718
15 years, 11 months
[libvirt] PATCH: Autostart for Xen domains < 3.0.4
by Daniel P. Berrange
The old 'xm' driver does not currently implement the autostart feature
for domains managed via /etc/xen. This patche addresses that limitation
by making it create the symlinks in /etc/xen/auto as expected by the
existing 'xendomains' init script for autostart.
Daniel
diff -r dddbb717add4 src/xen_unified.c
--- a/src/xen_unified.c Mon Nov 24 10:45:05 2008 -0500
+++ b/src/xen_unified.c Mon Nov 24 11:00:24 2008 -0500
@@ -1159,13 +1159,16 @@ xenUnifiedDomainGetAutostart (virDomainP
xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart)
{
GET_PRIVATE(dom->conn);
- int i;
-
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
- if (priv->opened[i] && drivers[i]->domainGetAutostart &&
- drivers[i]->domainGetAutostart (dom, autostart) == 0)
- return 0;
-
+
+ if (priv->xendConfigVersion < 3) {
+ if (priv->opened[XEN_UNIFIED_XM_OFFSET])
+ return xenXMDomainGetAutostart(dom, autostart);
+ } else {
+ if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
+ return xenDaemonDomainGetAutostart(dom, autostart);
+ }
+
+ xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
@@ -1173,13 +1176,16 @@ xenUnifiedDomainSetAutostart (virDomainP
xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart)
{
GET_PRIVATE(dom->conn);
- int i;
-
- for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i)
- if (priv->opened[i] && drivers[i]->domainSetAutostart &&
- drivers[i]->domainSetAutostart (dom, autostart) == 0)
- return 0;
-
+
+ if (priv->xendConfigVersion < 3) {
+ if (priv->opened[XEN_UNIFIED_XM_OFFSET])
+ return xenXMDomainSetAutostart(dom, autostart);
+ } else {
+ if (priv->opened[XEN_UNIFIED_XEND_OFFSET])
+ return xenDaemonDomainSetAutostart(dom, autostart);
+ }
+
+ xenUnifiedError (dom->conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
diff -r dddbb717add4 src/xm_internal.c
--- a/src/xm_internal.c Mon Nov 24 10:45:05 2008 -0500
+++ b/src/xm_internal.c Mon Nov 24 11:02:16 2008 -0500
@@ -2669,3 +2669,84 @@ xenXMDomainBlockPeek (virDomainPtr dom,
return -1;
}
+
+static char *xenXMAutostartLinkName(virDomainPtr dom)
+{
+ char *ret;
+ if (asprintf(&ret, "/etc/xen/auto/%s", dom->name) < 0)
+ return NULL;
+ return ret;
+}
+
+static char *xenXMDomainConfigName(virDomainPtr dom)
+{
+ char *ret;
+ if (asprintf(&ret, "/etc/xen/%s", dom->name) < 0)
+ return NULL;
+ return ret;
+}
+
+int xenXMDomainGetAutostart(virDomainPtr dom, int *autostart)
+{
+ char *linkname = xenXMAutostartLinkName(dom);
+ char *config = xenXMDomainConfigName(dom);
+ int ret = -1;
+
+ if (!linkname || !config) {
+ xenXMError(dom->conn, VIR_ERR_NO_MEMORY, NULL);
+ goto cleanup;
+ }
+
+ *autostart = virFileLinkPointsTo(linkname, config);
+ if (*autostart < 0) {
+ xenXMError(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ _("failed to check autostart link %s: %s"),
+ linkname, strerror(errno));
+ goto cleanup;
+ }
+
+ ret = 0;
+
+cleanup:
+ VIR_FREE(linkname);
+ VIR_FREE(config);
+ return ret;
+}
+
+
+int xenXMDomainSetAutostart(virDomainPtr dom, int autostart)
+{
+ char *linkname = xenXMAutostartLinkName(dom);
+ char *config = xenXMDomainConfigName(dom);
+ int ret = -1;
+
+ if (!linkname || !config) {
+ xenXMError(dom->conn, VIR_ERR_NO_MEMORY, NULL);
+ goto cleanup;
+ }
+
+ if (autostart) {
+ if (symlink(config, linkname) < 0 &&
+ errno != EEXIST) {
+ xenXMError(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ "failed to create link %s: %s",
+ linkname, strerror(errno));
+ goto cleanup;
+ }
+ } else {
+ if (unlink(linkname) < 0 &&
+ errno != ENOENT) {
+ xenXMError(dom->conn, VIR_ERR_INTERNAL_ERROR,
+ "failed to remove link %s: %s",
+ linkname, strerror(errno));
+ goto cleanup;
+ }
+ }
+ ret = 0;
+
+cleanup:
+ VIR_FREE(linkname);
+ VIR_FREE(config);
+
+ return ret;
+}
diff -r dddbb717add4 src/xm_internal.h
--- a/src/xm_internal.h Mon Nov 24 10:45:05 2008 -0500
+++ b/src/xm_internal.h Mon Nov 24 10:59:24 2008 -0500
@@ -65,4 +65,7 @@ virDomainDefPtr xenXMDomainConfigParse(v
int xenXMDomainBlockPeek (virDomainPtr dom, const char *path, unsigned long long offset, size_t size, void *buffer);
+int xenXMDomainGetAutostart(virDomainPtr dom, int *autostart);
+int xenXMDomainSetAutostart(virDomainPtr dom, int autostart);
+
#endif
--
|: 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 :|
15 years, 11 months
[libvirt] PATCH: Fix node device build on mingw32
by Daniel P. Berrange
The node device XML configuration handling routines contain a struct
member called 'interface'. This seems to clash with a some typedef or
function in the Win32 header files, causing horrific compile failure.
This patch simply renames 'interface' to 'ifname'.
Index: src/node_device_conf.c
===================================================================
RCS file: /data/cvs/libvirt/src/node_device_conf.c,v
retrieving revision 1.2
diff -r1.2 node_device_conf.c
272c272
< data->net.interface);
---
> data->net.ifname);
377c377
< VIR_FREE(data->net.interface);
---
> VIR_FREE(data->net.ifname);
Index: src/node_device_conf.h
===================================================================
RCS file: /data/cvs/libvirt/src/node_device_conf.h,v
retrieving revision 1.3
diff -r1.3 node_device_conf.h
105c105
< char *interface;
---
> char *ifname;
Index: src/node_device_devkit.c
===================================================================
RCS file: /data/cvs/libvirt/src/node_device_devkit.c,v
retrieving revision 1.2
diff -r1.2 node_device_devkit.c
121c121
< const char *interface;
---
> const char *ifname;
125,126c125,126
< interface = strrchr(sysfs_path, '/');
< if (!interface || !*interface || !*(++interface))
---
> ifname = strrchr(sysfs_path, '/');
> if (!ifname || !*ifname || !*(++ifname))
128c128
< if ((d->net.interface = strdup(interface)) == NULL)
---
> if ((d->net.ifname = strdup(ifname)) == NULL)
Index: src/node_device_hal.c
===================================================================
RCS file: /data/cvs/libvirt/src/node_device_hal.c,v
retrieving revision 1.2
diff -r1.2 node_device_hal.c
199c199
< (void)get_str_prop(ctx, udi, "net.interface", &d->net.interface);
---
> (void)get_str_prop(ctx, udi, "net.interface", &d->net.ifname);
--
|: 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 :|
15 years, 11 months