Re: [libvirt] Remote access and libvirtd
by Maximilian Wilhelm
Anno domini 2009 Dave Bryson scripsit:
Hi Dave!
(Moved the thread back to the list, hope thats OK)
> Thank you for the response. I'm working with ESX and am looking at
> libvirt to see if it would be beneficial to use over the ESX SOAP API
> (i'm not a SOAP fan). But in the case of remote access it doesn't appear
> that libvirt will be able to help me.
Well, the ESX driver is working completely remote and should therefore
be helpful.
The driver only uses the VI API, which practically is SOAP, to
communicate with the server.
If you could describe the problem you are facing a bit more precisly,
one could give you some hints about how to solve this.
Ciao
Max
--
Träume nicht von Dein Leben: Lebe Deinen Traum!
14 years, 12 months
[libvirt] [PATCH 0/2] test: Update inactive guest config on shutdown
by Cole Robinson
This small series teaches the test driver to abide changes to the inactive
domain definition (caused by 'defining' over an already running domain).
Cole Robinson (2):
test: Add testDomainShutdownState helper
test: Update inactive guest config on shutdown
src/test/test_driver.c | 48 +++++++++++++++++++++++++++++-------------------
1 files changed, 29 insertions(+), 19 deletions(-)
14 years, 12 months
[libvirt] [PATCH] fix cut-and-paste error
by Paolo Bonzini
Seems like a bad merge conflict.
* src/qemu/qemu_driver.c (qemudDomainMigratePerform): Do call
doPeer2PeerMigrate for VIR_MIGRATE_PEER2PEER.
---
Note: untested beyond compiling.
src/qemu/qemu_driver.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0ed2136..635d787 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6792,9 +6792,9 @@ qemudDomainMigratePerform (virDomainPtr dom,
event = NULL;
}
- if ((flags & VIR_MIGRATE_TUNNELLED)) {
+ if ((flags & (VIR_MIGRATE_TUNNELLED | VIR_MIGRATE_PEER2PEER))) {
if (doPeer2PeerMigrate(dom, vm, uri, flags, dname, resource) < 0)
- /* doTunnelMigrate already set the error, so just get out */
+ /* doPeer2PeerMigrate already set the error, so just get out */
goto cleanup;
} else {
if (doNativeMigrate(dom, vm, uri, flags, dname, resource) < 0)
--
1.6.2.5
14 years, 12 months
[libvirt] [PATCH] network utilities: Add functions for address->text and get/set port number
by Matthew Booth
---
src/libvirt_private.syms | 3 ++
src/util/network.c | 88 +++++++++++++++++++++++++++++++++++++++++++++-
src/util/network.h | 6 +++
3 files changed, 96 insertions(+), 1 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8525dbd..15d75fd 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -289,10 +289,13 @@ virFree;
virSocketAddrInNetwork;
virSocketAddrIsNetmask;
virSocketCheckNetmask;
+virSocketFormatAddr;
+virSocketGetPort;
virSocketGetRange;
virSocketParseAddr;
virSocketParseIpv4Addr;
virSocketParseIpv6Addr;
+virSocketSetPort;
# network_conf.h
diff --git a/src/util/network.c b/src/util/network.c
index abd866c..094130f 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -9,6 +9,7 @@
*/
#include <config.h>
+#include <arpa/inet.h>
#include "memory.h"
#include "network.h"
@@ -64,7 +65,7 @@ static int getIPv6Addr(virSocketAddrPtr addr, virIPv6AddrPtr tab) {
* Mostly a wrapper for getaddrinfo() extracting the address storage
* from the numeric string like 1.2.3.4 or 2001:db8:85a3:0:0:8a2e:370:7334
*
- * Returns the lenght of the network address or -1 in case of error.
+ * Returns the length of the network address or -1 in case of error.
*/
int
virSocketParseAddr(const char *val, virSocketAddrPtr addr, int hint) {
@@ -116,6 +117,91 @@ virSocketParseIpv6Addr(const char *val, virSocketAddrPtr addr) {
return(virSocketParseAddr(val, addr, AF_INET6));
}
+/*
+ * virSocketFormatAddr:
+ * @addr: an initialised virSocketAddrPtr
+ *
+ * Returns a string representation of the given address
+ * Returns NULL on any error
+ * Caller must free the returned string
+ */
+char *
+virSocketFormatAddr(virSocketAddrPtr addr) {
+ char *out;
+ size_t outlen;
+ void *inaddr;
+
+ if (addr->stor.ss_family == AF_INET) {
+ outlen = INET_ADDRSTRLEN;
+ inaddr = &addr->inet4.sin_addr;
+ }
+
+ else if (addr->stor.ss_family == AF_INET6) {
+ outlen = INET6_ADDRSTRLEN;
+ inaddr = &addr->inet6.sin6_addr;
+ }
+
+ else {
+ return NULL;
+ }
+
+ if (VIR_ALLOC_N(out, outlen) < 0)
+ return NULL;
+
+ if (inet_ntop(addr->stor.ss_family, inaddr, out, outlen) == NULL) {
+ VIR_FREE(out);
+ return NULL;
+ }
+
+ return out;
+}
+
+/*
+ * virSocketSetPort:
+ * @addr: an initialised virSocketAddrPtr
+ * @port: the port number to set
+ *
+ * Set the transport layer port of the given virtSocketAddr
+ *
+ * Returns 0 on success, -1 on failure
+ */
+int
+virSocketSetPort(virSocketAddrPtr addr, in_port_t port) {
+ if(addr->stor.ss_family == AF_INET) {
+ addr->inet4.sin_port = port;
+ }
+
+ else if(addr->stor.ss_family == AF_INET6) {
+ addr->inet6.sin6_port = port;
+ }
+
+ else {
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * virSocketGetPort:
+ * @addr: an initialised virSocketAddrPtr
+ *
+ * Returns the transport layer port of the given virtSocketAddr
+ * Returns 0 if @addr is invalid
+ */
+in_port_t
+virSocketGetPort(virSocketAddrPtr addr) {
+ if(addr->stor.ss_family == AF_INET) {
+ return addr->inet4.sin_port;
+ }
+
+ else if(addr->stor.ss_family == AF_INET6) {
+ return addr->inet6.sin6_port;
+ }
+
+ return 0;
+}
+
/**
* virSocketAddrIsNetmask:
* @netmask: the netmask address
diff --git a/src/util/network.h b/src/util/network.h
index e590747..7618547 100644
--- a/src/util/network.h
+++ b/src/util/network.h
@@ -34,6 +34,12 @@ int virSocketParseIpv4Addr(const char *val,
int virSocketParseIpv6Addr(const char *val,
virSocketAddrPtr addr);
+char * virSocketFormatAddr(virSocketAddrPtr addr);
+
+int virSocketSetPort(virSocketAddrPtr addr, in_port_t port);
+
+in_port_t virSocketGetPort(virSocketAddrPtr addr);
+
int virSocketAddrInNetwork(virSocketAddrPtr addr1,
virSocketAddrPtr addr2,
virSocketAddrPtr netmask);
--
1.6.2.5
14 years, 12 months
[libvirt] [PATCH] create() and destroy() support for Power Hypervisor
by Eduardo Otubo
Hello all,
This patch includes a lot of changes:
* I changed all references of uuid_db to uuid_table. Bigger name, but
this semantic has a better understanding.
* Now we have a little control of UUID generated for each partition.
It's based on a table that matches UUID with LPAR's IDs, I keep it in a
file that is stored in the managed system (HMC or IVM). Even having
isolated functions to manipulate this file I still need to implement a
way to lock it and make the operation atomic to avoid corruptions.
* The XML file used in the create() function still must be improved. I
used the <disk> tag to make a work around to handle storage pools. Now I
ask for some help, how do I use the <pool> tag if there is no reference
to it at the virDomainDef structure?
I've been told that libvirt possibly would make a mini-release this week
to push some major fixes on Fedora 12. Is there a little possibility to
push these new phyp features too? This would be very important for the
phyp project, since this functions are not just to manage partitions but
manipulate them.
Any comments are always welcome.
[]'s
--
Eduardo Otubo
Software Engineer
Linux Technology Center
IBM Systems & Technology Group
Mobile: +55 19 8135 0885
eotubo(a)linux.vnet.ibm.com
14 years, 12 months
[libvirt] Remote access and libvirtd
by Dave Bryson
I need to be able to access libvirt remotely. Reading through the
documention is says "libvirtd should be running on the remote
machine" for clarification does this mean that libvirtd needs to run
*on* the remote hypervisor?
Thanks,
Dave
14 years, 12 months
[libvirt] Add support for legacy -vmchannel option
by Matthew Booth
These patches add support for the legacy qemu -vmchannel option. The following
domain xml:
<channel type='unix'>
<source mode='bind' path='/tmp/vmchannel'/>
<target type='vmchannel' deviceid='0200'/>
</channel>
becomes:
-vmchannel di:0200,unix:/tmp/vmchannel,server,nowait
I don't expect these to be merged, but I would appreciate a review.
Thanks,
Matt
14 years, 12 months
[libvirt] Guestfwd support (round 3)
by Matthew Booth
This is substantially the same as the last set. I don't think I changed patches
1 and 2 at all.
Patch 3 is updated to use a virBuffer as Rich Jones recommended.
Patch 4 is updated slightly for the above change, and there are a couple of
other trivial tidy ups in there.
Patch 5 is new. QEMU's guestfwd only supports IPv4 addresses, so we check for
that.
Rich Jones also noted that guestfwd is specific to QEMU. If there's a good
chance this same syntax might do something simililar in a different driver, I
agree that changing the name would be a good idea. However, I'm not familiar
enough with other hypervisors to be able to make a call on this. If nothing else
does anything similar, I'd keep the QEMU name for clarity.
Matt
14 years, 12 months
[libvirt] [PATCH] LXC allow container to have ethN interfaces
by Ryota Ozaki
Current implementation of lxc driver creates vethN named
interface(s) in the host and passes as it is to a container.
The reason why it doesn't use ethN is due to the limitation
that one namespace cannot have multiple iterfaces that have
an identical name so that we give up creating ethN named
interface in the host for the container.
However, we should be able to allow the container to have
ethN by changing the name after clone(CLONE_NEWNET).
The patch simply does that and numberes to ethN with
ascending order from zero with no concern for what vethN
is named. So say if there is one interface, its name will
be eth0.
Note that this patch is based on top of the prior cleanup patches.
---
src/lxc/lxc_container.c | 34 ++++++++++++++++++++++++----------
src/lxc/veth.c | 31 +++++++++++++++++++++++++++++++
src/lxc/veth.h | 1 +
3 files changed, 56 insertions(+), 10 deletions(-)
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 2419345..97b7903 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -225,26 +225,38 @@ static int lxcContainerWaitForContinue(int control)
/**
- * lxcContainerEnableInterfaces:
+ * lxcContainerRenameAndEnableInterfaces:
* @nveths: number of interfaces
* @veths: interface names
*
- * This function will enable the interfaces for this container.
+ * This function will rename the interfaces to ethN
+ * with id ascending order from zero and enable the
+ * renamed interfaces for this container.
*
* Returns 0 on success or nonzero in case of error
*/
-static int lxcContainerEnableInterfaces(unsigned int nveths,
- char **veths)
+static int lxcContainerRenameAndEnableInterfaces(unsigned int nveths,
+ char **veths)
{
int rc = 0;
unsigned int i;
+ char *newname = NULL;
for (i = 0 ; i < nveths ; i++) {
- DEBUG("Enabling %s", veths[i]);
- rc = vethInterfaceUpOrDown(veths[i], 1);
- if (0 != rc) {
+ rc = virAsprintf(&newname, "eth%d", i);
+ if (rc < 0)
goto error_out;
- }
+
+ DEBUG("Renaming %s to %s", veths[i], newname);
+ rc = setInterfaceName(veths[i], newname);
+ if (0 != rc)
+ goto error_out;
+
+ DEBUG("Enabling %s", newname);
+ rc = vethInterfaceUpOrDown(newname, 1);
+ if (0 != rc)
+ goto error_out;
+ VIR_FREE(newname);
}
/* enable lo device only if there were other net devices */
@@ -252,6 +264,7 @@ static int lxcContainerEnableInterfaces(unsigned int nveths,
rc = vethInterfaceUpOrDown("lo", 1);
error_out:
+ VIR_FREE(newname);
return rc;
}
@@ -757,8 +770,9 @@ static int lxcContainerChild( void *data )
if (lxcContainerWaitForContinue(argv->monitor) < 0)
return -1;
- /* enable interfaces */
- if (lxcContainerEnableInterfaces(argv->nveths, argv->veths) < 0)
+ /* rename and enable interfaces */
+ if (lxcContainerRenameAndEnableInterfaces(argv->nveths,
+ argv->veths) < 0)
return -1;
/* drop a set of root capabilities */
diff --git a/src/lxc/veth.c b/src/lxc/veth.c
index 8617cf7..ede85ce 100644
--- a/src/lxc/veth.c
+++ b/src/lxc/veth.c
@@ -247,3 +247,34 @@ int setMacAddr(const char* iface, const char* macaddr)
error_out:
return rc;
}
+
+/**
+ * setInterfaceName
+ * @iface: name of device
+ * @new: new name of @iface
+ *
+ * Changes the name of the given device with the
+ * given new name using this command:
+ * ip link set @iface name @new
+ *
+ * Returns 0 on success or -1 in case of error
+ */
+int setInterfaceName(const char* iface, const char* new)
+{
+ int rc = -1;
+ const char *argv[] = {
+ "ip", "link", "set", iface, "name", new, NULL
+ };
+ int cmdResult;
+
+ if (NULL == iface || NULL == new) {
+ goto error_out;
+ }
+
+ rc = virRun(NULL, argv, &cmdResult);
+ if (0 == rc)
+ rc = cmdResult;
+
+error_out:
+ return rc;
+}
diff --git a/src/lxc/veth.h b/src/lxc/veth.h
index 8f2f514..8075a5e 100644
--- a/src/lxc/veth.h
+++ b/src/lxc/veth.h
@@ -21,5 +21,6 @@ int vethDelete(const char* veth);
int vethInterfaceUpOrDown(const char* veth, int upOrDown);
int moveInterfaceToNetNs(const char *iface, int pidInNs);
int setMacAddr(const char* iface, const char* macaddr);
+int setInterfaceName(const char* iface, const char* new);
#endif /* VETH_H */
--
1.6.2.5
14 years, 12 months