[libvirt] domain.info() sometimes returns state zero for running machines
by Andreas Sommer
I'm using Xen-3.2-1 on Debian 5.0.1-lenny and retrieve information about
running domains using
domain.info()[0]
The domain object is retrieved via connection.lookupByUUIDString(...)
and stored as a variable called "domain". Usually the running domains
have the state 1 (VIR_DOMAIN_RUNNING) or 2 (VIR_DOMAIN_BLOCKED), but
sometimes it happens that 0 (VIR_DOMAIN_NOSTATE) is returned.
Why does that happen? I don't think it is an error because then it
would've raised an exception...
Regards
Andreas
15 years, 5 months
[libvirt] [PATCH] test driver: Fix domain ID after redefining a running VM
by Cole Robinson
The ID of the existing VM was being unconditionally set to -1, which was
upsetting virt-manager.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/test.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/test.c b/src/test.c
index 7dc0840..2a672a3 100644
--- a/src/test.c
+++ b/src/test.c
@@ -1623,16 +1623,16 @@ static virDomainPtr testDomainDefineXML(virConnectPtr conn,
def)) == NULL) {
goto cleanup;
}
+ def = NULL;
dom->persistent = 1;
- dom->def->id = -1;
+
event = virDomainEventNewFromObj(dom,
VIR_DOMAIN_EVENT_DEFINED,
VIR_DOMAIN_EVENT_DEFINED_ADDED);
- ret = virGetDomain(conn, def->name, def->uuid);
- def = NULL;
+ ret = virGetDomain(conn, dom->def->name, dom->def->uuid);
if (ret)
- ret->id = -1;
+ ret->id = dom->def->id;
cleanup:
virDomainDefFree(def);
--
1.6.0.6
15 years, 5 months
[libvirt] [PATCH] Fix memory reporting for inactive domains in the qemu driver.
by Cole Robinson
Currently, 'info' will always report that mem = max mem. Make sure we
actually return the correct mem value.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu_driver.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/src/qemu_driver.c b/src/qemu_driver.c
index d3eb3ad..4e3e531 100644
--- a/src/qemu_driver.c
+++ b/src/qemu_driver.c
@@ -2553,16 +2553,22 @@ static int qemudDomainGetInfo(virDomainPtr dom,
}
}
- err = qemudDomainGetMemoryBalloon(dom->conn, vm, &balloon);
- if (err < 0)
- goto cleanup;
-
info->maxMem = vm->def->maxmem;
- if (err == 0)
- /* Balloon not supported, so maxmem is always the allocation */
- info->memory = vm->def->maxmem;
- else
- info->memory = balloon;
+
+ if (virDomainIsActive(vm)) {
+ err = qemudDomainGetMemoryBalloon(dom->conn, vm, &balloon);
+ if (err < 0)
+ goto cleanup;
+
+ if (err == 0)
+ /* Balloon not supported, so maxmem is always the allocation */
+ info->memory = vm->def->maxmem;
+ else
+ info->memory = balloon;
+ } else {
+ info->memory = vm->def->memory;
+ }
+
info->nrVirtCpu = vm->def->vcpus;
ret = 0;
--
1.6.0.6
15 years, 5 months
[libvirt] Patch for Ruby Bindings to include attach & detach device
by Martin Gajdos
Hi
David Lutterkort asked me to send this patch to the list so it could be
reviewed.
What this small patch does is, it adds two functions to call
"virDomainAttachDevice" & "virDomainDetachDevice" which allow devices to be
attached & detached at run-time. The Ruby methods are called "attach_device"
& "detach_device" and belong to the Domain class.
Martin
--- orig_libvirt.c 2009-06-18 12:17:47.000000000 +0200
+++ mine_libvirt.c 2009-06-18 12:22:25.000000000 +0200
@@ -970,6 +970,22 @@
}
/*
+ * Call +virDomainAttachDevice+[
http://www.libvirt.org/html/libvirt-libvirt.html#virDomainAttachDevice]
+ */
+VALUE libvirt_dom_attach_device(VALUE s, VALUE xml) {
+ gen_call_void(virDomainAttachDevice, conn(s),
+ domain_get(s), StringValueCStr(xml));
+}
+
+/*
+ * Call +virDomainDetachDevice+[
http://www.libvirt.org/html/libvirt-libvirt.html#virDomainDetachDevice]
+ */
+VALUE libvirt_dom_detach_device(VALUE s, VALUE xml) {
+ gen_call_void(virDomainDetachDevice, conn(s),
+ domain_get(s), StringValueCStr(xml));
+}
+
+/*
* Call +virDomainCreateLinux+[
http://www.libvirt.org/html/libvirt-libvirt.html#virDomainCreateLinux]
*/
VALUE libvirt_conn_create_linux(int argc, VALUE *argv, VALUE c) {
@@ -1921,6 +1937,8 @@
rb_define_method(c_domain, "autostart", libvirt_dom_autostart, 0);
rb_define_method(c_domain, "autostart=", libvirt_dom_autostart_set, 1);
rb_define_method(c_domain, "free", libvirt_dom_free, 0);
+ rb_define_method(c_domain, "attach_device", libvirt_dom_attach_device,
1);
+ rb_define_method(c_domain, "detach_device", libvirt_dom_detach_device,
1);
/*
* Class Libvirt::Domain::Info
15 years, 5 months
[libvirt] PATCH: Fix QEMU security model info after capabilities refresh
by Daniel P. Berrange
A recent patch made the qemudGetCapabilities() method blow away and
re-create the QEMU driver's capabilities object. Unfortunately it did
not re-initialize the security model capabilities data. It also left
open the possibility that the QEMU driver could be left with no active
capabilities object at all in the case of OOM. Thus, this patch .
- Splits the security capabilities init code out to be callable
independantly of init of the security driver itself
- Makes qemudGetCapabilities repopopulate security driver info
- Don't free the existing capabilities object until we have
successfully created a new one
Daniel
Index: src/qemu_driver.c
===================================================================
RCS file: /data/cvs/libvirt/src/qemu_driver.c,v
retrieving revision 1.255
diff -u -p -r1.255 qemu_driver.c
--- src/qemu_driver.c 16 Jun 2009 15:42:46 -0000 1.255
+++ src/qemu_driver.c 18 Jun 2009 11:38:10 -0000
@@ -347,12 +347,43 @@ qemuReconnectDomains(struct qemud_driver
}
}
+
+static int
+qemudSecurityCapsInit(virSecurityDriverPtr secdrv,
+ virCapsPtr caps)
+{
+ const char *doi, *model;
+
+ doi = virSecurityDriverGetDOI(secdrv);
+ model = virSecurityDriverGetModel(secdrv);
+
+ caps->host.secModel.model = strdup(model);
+ if (!caps->host.secModel.model) {
+ char ebuf[1024];
+ VIR_ERROR(_("Failed to copy secModel model: %s"),
+ virStrerror(errno, ebuf, sizeof ebuf));
+ return -1;
+ }
+
+ caps->host.secModel.doi = strdup(doi);
+ if (!caps->host.secModel.doi) {
+ char ebuf[1024];
+ VIR_ERROR(_("Failed to copy secModel DOI: %s"),
+ virStrerror(errno, ebuf, sizeof ebuf));
+ return -1;
+ }
+
+ VIR_DEBUG("Initialized caps for security driver \"%s\" with "
+ "DOI \"%s\"", model, doi);
+
+ return 0;
+}
+
+
static int
qemudSecurityInit(struct qemud_driver *qemud_drv)
{
int ret;
- const char *doi, *model;
- virCapsPtr caps;
virSecurityDriverPtr security_drv;
ret = virSecurityDriverStartup(&security_drv,
@@ -368,36 +399,17 @@ qemudSecurityInit(struct qemud_driver *q
}
qemud_drv->securityDriver = security_drv;
- doi = virSecurityDriverGetDOI(security_drv);
- model = virSecurityDriverGetModel(security_drv);
- VIR_DEBUG("Initialized security driver \"%s\" with "
- "DOI \"%s\"", model, doi);
+ VIR_INFO("Initialized security driver %s", security_drv->name);
/*
* Add security policy host caps now that the security driver is
* initialized.
*/
- caps = qemud_drv->caps;
-
- caps->host.secModel.model = strdup(model);
- if (!caps->host.secModel.model) {
- char ebuf[1024];
- VIR_ERROR(_("Failed to copy secModel model: %s"),
- virStrerror(errno, ebuf, sizeof ebuf));
- return -1;
- }
+ return qemudSecurityCapsInit(security_drv, qemud_drv->caps);
+}
- caps->host.secModel.doi = strdup(doi);
- if (!caps->host.secModel.doi) {
- char ebuf[1024];
- VIR_ERROR(_("Failed to copy secModel DOI: %s"),
- virStrerror(errno, ebuf, sizeof ebuf));
- return -1;
- }
- return 0;
-}
/**
* qemudStartup:
@@ -1866,13 +1878,29 @@ static int qemudGetMaxVCPUs(virConnectPt
static char *qemudGetCapabilities(virConnectPtr conn) {
struct qemud_driver *driver = conn->privateData;
+ virCapsPtr caps;
char *xml = NULL;
qemuDriverLock(driver);
+ if ((caps = qemudCapsInit()) == NULL) {
+ virReportOOMError(conn);
+ goto cleanup;
+ }
+
+ if (qemu_driver->securityDriver &&
+ qemudSecurityCapsInit(qemu_driver->securityDriver, caps) < 0) {
+ virCapabilitiesFree(caps);
+ virReportOOMError(conn);
+ goto cleanup;
+ }
+
virCapabilitiesFree(qemu_driver->caps);
- if ((qemu_driver->caps = qemudCapsInit()) == NULL ||
- (xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
+ qemu_driver->caps = caps;
+
+ if ((xml = virCapabilitiesFormatXML(driver->caps)) == NULL)
virReportOOMError(conn);
+
+cleanup:
qemuDriverUnlock(driver);
return xml;
--
|: 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, 5 months
[libvirt] Future release schedule
by Daniel Veillard
I realize I forgot to post any plan on the topic, oops !
I guess we should shoot for another release around the end of the month,
Friday is a good day for release and freezes, and since I didn't gave any
heads-up, the best is to shoot for a July 3rd release, which mean we
would enter the freeze around the end of next week.
Content wise so far we have mostly bug fixes and update/completion on
existing drivers or APIs so I guess a libvirt-0.6.5 will be fine.
One thing I wonder is about progresses on the ESX driver front, it was
looking fairly close to be commiteable, basically only XML import/export
was needed but I didnt see any news recently, Matthias do you have a
schedule for that missing part ? Any help is needed ?
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, 5 months
[libvirt] Undefined symbol: virNodeDeviceWaitForDevices
by Matthias Bolte
Hi,
GIT commit f7b12afc7b67b6727151f74683e7cb9d6fc2b36f adds a new
function: virNodeDeviceWaitForDevices
In storage_backend.c virStorageBackendWaitForDevices was changed to
call virNodeDeviceWaitForDevices, but the code for
virNodeDeviceWaitForDevices is only compiled and linked into libvirtd
if the nodedev driver is build, but the nodedev driver is only build
if the hal or devkit development packages are installed. If neither
hal nor devkit is installed, compiling libvirt yields an undefined
symbol error for virNodeDeviceWaitForDevices
Regards,
Matthias
15 years, 5 months
[libvirt] Problem compiling latest code from libvirt CVS
by Fischer, Anna
I am trying to build the latest libvirt checked out from CVS this morning, but I get an error message. I ran ./autostart, ./configure and then make.
Any idea what the problem here could be?
gcc -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib -I../gnulib/lib -I../include -I../include -I../src -I/usr/include/libxml2 -Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -DLOCAL_STATE_DIR="\"/usr/local/var\"" -DSYSCONF_DIR="\"/usr/local/etc\"" -DQEMUD_PID_FILE="\"\"" -DREMOTE_PID_FILE="\"/usr/local/var/run/libvirtd.pid\"" -DGETTEXT_PACKAGE=\"libvirt\" -g -O2 -MT libvirtd-remote_protocol.o -MD -MP -MF .deps/libvirtd-remote_protocol.Tpo -c -o libvirtd-remote_protocol.o `test -f 'remote_protocol.c' || echo './'`remote_protocol.c
mv -f .deps/libvirtd-remote_protocol.Tpo .deps/libvirtd-remote_protocol.Po
/bin/sh ../mylibtool --tag=CC --mode=link gcc -I../gnulib/lib -I../gnulib/lib -I../include -I../include -I../src -I/usr/include/libxml2 -Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -DLOCAL_STATE_DIR="\"/usr/local/var\"" -DSYSCONF_DIR="\"/usr/local/etc\"" -DQEMUD_PID_FILE="\"\"" -DREMOTE_PID_FILE="\"/usr/local/var/run/libvirtd.pid\"" -DGETTEXT_PACKAGE=\"libvirt\" -g -O2 -Wall -Wformat -Wformat-security -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow -Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline -Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fasynchronous-unwind-tables -o libvirtd libvirtd-event.o libvirtd-qemud.o libvirtd-remote.o libvirtd-remote_protocol.o -lxml2 -lgnutls -lpthread -lsasl2 ../src/libvirt_driver_qemu.la ../src/libvirt_driver_lxc.la ../src/libvirt_driver_uml.la ../src/libvirt_driver_storage.la ../src/libvirt_driver_network.la ../src/libvirt.la ../gnulib/lib/libgnu.la -lpthread
(LD) -o libvirtd libvirtd-event.o libvirtd-qemud.o libvirtd-remote.o libvirtd-remote_protocol.o
../src/.libs/libvirt_driver_storage.a(storage_backend.o): In function `virStorageBackendWaitForDevices':
/home/af/vepa/libvirt/libvirt/src/storage_backend.c:262: undefined reference to `virNodeDeviceWaitForDevices'
collect2: ld returned 1 exit status
make[3]: *** [libvirtd] Error 1
15 years, 5 months
[libvirt] [PATCH] Fix qemu command flags fetching
by Cole Robinson
New function qemudParseHelpStr was being called with arguments in the
wrong order, so command flags == kvm_version :/
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
src/qemu_conf.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index 22f315c..a669c11 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -597,7 +597,7 @@ int qemudExtractVersionInfo(const char *qemu,
goto cleanup2;
}
- if (qemudParseHelpStr(help, &version, &kvm_version, &is_kvm, &flags) == -1)
+ if (qemudParseHelpStr(help, &flags, &version, &is_kvm, &kvm_version) == -1)
goto cleanup2;
if (retversion)
--
1.6.0.6
15 years, 5 months
[libvirt] Xen: How to describe bridged network adapter in libvirt-XML?
by Andreas Sommer
Hi,
I'm looking for a solution to convert the Xen configuration line
vif = ["bridge=eth0"]
to the libvirt XML description format which can be used by the
createLinux() function (using Python). I tried several things like
<interface type="bridge">
<source bridge="eth0" />
<target dev="eth0" />
<mac address="aa:00:00:00:00:12" />
<script path="/etc/xen/scripts/vif-bridge" />
</interface>
but they didn't work. Everytime I start up the guest using libvirt, no
virtual network device is created (= there's no "vifXX.0" when running
"brctl show"). It works perfectly with the Xen configuration line
mentioned above.
Hope you can help me with that.
Best regards,
Andreas
15 years, 5 months