On Sun, Jul 15, 2012 at 11:45:08PM +0200, Guido Günther wrote: > to retrieve a VEs config parameters as a single string. This will be > used by the upcoming domainGetHostname implementation. > --- > src/libvirt_openvz.syms | 2 +- > src/openvz/openvz_util.c | 32 ++++++++++++++++++++++++++++++++ > src/openvz/openvz_util.h | 1 + > 3 files changed, 34 insertions(+), 1 deletion(-) > > diff --git a/src/libvirt_openvz.syms b/src/libvirt_openvz.syms > index 11c5587..1993eb5 100644 > --- a/src/libvirt_openvz.syms > +++ b/src/libvirt_openvz.syms > @@ -1,7 +1,7 @@ > # > # These symbols are dependent upon --with-openvz via WITH_OPENVZ > # > - > openvzReadConfigParam; > openvzReadNetworkConf; > openvzLocateConfFile; > +openvzVEGetStringParam; > diff --git a/src/openvz/openvz_util.c b/src/openvz/openvz_util.c > index 61b55de..2091b8e 100644 > --- a/src/openvz/openvz_util.c > +++ b/src/openvz/openvz_util.c > @@ -26,6 +26,9 @@ > #include "internal.h" > > #include "virterror_internal.h" > +#include "command.h" > +#include "datatypes.h" > +#include "memory.h" > > #include "openvz_conf.h" > #include "openvz_util.h" > @@ -49,3 +52,32 @@ openvzKBPerPages(void) > } > return kb_per_pages; > } > + > +char* > +openvzVEGetStringParam(virDomainPtr domain, const char* param) > +{ > + int len; > + char *output = NULL; > + > + virCommandPtr cmd = virCommandNewArgList(VZLIST, > + "-o", > + param, > + domain->name, > + "-H" , NULL); > + > + virCommandSetOutputBuffer(cmd, &output); > + if (virCommandRun(cmd, NULL) < 0) { > + VIR_FREE(output); > + /* virCommandRun sets the virError */ > + goto out; > + } > + > + /* delete trailing newline */ > + len = strlen(output); > + if (len && output[len - 1] == '\n') > + output[len - 1] = '\0'; > + > +out: s/out/cleanup/ in this function to follow the standard naming convention we use. > + virCommandFree(cmd); > + return output; > +} > diff --git a/src/openvz/openvz_util.h b/src/openvz/openvz_util.h > index a0d9bbb..6a991f3 100644 > --- a/src/openvz/openvz_util.h > +++ b/src/openvz/openvz_util.h > @@ -24,5 +24,6 @@ > # define OPENVZ_UTIL_H > > long openvzKBPerPages(void); > +char* openvzVEGetStringParam(virDomainPtr dom, const char *param); s/char* /char */ > > #endif ACK if you fix the issues above when you commit 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 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list