On 07/10/2012 02:46 PM, Guido Günther wrote:
to query the guest's hostname.
---
tools/virsh.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
tools/virsh.pod | 4 ++++
2 files changed, 48 insertions(+)
+
+static bool
+cmdDomHostname (vshControl *ctl, const vshCmd *cmd)
Style: no space before function (), here...
+{
+ char *hostname;
+ virDomainPtr dom;
+ bool ret = false;
+
+ if (!vshConnectionUsability(ctl, ctl->conn))
+ return false;
+
+ if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
+ return false;
+
+ hostname = virDomainGetHostname (dom, 0);
here...
+ if (hostname == NULL) {
+ vshError(ctl, "%s", _("failed to get hostname"));
+ goto error;
+ }
+
+ vshPrint (ctl, "%s\n", hostname);
and here.
Other than that, looks reasonable.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org