[libvirt] there is a mistake in "libvirt development guide, chapter 4.1: list domains"

int i; int numDomains; char **inactiveDomains; numDomains = virConnectNumOfDefinedDomains(conn); inactiveDomains = malloc(sizeof(char *) * numDomains); numDomains = virConnectListDomains(conn, inactiveDomains, numDomains); printf("Inactive domain names:\n"); for (i = 0 ; i < numDomains ; i++) { printf(" %s\n", inactiveDomains[i]); free(inactiveDomains[i]); } free(inactiveDomains); Example 4.5. Listing inactive domains There should use "virConnectListDefinedDomains" for inactive domains.

On Wed, Mar 02, 2011 at 09:37:59AM +0800, SanitYey o wrote:
int i; int numDomains; char **inactiveDomains;
numDomains = virConnectNumOfDefinedDomains(conn);
inactiveDomains = malloc(sizeof(char *) * numDomains); numDomains = virConnectListDomains(conn, inactiveDomains, numDomains);
printf("Inactive domain names:\n"); for (i = 0 ; i < numDomains ; i++) { printf(" %s\n", inactiveDomains[i]); free(inactiveDomains[i]); } free(inactiveDomains); Example 4.5. Listing inactive domains
There should use "virConnectListDefinedDomains" for inactive domains.
Thanks for pointing that out. FYI the app dev guide is stored in GIT in docbook format & patches to add or correct content are welcomed from anyone who's interested... http://libvirt.org/git/?p=libvirt-appdev-guide.git;a=summary Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
participants (2)
-
Daniel P. Berrange
-
SanitYey o