On Sun, Jul 15, 2012 at 11:45:09PM +0200, Guido Günther wrote: > --- > src/openvz/openvz_driver.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 42 insertions(+) > > diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c > index c9150e0..6046a60 100644 > --- a/src/openvz/openvz_driver.c > +++ b/src/openvz/openvz_driver.c > @@ -234,6 +234,47 @@ cleanup: > } > > > +static char * > +openvzDomainGetHostname(virDomainPtr dom, unsigned int flags) > +{ > + char *hostname = NULL; > + struct openvz_driver *driver = dom->conn->privateData; > + virDomainObjPtr vm; > + > + virCheckFlags(0, NULL); > + > + openvzDriverLock(driver); > + vm = virDomainFindByUUID(&driver->domains, dom->uuid); > + openvzDriverUnlock(driver); > + > + if (!vm) { > + openvzError(VIR_ERR_NO_DOMAIN, "%s", > + _("no domain with matching uuid")); > + goto cleanup; > + } > + > + hostname = openvzVEGetStringParam(dom, "hostname"); > + if (hostname == NULL) > + goto error; > + > + /* vzlist prints an unset hostname as '-' */ > + if (STREQ(hostname, "-")) { > + openvzError(VIR_ERR_OPERATION_FAILED, > + _("Hostname of '%s' is unset"), vm->def->name); > + goto error; > + } > + > +cleanup: > + if (vm) > + virDomainObjUnlock(vm); > + return hostname; > + > +error: > + VIR_FREE(hostname); > + goto cleanup; > +} > + > + > static virDomainPtr openvzDomainLookupByID(virConnectPtr conn, > int id) { > struct openvz_driver *driver = conn->privateData; > @@ -2127,6 +2168,7 @@ static virDriver openvzDriver = { > .domainIsUpdated = openvzDomainIsUpdated, /* 0.8.6 */ > .isAlive = openvzIsAlive, /* 0.9.8 */ > .domainUpdateDeviceFlags = openvzDomainUpdateDeviceFlags, /* 0.9.13 */ > + .domainGetHostname = openvzDomainGetHostname, /* 0.9.14 */ > }; > > int openvzRegister(void) { ACK 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