[libvirt] compile error: cannot open < gnulib/lib/gnulib.mk: No such file or directory
by ajia
Hi all,
When I get latest libvirt and then runnning make && make install, I met
the following error:
# make && make install
INFO: gnulib update required; running ./autogen.sh first
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/sh
/root/libvirt/build-aux/missing --run aclocal-1.11 -I m4 -I gnulib/m4
cd . && /bin/sh /root/libvirt/build-aux/missing --run automake-1.11 --gnu
automake-1.11: cannot open < gnulib/lib/gnulib.mk: No such file or directory
make: *** [Makefile.in] Error 1
Has anybody met this issue recently?
BTW, my current commit id is a8be259d0cca071c5735c70580c247e9b44b2ebd.
Thanks,
Alex
13 years, 5 months
[libvirt] Changing device owner
by Shahar Havivi
Alex,
Regarding vdsm changing a device owner,
Last time I asked in #virt for using usb device in vdsm hook in
/dev/bus/usb/<addr> I was told that vdsm should change the owner to qemu:kvm.
So for the sr-iov device /sys/bus/pci/devices/<addr>/resource*, rom, and reset
libvirt should change the owner and not vdsm?
Shahar Havivi.
13 years, 5 months
[libvirt] [PATCH] Fix bug #611823 prohibit pools with duplicate storage
by Lei Li
Make sure the unique storage pool defined and create from different directory to avoid inconsistent version of volume pool created.
Signed-off-by: Lei Li<lilei(a)linux.vnet.ibm.com>
---
src/conf/storage_conf.c | 36 ++++++++++++++++++++++++++++++++++++
src/conf/storage_conf.h | 4 ++++
src/libvirt_private.syms | 2 ++
src/storage/storage_driver.c | 6 ++++++
4 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 995f9a6..9078f78 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1317,6 +1317,21 @@ virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
return NULL;
}
+virStoragePoolObjPtr
+virStoragePoolObjFindByPath(virStoragePoolObjListPtr pools,
+ const char *path) {
+ unsigned int i;
+
+ for (i = 0 ; i< pools->count ; i++) {
+ virStoragePoolObjLock(pools->objs[i]);
+ if (STREQ(pools->objs[i]->def->target.path, path))
+ return pools->objs[i];
+ virStoragePoolObjUnlock(pools->objs[i]);
+ }
+
+ return NULL;
+}
+
void
virStoragePoolObjClearVols(virStoragePoolObjPtr pool)
{
@@ -1707,6 +1722,27 @@ cleanup:
return ret;
}
+int virStoragePoolTargetDuplicate(virStoragePoolObjListPtr pools,
+ virStoragePoolDefPtr def)
+{
+ int ret = 1;
+ virStoragePoolObjPtr pool = NULL;
+
+ /* Check the pool list if defined target path already exist */
+ pool = virStoragePoolObjFindByPath(pools, def->target.path);
+ if (pool) {
+ virStorageReportError(VIR_ERR_OPERATION_FAILED,
+ _("target path '%s' is already in use"),
+ pool->def->target.path);
+ ret = -1;
+ goto cleanup;
+ }
+
+cleanup:
+ if (pool)
+ virStoragePoolObjUnlock(pool);
+ return ret;
+}
void virStoragePoolObjLock(virStoragePoolObjPtr obj)
{
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 271441a..454c43d 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -335,6 +335,8 @@ virStoragePoolObjPtr virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools,
const unsigned char *uuid);
virStoragePoolObjPtr virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
const char *name);
+virStoragePoolObjPtr virStoragePoolObjFindByPath(virStoragePoolObjListPtr pools,
+ const char *path);
virStorageVolDefPtr virStorageVolDefFindByKey(virStoragePoolObjPtr pool,
const char *key);
@@ -387,6 +389,8 @@ char *virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def);
int virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
virStoragePoolDefPtr def,
unsigned int check_active);
+int virStoragePoolTargetDuplicate(virStoragePoolObjListPtr pools,
+ virStoragePoolDefPtr def);
void virStoragePoolObjLock(virStoragePoolObjPtr obj);
void virStoragePoolObjUnlock(virStoragePoolObjPtr obj);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 830222b..37afaf2 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -937,7 +937,9 @@ virStoragePoolObjClearVols;
virStoragePoolObjDeleteDef;
virStoragePoolObjFindByName;
virStoragePoolObjFindByUUID;
+virStoragePoolObjFindByPath;
virStoragePoolObjIsDuplicate;
+virStoragePoolTargetDuplicate;
virStoragePoolObjListFree;
virStoragePoolObjLock;
virStoragePoolObjRemove;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 9c353e3..b757911 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -536,6 +536,9 @@ storagePoolCreate(virConnectPtr conn,
if (virStoragePoolObjIsDuplicate(&driver->pools, def, 1)< 0)
goto cleanup;
+ if (virStoragePoolTargetDuplicate(&driver->pools, def)< 0)
+ goto cleanup;
+
if ((backend = virStorageBackendForType(def->type)) == NULL)
goto cleanup;
@@ -589,6 +592,9 @@ storagePoolDefine(virConnectPtr conn,
if (virStoragePoolObjIsDuplicate(&driver->pools, def, 0)< 0)
goto cleanup;
+ if (virStoragePoolTargetDuplicate(&driver->pools, def)< 0)
+ goto cleanup;
+
if (virStorageBackendForType(def->type) == NULL)
goto cleanup;
--
1.7.1
13 years, 5 months
[libvirt] [PATCH] Fix bug#611823 prohibit pools with duplicate storage
by Lei Li
Make sure the unique storage pool defined and create from different directory to avoid inconsistent version of volume pool created.
Signed-off-by: Lei Li<lilei(a)linux.vnet.ibm.com>
---
src/conf/storage_conf.c | 36 ++++++++++++++++++++++++++++++++++++
src/conf/storage_conf.h | 5 +++++
src/libvirt_private.syms | 2 ++
src/storage/storage_driver.c | 6 ++++++
4 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 995f9a6..eb3595c 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -1317,6 +1317,21 @@ virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
return NULL;
}
+virStoragePoolObjPtr
+virStoragePoolObjFindByPath(virStoragePoolObjListPtr pools,
+ const char *path) {
+ unsigned int i;
+
+ for (i = 0 ; i< pools->count ; i++) {
+ virStoragePoolObjLock(pools->objs[i]);
+ if (STREQ(pools->objs[i]->def->target.path, path))
+ return pools->objs[i];
+ virStoragePoolObjUnlock(pools->objs[i]);
+ }
+
+ return NULL;
+}
+
void
virStoragePoolObjClearVols(virStoragePoolObjPtr pool)
{
@@ -1707,6 +1722,27 @@ cleanup:
return ret;
}
+int virStoragePoolTargetDuplicate(virStoragePoolObjListPtr pools,
+ virStoragePoolDefPtr def)
+{
+ int ret = 1;
+ virStoragePoolObjPtr pool = NULL;
+
+ /* Check the pool list if defined target path already exist */
+ pool = virStoragePoolObjFindByPath(pools, def->target.path);
+ if (pool) {
+ virStorageReportError(VIR_ERR_OPERATION_FAILED,
+ _("target path '%s' is already in use"),
+ pool->def->target.path);
+ ret = -1;
+ goto cleanup;
+ }
+
+cleanup:
+ if (pool)
+ virStoragePoolObjUnlock(pool);
+ return ret;
+}
void virStoragePoolObjLock(virStoragePoolObjPtr obj)
{
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index 271441a..44a2cc8 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -335,6 +335,8 @@ virStoragePoolObjPtr virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools,
const unsigned char *uuid);
virStoragePoolObjPtr virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
const char *name);
+virStoragePoolObjPtr virStoragePoolObjFindByPath(virStoragePoolObjListPtr pools,
+ const char *path);
virStorageVolDefPtr virStorageVolDefFindByKey(virStoragePoolObjPtr pool,
const char *key);
@@ -388,6 +390,9 @@ int virStoragePoolObjIsDuplicate(virStoragePoolObjListPtr pools,
virStoragePoolDefPtr def,
unsigned int check_active);
+int virStoragePoolTargetDuplicate(virStoragePoolObjListPtr pools,
+ virStoragePoolDefPtr def);
+
void virStoragePoolObjLock(virStoragePoolObjPtr obj);
void virStoragePoolObjUnlock(virStoragePoolObjPtr obj);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 830222b..37afaf2 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -937,7 +937,9 @@ virStoragePoolObjClearVols;
virStoragePoolObjDeleteDef;
virStoragePoolObjFindByName;
virStoragePoolObjFindByUUID;
+virStoragePoolObjFindByPath;
virStoragePoolObjIsDuplicate;
+virStoragePoolTargetDuplicate;
virStoragePoolObjListFree;
virStoragePoolObjLock;
virStoragePoolObjRemove;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 9c353e3..b757911 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -536,6 +536,9 @@ storagePoolCreate(virConnectPtr conn,
if (virStoragePoolObjIsDuplicate(&driver->pools, def, 1)< 0)
goto cleanup;
+ if (virStoragePoolTargetDuplicate(&driver->pools, def)< 0)
+ goto cleanup;
+
if ((backend = virStorageBackendForType(def->type)) == NULL)
goto cleanup;
@@ -589,6 +592,9 @@ storagePoolDefine(virConnectPtr conn,
if (virStoragePoolObjIsDuplicate(&driver->pools, def, 0)< 0)
goto cleanup;
+ if (virStoragePoolTargetDuplicate(&driver->pools, def)< 0)
+ goto cleanup;
+
if (virStorageBackendForType(def->type) == NULL)
goto cleanup;
--
1.7.1
13 years, 5 months
[libvirt] [PATCHv4 1/2] conf: make 'vnet' prefix a macro
by Eric Blake
Using a macro ensures that all the code is looking for the same
prefix.
* src/conf/domain_conf.h (VIR_NET_GENERATED_PREFIX): New macro.
* src/conf/domain_conf.c (virDomainNetDefParseXML): Use it.
* src/uml/uml_conf.c (umlConnectTapDevice): Likewise.
* src/qemu/qemu_command.c (qemuNetworkIfaceConnect): Likewise.
Suggested by Laine Stump.
---
v4: new patch
src/conf/domain_conf.c | 2 +-
src/conf/domain_conf.h | 4 ++++
src/qemu/qemu_command.c | 8 ++++----
src/uml/uml_conf.c | 8 ++++----
4 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 257a1ea..72eccde 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2819,7 +2819,7 @@ virDomainNetDefParseXML(virCapsPtr caps,
ifname = virXMLPropString(cur, "dev");
if ((ifname != NULL) &&
((flags & VIR_DOMAIN_XML_INACTIVE) &&
- (STRPREFIX((const char*)ifname, "vnet")))) {
+ (STRPREFIX(ifname, VIR_NET_GENERATED_PREFIX)))) {
/* An auto-generated target name, blank it out */
VIR_FREE(ifname);
}
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index c748f52..dd33eb0 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -429,6 +429,10 @@ struct _virDomainNetDef {
virBandwidthPtr bandwidth;
};
+/* Used for prefix of ifname of any network name generated dynamically
+ * by libvirt, and cannot be used for a persistent network name. */
+# define VIR_NET_GENERATED_PREFIX "vnet"
+
enum virDomainChrDeviceType {
VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL = 0,
VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ee42f1d..6a2e2ae 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -188,7 +188,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
int err;
int tapfd = -1;
int vnet_hdr = 0;
- int template_ifname = 0;
+ bool template_ifname = false;
unsigned char tapmac[VIR_MAC_BUFLEN];
int actualType = virDomainNetGetActualType(net);
@@ -244,15 +244,15 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
}
if (!net->ifname ||
- STRPREFIX(net->ifname, "vnet") ||
+ STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
strchr(net->ifname, '%')) {
VIR_FREE(net->ifname);
- if (!(net->ifname = strdup("vnet%d"))) {
+ if (!(net->ifname = strdup(VIR_NET_GENERATED_PREFIX "%d"))) {
virReportOOMError();
goto cleanup;
}
/* avoid exposing vnet%d in getXMLDesc or error outputs */
- template_ifname = 1;
+ template_ifname = true;
}
if (qemuCapsGet(qemuCaps, QEMU_CAPS_VNET_HDR) &&
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index 417271e..7b5e094 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -115,7 +115,7 @@ umlConnectTapDevice(virConnectPtr conn,
const char *bridge)
{
brControl *brctl = NULL;
- int template_ifname = 0;
+ bool template_ifname = false;
int err;
unsigned char tapmac[VIR_MAC_BUFLEN];
@@ -126,13 +126,13 @@ umlConnectTapDevice(virConnectPtr conn,
}
if (!net->ifname ||
- STRPREFIX(net->ifname, "vnet") ||
+ STRPREFIX(net->ifname, VIR_NET_GENERATED_PREFIX) ||
strchr(net->ifname, '%')) {
VIR_FREE(net->ifname);
- if (!(net->ifname = strdup("vnet%d")))
+ if (!(net->ifname = strdup(VIR_NET_GENERATED_PREFIX "%d")))
goto no_memory;
/* avoid exposing vnet%d in getXMLDesc or error outputs */
- template_ifname = 1;
+ template_ifname = true;
}
memcpy(tapmac, net->mac, VIR_MAC_BUFLEN);
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCH] network: don't forward DNS requests from isolated networks
by Laine Stump
This is in response to:
https://bugzilla.redhat.com/show_bug.cgi?id=723862
which points out that a guest on an "isolated" network could
potentially exploit the DNS forwarding provided by dnsmasq to create a
communication channel to the outside.
This patch eliminates that possibility by adding the "--no-resolv"
argument to the dnsmasq commandline, which tells dnsmasq to not
forward on any requests that it can't resolv itself (by looking at its
own static hosts files and runtime lsit of dhcp clients), but to
instead return a failure for those requests.
This shouldn't cause any undesirable change from current
behavior, even in the case where a guest is currently configured with
multiple interfaces, one of them being connected to an isolated
network, and another to a network that does have connectivity to the
outside. If the isolated network's DNS server is queried for a name
it doesn't know, it will return "Refused" rather than "Unknown", which
indicates to the guest that it should query other servers, so it then
queries the connected DNS server, and gets the desired response.
---
src/network/bridge_driver.c | 11 ++++++++---
tests/networkxml2argvdata/isolated-network.argv | 3 ++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index b8c6c97..0a60bb8 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -531,10 +531,15 @@ networkBuildDnsmasqArgv(virNetworkObjPtr network,
/* If this is an isolated network, set the default route option
* (3) to be empty to avoid setting a default route that's
- * guaranteed to not work.
+ * guaranteed to not work, and set --no-resolv so that no dns
+ * requests are forwarded on to the dns server listed in the
+ * host's /etc/resolv.conf (since this could be used as a channel
+ * to build a connection to the outside).
*/
- if (network->def->forwardType == VIR_NETWORK_FORWARD_NONE)
- virCommandAddArg(cmd, "--dhcp-option=3");
+ if (network->def->forwardType == VIR_NETWORK_FORWARD_NONE) {
+ virCommandAddArgList(cmd, "--dhcp-option=3",
+ "--no-resolv", NULL);
+ }
if (network->def->dns != NULL) {
virNetworkDNSDefPtr dns = network->def->dns;
diff --git a/tests/networkxml2argvdata/isolated-network.argv b/tests/networkxml2argvdata/isolated-network.argv
index f801396..7ea2e94 100644
--- a/tests/networkxml2argvdata/isolated-network.argv
+++ b/tests/networkxml2argvdata/isolated-network.argv
@@ -1,5 +1,6 @@
/usr/sbin/dnsmasq --strict-order --bind-interfaces --conf-file= \
---except-interface lo --dhcp-option=3 --listen-address 192.168.152.1 \
+--except-interface lo --dhcp-option=3 --no-resolv \
+--listen-address 192.168.152.1 \
--dhcp-range 192.168.152.2,192.168.152.254 \
--dhcp-leasefile=/var/lib/libvirt/dnsmasq/private.leases --dhcp-lease-max=253 \
--dhcp-no-override\
--
1.7.3.4
13 years, 5 months
[libvirt] [PATCH] build: fix include path for cygwin
by Eric Blake
Without this, cygwin failed to compile:
In file included from ../src/rpc/virnetmessage.h:24,
from ../src/rpc/virnetclient.h:27,
from remote/remote_driver.c:31:
../src/rpc/virnetprotocol.h:9:21: error: rpc/rpc.h: No such file or directory
With that fixed, compilation warned:
rpc/virnetsocket.c: In function 'virNetSocketNewListenUNIX':
rpc/virnetsocket.c:347: warning: format '%d' expects type 'int', but argument 8 has type 'gid_t' [-Wformat]
rpc/virnetsocket.c: In function 'virNetSocketGetLocalIdentity':
rpc/virnetsocket.c:743: warning: pointer targets in passing argument 5 of 'getsockopt' differ in signedness
* src/Makefile.am (libvirt_driver_remote_la_CFLAGS)
(libvirt_net_rpc_client_la_CFLAGS)
(libvirt_net_rpc_server_la_CFLAGS): Include XDR_CFLAGS, for rpc
headers on cygwin.
* src/rpc/virnetsocket.c (virNetSocketNewListenUNIX)
(virNetSocketGetLocalIdentity): Avoid compiler warnings.
---
Pushing under the build-breaker rule.
src/Makefile.am | 5 ++++-
src/rpc/virnetsocket.c | 6 +++---
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index b7e4991..009ff25 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -578,6 +578,7 @@ libvirt_la_BUILT_LIBADD += libvirt_driver_remote.la
endif
libvirt_driver_remote_la_CFLAGS = \
$(GNUTLS_CFLAGS) \
+ $(XDR_CFLAGS) \
-I@top_srcdir@/src/conf \
-I@top_srcdir@/src/rpc \
$(AM_CFLAGS)
@@ -1293,6 +1294,7 @@ EXTRA_DIST += \
endif
libvirt_net_rpc_server_la_CFLAGS = \
$(AVAHI_CFLAGS) \
+ $(XDR_CFLAGS) \
$(AM_CFLAGS) \
$(POLKIT_CFLAGS)
libvirt_net_rpc_server_la_LDFLAGS = \
@@ -1309,7 +1311,8 @@ libvirt_net_rpc_client_la_SOURCES = \
rpc/virnetclientstream.h rpc/virnetclientstream.c \
rpc/virnetclient.h rpc/virnetclient.c
libvirt_net_rpc_client_la_CFLAGS = \
- $(AM_CFLAGS)
+ $(AM_CFLAGS) \
+ $(XDR_CFLAGS)
libvirt_net_rpc_client_la_LDFLAGS = \
$(AM_LDFLAGS) \
$(CYGWIN_EXTRA_LDFLAGS) \
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index dcdc937..41b691a 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -345,8 +345,8 @@ int virNetSocketNewListenUNIX(const char *path,
*/
if (grp != 0 && chown(path, -1, grp)) {
virReportSystemError(errno,
- _("Failed to change group ID of '%s' to %d"),
- path, grp);
+ _("Failed to change group ID of '%s' to %u"),
+ path, (unsigned int) grp);
goto error;
}
@@ -737,7 +737,7 @@ int virNetSocketGetLocalIdentity(virNetSocketPtr sock,
pid_t *pid)
{
struct ucred cr;
- unsigned int cr_len = sizeof (cr);
+ socklen_t cr_len = sizeof (cr);
virMutexLock(&sock->lock);
if (getsockopt(sock->fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_len) < 0) {
--
1.7.4.4
13 years, 5 months
[libvirt] [PATCH] build: avoid non-portable shell in test setup
by Eric Blake
POSIX states that 'a=1; a=2 b=$a command' has unspecified results
for the value of $b visible within command. In particular, on
BSD, this resulted in PATH not picking up the in-test ssh.
* tests/Makefile.am (lv_abs_top_builddir): New macro.
(path_add, TESTS_ENVIRONMENT): Use it to avoid referring to an
environment variable set previously within the same command line.
Reported by Matthias Bolte.
---
Spotted by inspection based on an IRC report; hopefully someone
on BSD can test if it actually makes a difference.
tests/Makefile.am | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 43a4301..f4afcb9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -259,13 +259,17 @@ TESTS += interfacexml2xmltest
TESTS += cputest
-path_add = $$abs_top_builddir/daemon$(PATH_SEPARATOR)$$abs_top_builddir/tools$(PATH_SEPARATOR)$$abs_top_builddir/tests
-
# NB, automake < 1.10 does not provide the real
# abs_top_{src/build}dir or builddir variables, so don't rely
# on them here. Fake them with 'pwd'
+# Also, BSD sh doesn't like 'a=b b=$$a', so we can't use an
+# intermediate shell variable, but must do all the expansion in make
+
+lv_abs_top_builddir=`cd '$(top_builddir)'; pwd`
+path_add = $(lv_abs_top_builddir)/daemon$(PATH_SEPARATOR)$(lv_abs_top_builddir)/tools$(PATH_SEPARATOR)$(lv_abs_top_builddir)/tests
+
TESTS_ENVIRONMENT = \
- abs_top_builddir=`cd '$(top_builddir)'; pwd` \
+ abs_top_builddir=$(lv_abs_top_builddir) \
abs_top_srcdir=`cd '$(top_srcdir)'; pwd` \
abs_builddir=`pwd` \
abs_srcdir=`cd '$(srcdir)'; pwd` \
--
1.7.4.4
13 years, 5 months
Re: [libvirt] How to connect to the running VM
by Dave Allan
On Fri, Jul 29, 2011 at 10:36:48AM -0700, bala suru wrote:
> Hi,
> Can you suggest any links /docs which explain the kvm image creation steps
> ..?
Replying on list for the benefit of everyone.
I don't know what you're referring to when you say kvm image. Are you
asking how to install the OS in the guest?
Dave
> rgds
>
> On Fri, Jul 29, 2011 at 9:17 AM, Dave Allan <dallan(a)redhat.com> wrote:
>
> > On Fri, Jul 29, 2011 at 05:06:06PM +0530, bala suru wrote:
> > > Hi,
> > > I have deployed some VM on to the KVM-qemu and installed libvirtd ..
> > >
> > > I could see the VM running by command virsh list .
> > >
> > > but how to login to the VMs other than SSH ..? i tried virsh vncdisplay ,
> > > but no output ..
> >
> > virt-viewer <name of VM>
> >
> > will give you the graphical console if you have one set up.
> >
> > virt-manager gives you both graphical console and a graphical
> > interface to configure the VM.
> >
> > Dave
> >
> > > regards
> > > bala
> >
> > > --
> > > libvir-list mailing list
> > > libvir-list(a)redhat.com
> > > https://www.redhat.com/mailman/listinfo/libvir-list
> >
> >
13 years, 5 months
[libvirt] [PATCHv3 1/3] save: support qemu modifying xml on domain save/restore
by Eric Blake
With this, it is possible to update the path to a disk backing
image on either the save or restore action, without having to
binary edit the XML embedded in the state file.
This also modifies virDomainSave to output a smaller xml (only
the inactive xml, which is all the more virDomainRestore parses),
while still guaranteeing padding for most typical abi-compatible
xml replacements, necessary so that the next patch for
virDomainSaveImageDefineXML will not cause unnecessary
modifications to the save image file.
* src/qemu/qemu_driver.c (qemuDomainSaveInternal): Add parameter,
only use inactive state, and guarantee padding.
(qemuDomainSaveImageOpen): Add parameter.
(qemuDomainSaveFlags, qemuDomainManagedSave)
(qemuDomainRestoreFlags, qemuDomainObjRestore): Update callers.
---
v3: change virDomainSave to always output minimal information,
but with fixed padding added, so that save file modification
will always be more likely to succeed, and not generate quite
as many xml differences on round trips.
src/qemu/qemu_driver.c | 109 +++++++++++++++++++++++++++++------------------
1 files changed, 67 insertions(+), 42 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1401967..2b1df6c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2193,7 +2193,7 @@ qemuCompressProgramName(int compress)
static int
qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom,
virDomainObjPtr vm, const char *path,
- int compressed, bool bypass_cache)
+ int compressed, bool bypass_cache, const char *xmlin)
{
char *xml = NULL;
struct qemud_save_header header;
@@ -2204,7 +2204,9 @@ qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom,
qemuDomainObjPrivatePtr priv;
struct stat sb;
bool is_reg = false;
+ size_t len;
unsigned long long offset;
+ unsigned long long pad;
int fd = -1;
uid_t uid = getuid();
gid_t gid = getgid();
@@ -2239,15 +2241,54 @@ qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom,
}
}
- /* Get XML for the domain */
- xml = virDomainDefFormat(vm->def, VIR_DOMAIN_XML_SECURE);
+ /* Get XML for the domain. Restore needs only the inactive xml,
+ * including secure. We should get the same result whether xmlin
+ * is NULL or whether it was the live xml of the domain moments
+ * before. */
+ if (xmlin) {
+ virDomainDefPtr def = NULL;
+
+ if (!(def = virDomainDefParseString(driver->caps, xmlin,
+ QEMU_EXPECTED_VIRT_TYPES,
+ VIR_DOMAIN_XML_INACTIVE))) {
+ goto endjob;
+ }
+ if (!virDomainDefCheckABIStability(vm->def, def)) {
+ virDomainDefFree(def);
+ goto endjob;
+ }
+ xml = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE);
+ } else {
+ xml = virDomainDefFormat(vm->def, (VIR_DOMAIN_XML_INACTIVE |
+ VIR_DOMAIN_XML_SECURE));
+ }
if (!xml) {
qemuReportError(VIR_ERR_OPERATION_FAILED,
"%s", _("failed to get domain xml"));
goto endjob;
}
- header.xml_len = strlen(xml) + 1;
+ len = strlen(xml) + 1;
+ offset = sizeof(header) + len;
+
+ /* Due to way we append QEMU state on our header with dd,
+ * we need to ensure there's a 512 byte boundary. Unfortunately
+ * we don't have an explicit offset in the header, so we fake
+ * it by padding the XML string with NUL bytes. Additionally,
+ * we want to ensure that virDomainSaveImageDefineXML can supply
+ * slightly larger XML, so we add a miminum padding prior to
+ * rounding out to page boundaries.
+ */
+ pad = 1024;
+ pad += (QEMU_MONITOR_MIGRATE_TO_FILE_BS -
+ ((offset + pad) % QEMU_MONITOR_MIGRATE_TO_FILE_BS));
+ if (VIR_EXPAND_N(xml, len, pad) < 0) {
+ virReportOOMError();
+ goto endjob;
+ }
+ offset += pad;
+ header.xml_len = len;
+ /* Obtain the file handle. */
/* path might be a pre-existing block dev, in which case
* we need to skip the create step, and also avoid unlink
* in the failure case */
@@ -2268,29 +2309,6 @@ qemuDomainSaveInternal(struct qemud_driver *driver, virDomainPtr dom,
}
}
- offset = sizeof(header) + header.xml_len;
-
- /* Due to way we append QEMU state on our header with dd,
- * we need to ensure there's a 512 byte boundary. Unfortunately
- * we don't have an explicit offset in the header, so we fake
- * it by padding the XML string with NULLs.
- */
- if (offset % QEMU_MONITOR_MIGRATE_TO_FILE_BS) {
- unsigned long long pad =
- QEMU_MONITOR_MIGRATE_TO_FILE_BS -
- (offset % QEMU_MONITOR_MIGRATE_TO_FILE_BS);
-
- if (VIR_REALLOC_N(xml, header.xml_len + pad) < 0) {
- virReportOOMError();
- goto endjob;
- }
- memset(xml + header.xml_len, 0, pad);
- offset += pad;
- header.xml_len += pad;
- }
-
- /* Obtain the file handle. */
-
/* First try creating the file as root */
if (bypass_cache) {
directFlag = virFileDirectFdFlag();
@@ -2461,11 +2479,6 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
virDomainObjPtr vm = NULL;
virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE, -1);
- if (dxml) {
- qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("xml modification unsupported"));
- return -1;
- }
qemuDriverLock(driver);
@@ -2503,7 +2516,8 @@ qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
}
ret = qemuDomainSaveInternal(driver, dom, vm, path, compressed,
- (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0);
+ (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
+ dxml);
vm = NULL;
cleanup:
@@ -2567,7 +2581,8 @@ qemuDomainManagedSave(virDomainPtr dom, unsigned int flags)
compressed = QEMUD_SAVE_FORMAT_RAW;
ret = qemuDomainSaveInternal(driver, dom, vm, name, compressed,
- (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0);
+ (flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
+ NULL);
vm = NULL;
cleanup:
@@ -3696,7 +3711,8 @@ qemuDomainSaveImageOpen(struct qemud_driver *driver,
const char *path,
virDomainDefPtr *ret_def,
struct qemud_save_header *ret_header,
- bool bypass_cache, virFileDirectFdPtr *directFd)
+ bool bypass_cache, virFileDirectFdPtr *directFd,
+ const char *xmlin)
{
int fd;
struct qemud_save_header header;
@@ -3780,6 +3796,20 @@ qemuDomainSaveImageOpen(struct qemud_driver *driver,
QEMU_EXPECTED_VIRT_TYPES,
VIR_DOMAIN_XML_INACTIVE)))
goto error;
+ if (xmlin) {
+ virDomainDefPtr def2 = NULL;
+
+ if (!(def2 = virDomainDefParseString(driver->caps, xmlin,
+ QEMU_EXPECTED_VIRT_TYPES,
+ VIR_DOMAIN_XML_INACTIVE)))
+ goto error;
+ if (!virDomainDefCheckABIStability(def, def2)) {
+ virDomainDefFree(def2);
+ goto error;
+ }
+ virDomainDefFree(def);
+ def = def2;
+ }
VIR_FREE(xml);
@@ -3914,17 +3944,12 @@ qemuDomainRestoreFlags(virConnectPtr conn,
virFileDirectFdPtr directFd = NULL;
virCheckFlags(VIR_DOMAIN_SAVE_BYPASS_CACHE, -1);
- if (dxml) {
- qemuReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
- _("xml modification unsupported"));
- return -1;
- }
qemuDriverLock(driver);
fd = qemuDomainSaveImageOpen(driver, path, &def, &header,
(flags & VIR_DOMAIN_SAVE_BYPASS_CACHE) != 0,
- &directFd);
+ &directFd, dxml);
if (fd < 0)
goto cleanup;
@@ -3984,7 +4009,7 @@ qemuDomainObjRestore(virConnectPtr conn,
virFileDirectFdPtr directFd = NULL;
fd = qemuDomainSaveImageOpen(driver, path, &def, &header,
- bypass_cache, &directFd);
+ bypass_cache, &directFd, NULL);
if (fd < 0)
goto cleanup;
--
1.7.4.4
13 years, 5 months