--- src/bhyve/bhyve_driver.c | 31 +++++++++++++++++++++++++++++++ src/bhyve/bhyve_utils.h | 1 + 2 files changed, 32 insertions(+) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 0cafe4c..ec1ba69 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -237,6 +237,33 @@ bhyveConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED) return virGetHostname(); } +static char * +bhyveConnectGetSysinfo(virConnectPtr conn, unsigned int flags) +{ + bhyveConnPtr privconn = conn->privateData; + virBuffer buf = VIR_BUFFER_INITIALIZER; + + virCheckFlags(0, NULL); + + if (virConnectGetSysinfoEnsureACL(conn) < 0) + return NULL; + + if (!privconn->hostsysinfo) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Host SMBIOS information is not available")); + return NULL; + } + + if (virSysinfoFormat(&buf, privconn->hostsysinfo) < 0) + return NULL; + if (virBufferError(&buf)) { + virReportOOMError(); + return NULL; + } + + return virBufferContentAndReset(&buf); +} + static int bhyveConnectGetVersion(virConnectPtr conn ATTRIBUTE_UNUSED, unsigned long *version) { @@ -976,6 +1003,7 @@ bhyveStateCleanup(void) virObjectUnref(bhyve_driver->domains); virObjectUnref(bhyve_driver->caps); virObjectUnref(bhyve_driver->xmlopt); + virObjectUnref(bhyve_driver->hostsysinfo); virObjectUnref(bhyve_driver->closeCallbacks); virMutexDestroy(&bhyve_driver->lock); @@ -1015,6 +1043,8 @@ bhyveStateInitialize(bool priveleged ATTRIBUTE_UNUSED, if (!(bhyve_driver->domains = virDomainObjListNew())) goto cleanup; + bhyve_driver->hostsysinfo = virSysinfoRead(); + if (virFileMakePath(BHYVE_LOG_DIR) < 0) { virReportSystemError(errno, _("Failed to mkdir %s"), @@ -1173,6 +1203,7 @@ static virDriver bhyveDriver = { .connectClose = bhyveConnectClose, /* 1.2.2 */ .connectGetVersion = bhyveConnectGetVersion, /* 1.2.2 */ .connectGetHostname = bhyveConnectGetHostname, /* 1.2.2 */ + .connectGetSysinfo = bhyveConnectGetSysinfo, /* 1.2.4 */ .domainGetInfo = bhyveDomainGetInfo, /* 1.2.2 */ .domainGetState = bhyveDomainGetState, /* 1.2.2 */ .connectGetCapabilities = bhyveConnectGetCapabilities, /* 1.2.2 */ diff --git a/src/bhyve/bhyve_utils.h b/src/bhyve/bhyve_utils.h index 94f31b0..22f458d 100644 --- a/src/bhyve/bhyve_utils.h +++ b/src/bhyve/bhyve_utils.h @@ -39,6 +39,7 @@ struct _bhyveConn { virCapsPtr caps; virDomainXMLOptionPtr xmlopt; char *pidfile; + virSysinfoDefPtr hostsysinfo; virCloseCallbacksPtr closeCallbacks; }; -- 1.9.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list