I have answered my own question.
On an XEN kernel, the default hypervisor is XEN and I did not have any
XEN domains.
If I explicitly connect to QEMU - my programs work fine.
I discovered this fact by running the existing programs with
the connect string:
"qemu://steve-1.verizon.net/system"
I then created an XEN domain and when I reconnected with
"xen://steve-1.verizon.net/system"
I received the XEN domain information.
I know this bit of information is very familiar to those who
are experienced in the world of virtual machines. I am passing
the information on for those who are new to this environment.
Thanks
Steve
Date sent: Mon, 14 Jul 2008 12:56:24 -0400
From: Steve Oliphant <sdoliphant(a)verizon.net>
Subject: [libvirt] listing domains on Fedora 8 XEN kernel
To: libvir-list(a)redhat.com
Send reply to: n2kbd(a)arrl.net
I am having a problem being able to get domain information in an
Fedora
8 XEN environment.The code does not receive an error status on the XEN
kernel and does not get any information.
The same code running on the non XEN kernel works fine.
I am running default configuration files.
Is this a known issue?
Do I need to tweak the configuration files?
Is there anything else I need to do get the code to work on the XEN
kernel? Please point me in the right direction.
If any other information is required to assist in answering my question,
please let me know.
Thank you in advance for your help.
Steven Oliphant
Software installed:
rpm -qa | grep kernel
kernel-headers-2.6.25.9-40.fc8
kernel-devel-2.6.23.1-42.fc8
kernel-2.6.23.1-42.fc8
kernel-xen-2.6.21-2950.fc8
kernel-2.6.25.9-40.fc8
kernel-devel-2.6.25.9-40.fc8
kernel-xen-2.6.21.7-3.fc8
rpm -qa | grep xen
xen-devel-3.1.2-2.fc8
xenwatch-0.5.2-2.fc8
kernel-xen-2.6.21-2950.fc8
xen-debuginfo-3.1.2-2.fc8
kernel-xen-2.6.21.7-3.fc8
xen-libs-3.1.2-2.fc8
xen-3.1.2-2.fc8
rpm -qa | grep virt
libvirt-devel-0.4.4-1.fc8
ruby-libvirt-0.0.7-1.fc8
libvirt-python-0.4.4-1.fc8
python-virtinst-0.300.2-4.fc8
virt-manager-0.5.3-2.fc8
libvirt-debuginfo-0.4.4-1.fc8
libvirt-0.4.4-1.fc8
Non XEN kernel:
uname -a
Linux
steve-1.verizon.net 2.6.25.9-40.fc8 #1 SMP Fri Jun 27 16:25:53 EDT
2008 i686 athlon i386 GNU/Linux
XEN kernel
uname -a
Linux
steve-1.verizon.net 2.6.21.7-3.fc8xen #1 SMP Thu Mar 20 14:57:53
EDT 2008 i686 athlon i386 GNU/Linux
Code sample:
#include <stdio.h>
#include <libvirt/libvirt.h>
#define DOMAIN_COUNT 10
/**
* getInfo:
*
* extract the virtual machine information
*/
static void
getInfo(void) {
virConnectPtr conn = NULL; /* the hypervisor connection */
virDomainPtr dom = NULL; /* the domain being checked */
int ret;
int id;
int i, j, k, ids[DOMAIN_COUNT];
char *names[DOMAIN_COUNT];
/* NULL means connect to local Xen hypervisor */
conn = virConnectOpen(NULL);
if (conn == NULL) {
fprintf(stderr, "Failed to connect to hypervisor\n");
goto error;
}
/* Get the active domain list */
i = virConnectListDomains(conn, &ids[0], DOMAIN_COUNT);
if (i < 0) {
fprintf(stderr, "Failed to list the domains\n");
goto error;
}
for (j = 0;j < i;j++) {
if (ids[j] != 0) {
id = ids[j];
fprintf(stdout, "Active Domain: %d\n", id);
/* Get the information */
}
}
/* Get defined Domain Names */
ret = virConnectListDefinedDomains (conn, names, DOMAIN_COUNT);
if (ret < 0) {
fprintf(stderr, "Failed to get Domain Names\n");
goto error;
}
for (k = 0;k < ret;k++) {
printf("Inactive Domain Name: %s\n", names[k]);
}
error:
if (dom != NULL)
virDomainFree(dom);
if (conn != NULL)
virConnectClose(conn);
}
int main() {
getInfo();
return(0);
}
--
Libvir-list mailing list
Libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Steve Oliphant - N2KBD
Internet: n2kbd(a)arrl.net
Packet: N2KBD(a)WA2SNA.#NNJ.NJ.USA.NOAM
Snail Mail: 125 Awosting Road, Hewitt, NJ 07421-3190
Home: 973-846-0143
FAX: 866-307-6985