Re: [libvirt] VMware support and Server 2.0.1
by Matthias Bolte
2009/7/29 Timo Makinen <tmakinen(a)ee.oulu.fi>:
> On Wed, Jul 29, 2009 at 06:12:59PM +0200, Matthias Bolte wrote:
>> 2009/7/27 Timo Makinen <tmakinen(a)ee.oulu.fi>:
[...]
> The dumpxml seems to be failing with this config option:
>
> ethernet0.connectionType = "custom"
>
> without this it works correctly.
Ah, I found the cause. ethernet0.connectionType = "custom" was a good
hint. I missed to initialize one variable correctly that is only used
in the ethernet0.connectionType = "custom" case.
>> Could you do some basic testing beside listing and dumpxml, as I have
>> currently no VMware GSX installation at hand? Just test if the
>> following commands work as expected in virsh:
>>
>> - start
>> - shutdown
>> - reboot
>> - suspend
>> - resume
>> - nodeinfo
>> - dominfo
>>
>> Regards,
>> Matthias
>
> All these worked out of the box.
Nice!
Could you test the attached patch? It adds handling for the port in
the URI, extends the version checking for GSX 2.0 and fixes the bug in
VMX parsing.
Matthias
15 years, 3 months
[libvirt] [PATCH] Modify the java bindings html page to reflect the new repositories, JNA, and maven access
by Bryan Kearney
---
docs/java.html.in | 109 +++++++++++++++++++++++++++--------------------------
1 files changed, 55 insertions(+), 54 deletions(-)
diff --git a/docs/java.html.in b/docs/java.html.in
index 2d9a24f..b0db2e2 100644
--- a/docs/java.html.in
+++ b/docs/java.html.in
@@ -4,10 +4,9 @@
<h1>Java API bindings</h1>
<h2>Presentation</h2>
- <p>The Java bindings are currently a work in progress based mostly
-on the work of Toth Istvan. The first usable release is 0.2.0, where
-most of the naming conventions were defined. Further release will try
-as much as possible to stay compatible</p>
+ <p>The Java bindings make use of <a href="https://jna.dev.java.net/">JNA</a>
+ to expose the C API in a Java friendly way. The bindings are are based on
+ work initiated by Toth Istvan.</p>
<h2>Getting it</h2>
<p>
@@ -19,82 +18,84 @@ as much as possible to stay compatible</p>
<li><a href="http://libvirt.org/sources/java/">libvirt.org HTTP server</a></li>
</ul>
-<h2>Hourly development snapshots</h2>
-<p> Once an hour, an automated snapshot is made from the latest CVS server
- source tree. These snapshots should be usable, but we make no guarantees
- about their stability: </p>
+<h3>Maven</h3>
+<p>A maven repository is located at <a href="http://www.libvirt.org/maven2/">http://www.libvirt.org/maven2/</a>
+which you can use to include this in your maven projects.</p>
-<ul>
- <li><a href="ftp://libvirt.org/libvirt/java/libvirt-java-snapshot.tar.gz">libvirt.org FTP server</a></li>
- <li><a href="http://libvirt.org/sources/java/libvirt-java-snapshot.tar.gz">libvirt.org HTTP server</a></li>
-</ul>
+<h2>GIT source repository</h2>
+<p> The Java bindings code source is now maintained in a <a
+href="http://git-scm.com/">git</a> repository available on
+<a href="http://libvirt.org/git/">libvirt.org</a>:
+</p>
+<pre>
+git clone git://libvirt.org/libvirt-java.git
+</pre>
+<p>
+It can also be browsed at
+</p>
+<pre>
-<h2>CVS repository access</h2>
+<a href="http://libvirt.org/git/?p=libvirt-java.git;a=summary">http://libvirt.org/git/?p=libvirt-java.git;a=summary</a>
+</pre>
-<p> The master source repository uses <a
-href="http://ximbiot.com/cvs/cvshome/docs/">CVS</a> and anonymous access
-is provided. Prior to accessing the server is it necessary to authenticate
-using the password <code>anoncvs</code>. This can be accomplished with
-the <code>cvs login</code> command:
+<p></p>
+<h2>GIT repository mirror</h2>
+
+<p>
+ The source code is also mirrored on <a href="http://www.gitorious.org">gitorious</a>
+ to aid in public development. You clone the repo with
</p>
-<pre>
- # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs login
+<pre>
+ git clone git://gitorious.org/libvirt/libvirt-java.git
</pre>
<p>
- Once authenticated, a checkout can be obtained using
+ It can also be browsed at
</p>
<pre>
- # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs co libvirt-java
+ <a href="http://gitorious.org/libvirt/libvirt-java">http://gitorious.org/libvirt/libvirt-java</a>
</pre>
-<p>
-The libvirt-java build process uses GNU autotools, so after obtaining a checkout
-it is necessary to generate the configure script and Makefile.in templates
-using the <code>autogen.sh</code> command. As an example, to do a complete
-build and install it into your home directory run:
+<p></p>
+<h2>CVS repository access (Deprecated)</h2>
+
+<p> The old source repository uses <a
+href="http://ximbiot.com/cvs/cvshome/docs/">CVS</a> and anonymous access
+is provided. Prior to accessing the server is it necessary to authenticate
+using the password <code>anoncvs</code>. This can be accomplished with
+the <code>cvs login</code> command:
</p>
+
<pre>
- ./autogen.sh --prefix=$HOME/usr
- make
- make install
+ # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs login
</pre>
-<p>Other build system are not currently available but as usual we take patches
-(Eclipse/ant/...) would be welcome !</p>
-<p> currently libvirt-java requires a version of libvirt >= 0.4.0 to be
-installed as well as the associated libvirt development files/package. It
-should compile with any java implementation >= 1.5, the bindings uses
-the enum construct which appeared only in that version.</p>
-<p>Libvirt-java bindings development occurs on the same mailing-list as
-the normal libvirt work see <a href="contact.html">the associated contact
-page</a></p>
-
-<h2>GIT repository mirror</h2>
<p>
- The CVS source repository is also mirrored using GIT, and is available
- for anonymous access via:
+ Once authenticated, a checkout can be obtained using
</p>
-<pre>
- git clone git://git.et.redhat.com/libvirt-java
+<pre>
+ # cvs -d :pserver:anoncvs@libvirt.org:2401/data/cvs co libvirt-java
</pre>
-<p>
- It can also be browsed at
-</p>
+<p></p>
+<h2>Building</h2>
+<p>The code is built using ant, and assumes that you have the jna jar installed. Once you have downloaded
+the code you can build the code with</p>
<pre>
- <a href="http://git.et.redhat.com/?p=libvirt-java.git;a=summary">http://git.et.redhat.com/?p=libvirt-java.git;a=summary</a>
+% cd libvirt-java
+% ant build
</pre>
+
<h2>Content</h2>
<p>The bindings are articulated around a few
-classes in the <code>org/libvirt</code> namespace, notably the
+classes in the <code>org/libvirt</code> package, notably the
<code>Connect</code>, <code>Domain</code> and <code>Network</code>
ones. Functions in the <a href="html/libvirt-libvirt.html">C API</a>
taking <code>virConnectPtr</code>, <code>virDomainPtr</code> or
@@ -112,13 +113,13 @@ lower case, for example the C functions:</p>
</p>
<p>become</p>
<p>
- <code>virConn::numOfDomains()</code>
+ <code>virConn.numOfDomains()</code>
</p>
<p>
- <code>virDomain::setMaxMemory(long memory)</code>
+ <code>virDomain.setMaxMemory(long memory)</code>
</p>
<p> There is of course some functions where the mapping is less direct
-and using extra classes to map complex arguments. The <a href="http://libvirt.org/org/libvirt/package-summary.html">Javadoc</a> is available online or as
+and using extra classes to map complex arguments. The <a href="http://libvirt.org/sources/java/javadoc">Javadoc</a> is available online or as
part of a separate libvirt-java-javadoc package.</p>
<p>So let's look at a simple example inspired from the
<code>test.java</code> test found in <code>src</code> in the source tree:</p>
@@ -147,7 +148,7 @@ public class minitest {
<p>There is not much to comment about it, it really is a straight mapping
from the C API, the only points to notice are:</p>
<ul>
- <li>the import of the modules in the <code><span style="color: #0071FF; background-color: #FFFFFF">org.libvirt</span></code> namespace</li>
+ <li>the import of the modules in the <code><span style="color: #0071FF; background-color: #FFFFFF">org.libvirt</span></code> package</li>
<li>getting a connection to the hypervisor, in that case using the
readonly access to the default test hypervisor.</li>
<li>getting an object representing the test domain using <span style="color: #007F00; background-color: #FFFFFF">lookupByName</span></li>
--
1.6.0.6
15 years, 3 months
[libvirt] [PATCH] Remove MAX_TAP_ID
by Aron Griffis
As far as I can tell, there's no reason to format the device string in
brAddTap(). Delegate the job to TUNSETIFF, thereby removing the loop
and the MAX_TAP_ID artificial limit. This patch allows me to get
421 guests running before hitting other limits.
Signed-off-by: Aron Griffis <aron.griffis(a)hp.com>
---
src/bridge.c | 94 +++++++++++++++++++++-------------------------------------
1 files changed, 34 insertions(+), 60 deletions(-)
diff --git a/src/bridge.c b/src/bridge.c
index 0509afd..ec37192 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -49,8 +49,6 @@
#include "util.h"
#include "logging.h"
-#define MAX_TAP_ID 256
-
#define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
#define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
@@ -466,76 +464,52 @@ brAddTap(brControl *ctl,
int vnet_hdr,
int *tapfd)
{
- int id, subst, fd;
+ int fd, len;
+ struct ifreq ifr = {0};
if (!ctl || !ctl->fd || !bridge || !ifname)
return EINVAL;
- subst = id = 0;
-
- if (strstr(*ifname, "%d"))
- subst = 1;
-
if ((fd = open("/dev/net/tun", O_RDWR)) < 0)
return errno;
- if (vnet_hdr)
- vnet_hdr = brProbeVnetHdr(fd);
+ ifr.ifr_flags = IFF_TAP|IFF_NO_PI;
- do {
- struct ifreq try;
- int len;
+#ifdef IFF_VNET_HDR
+ if (vnet_hdr && brProbeVnetHdr(fd))
+ ifr.ifr_flags |= IFF_VNET_HDR;
+#endif
- memset(&try, 0, sizeof(struct ifreq));
+ strncpy(ifr.ifr_name, *ifname, IFNAMSIZ-1);
- try.ifr_flags = IFF_TAP|IFF_NO_PI;
+ if (ioctl(fd, TUNSETIFF, &ifr) < 0)
+ goto error;
-#ifdef IFF_VNET_HDR
- if (vnet_hdr)
- try.ifr_flags |= IFF_VNET_HDR;
-#endif
+ len = strlen(ifr.ifr_name);
+ if (len >= BR_IFNAME_MAXLEN - 1) {
+ errno = EINVAL;
+ goto error;
+ }
- if (subst) {
- len = snprintf(try.ifr_name, BR_IFNAME_MAXLEN, *ifname, id);
- if (len >= BR_IFNAME_MAXLEN) {
- errno = EADDRINUSE;
- goto error;
- }
- } else {
- len = strlen(*ifname);
- if (len >= BR_IFNAME_MAXLEN - 1) {
- errno = EINVAL;
- goto error;
- }
-
- strncpy(try.ifr_name, *ifname, len);
- try.ifr_name[len] = '\0';
- }
-
- if (ioctl(fd, TUNSETIFF, &try) == 0) {
- /* We need to set the interface MTU before adding it
- * to the bridge, because the bridge will have its
- * MTU adjusted automatically when we add the new interface.
- */
- if ((errno = brSetInterfaceMtu(ctl, bridge, try.ifr_name)))
- goto error;
- if ((errno = brAddInterface(ctl, bridge, try.ifr_name)))
- goto error;
- if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 1)))
- goto error;
- if (!tapfd &&
- (errno = ioctl(fd, TUNSETPERSIST, 1)))
- goto error;
- VIR_FREE(*ifname);
- if (!(*ifname = strdup(try.ifr_name)))
- goto error;
- if (tapfd)
- *tapfd = fd;
- return 0;
- }
-
- id++;
- } while (subst && id <= MAX_TAP_ID);
+ /* We need to set the interface MTU before adding it
+ * to the bridge, because the bridge will have its
+ * MTU adjusted automatically when we add the new interface.
+ */
+ if ((errno = brSetInterfaceMtu(ctl, bridge, ifr.ifr_name)))
+ goto error;
+ if ((errno = brAddInterface(ctl, bridge, ifr.ifr_name)))
+ goto error;
+ if ((errno = brSetInterfaceUp(ctl, ifr.ifr_name, 1)))
+ goto error;
+ if (!tapfd &&
+ (errno = ioctl(fd, TUNSETPERSIST, 1)))
+ goto error;
+ VIR_FREE(*ifname);
+ if (!(*ifname = strdup(ifr.ifr_name)))
+ goto error;
+ if (tapfd)
+ *tapfd = fd;
+ return 0;
error:
close(fd);
15 years, 3 months
[libvirt] [PATCH] Remove MAX_TAP_ID, take 2
by Aron Griffis
(Sorry, my first posting included some gnulib droppings in the
patch. This removes that, everything else is the same.)
As far as I can tell, there's no reason to format the device string in
brAddTap(). Delegate the job to TUNSETIFF, thereby removing the loop
and the MAX_TAP_ID artificial limit. This patch allows me to get
421 guests running before hitting other limits.
Signed-off-by: Aron Griffis <aron.griffis(a)hp.com>
---
src/bridge.c | 94 +++++++++++++++++++++-------------------------------------
1 files changed, 34 insertions(+), 60 deletions(-)
diff --git a/src/bridge.c b/src/bridge.c
index 0509afd..ec37192 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -49,8 +49,6 @@
#include "util.h"
#include "logging.h"
-#define MAX_TAP_ID 256
-
#define JIFFIES_TO_MS(j) (((j)*1000)/HZ)
#define MS_TO_JIFFIES(ms) (((ms)*HZ)/1000)
@@ -466,76 +464,52 @@ brAddTap(brControl *ctl,
int vnet_hdr,
int *tapfd)
{
- int id, subst, fd;
+ int fd, len;
+ struct ifreq ifr = {0};
if (!ctl || !ctl->fd || !bridge || !ifname)
return EINVAL;
- subst = id = 0;
-
- if (strstr(*ifname, "%d"))
- subst = 1;
-
if ((fd = open("/dev/net/tun", O_RDWR)) < 0)
return errno;
- if (vnet_hdr)
- vnet_hdr = brProbeVnetHdr(fd);
+ ifr.ifr_flags = IFF_TAP|IFF_NO_PI;
- do {
- struct ifreq try;
- int len;
+#ifdef IFF_VNET_HDR
+ if (vnet_hdr && brProbeVnetHdr(fd))
+ ifr.ifr_flags |= IFF_VNET_HDR;
+#endif
- memset(&try, 0, sizeof(struct ifreq));
+ strncpy(ifr.ifr_name, *ifname, IFNAMSIZ-1);
- try.ifr_flags = IFF_TAP|IFF_NO_PI;
+ if (ioctl(fd, TUNSETIFF, &ifr) < 0)
+ goto error;
-#ifdef IFF_VNET_HDR
- if (vnet_hdr)
- try.ifr_flags |= IFF_VNET_HDR;
-#endif
+ len = strlen(ifr.ifr_name);
+ if (len >= BR_IFNAME_MAXLEN - 1) {
+ errno = EINVAL;
+ goto error;
+ }
- if (subst) {
- len = snprintf(try.ifr_name, BR_IFNAME_MAXLEN, *ifname, id);
- if (len >= BR_IFNAME_MAXLEN) {
- errno = EADDRINUSE;
- goto error;
- }
- } else {
- len = strlen(*ifname);
- if (len >= BR_IFNAME_MAXLEN - 1) {
- errno = EINVAL;
- goto error;
- }
-
- strncpy(try.ifr_name, *ifname, len);
- try.ifr_name[len] = '\0';
- }
-
- if (ioctl(fd, TUNSETIFF, &try) == 0) {
- /* We need to set the interface MTU before adding it
- * to the bridge, because the bridge will have its
- * MTU adjusted automatically when we add the new interface.
- */
- if ((errno = brSetInterfaceMtu(ctl, bridge, try.ifr_name)))
- goto error;
- if ((errno = brAddInterface(ctl, bridge, try.ifr_name)))
- goto error;
- if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 1)))
- goto error;
- if (!tapfd &&
- (errno = ioctl(fd, TUNSETPERSIST, 1)))
- goto error;
- VIR_FREE(*ifname);
- if (!(*ifname = strdup(try.ifr_name)))
- goto error;
- if (tapfd)
- *tapfd = fd;
- return 0;
- }
-
- id++;
- } while (subst && id <= MAX_TAP_ID);
+ /* We need to set the interface MTU before adding it
+ * to the bridge, because the bridge will have its
+ * MTU adjusted automatically when we add the new interface.
+ */
+ if ((errno = brSetInterfaceMtu(ctl, bridge, ifr.ifr_name)))
+ goto error;
+ if ((errno = brAddInterface(ctl, bridge, ifr.ifr_name)))
+ goto error;
+ if ((errno = brSetInterfaceUp(ctl, ifr.ifr_name, 1)))
+ goto error;
+ if (!tapfd &&
+ (errno = ioctl(fd, TUNSETPERSIST, 1)))
+ goto error;
+ VIR_FREE(*ifname);
+ if (!(*ifname = strdup(ifr.ifr_name)))
+ goto error;
+ if (tapfd)
+ *tapfd = fd;
+ return 0;
error:
close(fd);
15 years, 3 months
[libvirt] VMware support and Server 2.0.1
by Timo Makinen
I tested libvirt with VMware Server 2.0.1 (not ESX). Server starts
http on port 8333 as default and libvirt api did not have any option
to give port number when connecting.
Maybe connecting should be changed to support uris like:
esx://host:123/
Next i tried to hardcode port into libvirt and got following error:
error: internal error Expecting server major/minor version '3.5' or '4.0' but found '2.0.1'
I patched libvirt again and finally got connected. Well at least list
command gave out list of vms. With dumpxml i got following error:
virsh # dumpxml vm02
error: internal error Missing essential config entry ''
- Timo
15 years, 3 months
[libvirt] [PATCH] qemu: fix monitor socket reconnection
by Ryota Ozaki
Hi,
This patch fixes a handling of a qemu monitor unix socket. Current code
addresses 'Socket may not have shown up yet' case with catching EACCES
of connect(2), however, in that case, an errno which should be catched
is ENOENT, not EACCES.
Thanks,
ozaki-r
>From 5a4b7ee2296ca6756127c26c6bfbbe1f49ab8722 Mon Sep 17 00:00:00 2001
From: Ryota Ozaki <ozaki.ryota(a)gmail.com>
Date: Tue, 28 Jul 2009 23:48:22 +0900
Subject: [PATCH] qemu: fix monitor socket reconnection
---
src/qemu_driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index 52a77be..9fb8506 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -917,8 +917,8 @@ qemudOpenMonitorUnix(virConnectPtr conn,
if (ret == 0)
break;
- if (errno == EACCES || errno == ECONNREFUSED) {
- /* EACCES : Socket may not have shown up yet
+ if (errno == ENOENT || errno == ECONNREFUSED) {
+ /* ENOENT : Socket may not have shown up yet
* ECONNREFUSED : Leftover socket hasn't been removed yet */
continue;
}
--
1.6.0.6
15 years, 3 months
[libvirt] [PATCH] Kernel command line support for UML
by Ron Yorston
When experimenting with libvirt and UML I found it necessary to add
support for additional kernel command line arguments.
Ron
diff -up libvirt-0.6.5/src/uml_conf.c.uml-cmdline libvirt-0.6.5/src/uml_conf.c
--- libvirt-0.6.5/src/uml_conf.c.uml-cmdline 2009-07-10 16:28:51.000000000 +0100
+++ libvirt-0.6.5/src/uml_conf.c 2009-07-27 19:39:59.000000000 +0100
@@ -326,6 +326,31 @@ umlBuildCommandLineChr(virConnectPtr con
}
/*
+ * Null-terminate the current argument and return a pointer to the next.
+ * This should follow the same rules as the Linux kernel: arguments are
+ * separated by spaces; arguments can be quoted with double quotes; double
+ * quotes can't be escaped.
+ */
+static char *umlNextArg(char *args)
+{
+ int in_quote = 0;
+
+ for (; *args; args++) {
+ if (*args == ' ' && !in_quote) {
+ *args++ = '\0';
+ break;
+ }
+ if (*args == '"')
+ in_quote = !in_quote;
+ }
+
+ while (*args == ' ')
+ args++;
+
+ return args;
+}
+
+/*
* Constructs a argv suitable for launching uml with config defined
* for a given virtual machine.
*/
@@ -342,6 +367,7 @@ int umlBuildCommandLine(virConnectPtr co
const char **qargv = NULL;
int qenvc = 0, qenva = 0;
const char **qenv = NULL;
+ char *cmdline = NULL;
uname(&ut);
@@ -474,6 +500,22 @@ int umlBuildCommandLine(virConnectPtr co
ADD_ARG(ret);
}
+ if (vm->def->os.cmdline) {
+ char *args, *next_arg;
+ if ((cmdline = strdup(vm->def->os.cmdline)) == NULL)
+ goto no_memory;
+
+ args = cmdline;
+ while (*args == ' ')
+ args++;
+
+ while (*args) {
+ next_arg = umlNextArg(args);
+ ADD_ARG_LIT(args);
+ args = next_arg;
+ }
+ }
+
ADD_ARG(NULL);
ADD_ENV(NULL);
@@ -495,6 +537,7 @@ int umlBuildCommandLine(virConnectPtr co
VIR_FREE((qenv)[i]);
VIR_FREE(qenv);
}
+ VIR_FREE(cmdline);
return -1;
#undef ADD_ARG
15 years, 3 months
[libvirt] [PATCH 1/3] Move ldconfig calls to libvirt-client %post/%postun
by Mark McLoughlin
Now that the library has moved to libvirt-client
---
libvirt.spec.in | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libvirt.spec.in b/libvirt.spec.in
index 6228d0b..b79e766 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -411,7 +411,6 @@ chmod 0644 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/libvirtd
rm -fr %{buildroot}
%post
-/sbin/ldconfig
%if %{with_libvirtd}
%if %{with_qemu}
@@ -440,7 +439,9 @@ if [ $1 = 0 ]; then
fi
%endif
-%postun -p /sbin/ldconfig
+%post client -p /sbin/ldconfig
+
+%postun client -p /sbin/ldconfig
%files
%defattr(-, root, root)
--
1.6.2.5
15 years, 3 months