mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 07:05:28 +00:00
bhyve: implement connectGetSysinfo
This commit is contained in:
parent
825a23d916
commit
0cb88f3b38
@ -238,6 +238,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)
|
||||
{
|
||||
@ -1047,6 +1074,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);
|
||||
@ -1086,6 +1114,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"),
|
||||
@ -1244,6 +1274,7 @@ static virDriver bhyveDriver = {
|
||||
.connectClose = bhyveConnectClose, /* 1.2.2 */
|
||||
.connectGetVersion = bhyveConnectGetVersion, /* 1.2.2 */
|
||||
.connectGetHostname = bhyveConnectGetHostname, /* 1.2.2 */
|
||||
.connectGetSysinfo = bhyveConnectGetSysinfo, /* 1.2.5 */
|
||||
.domainGetInfo = bhyveDomainGetInfo, /* 1.2.2 */
|
||||
.domainGetState = bhyveDomainGetState, /* 1.2.2 */
|
||||
.connectGetCapabilities = bhyveConnectGetCapabilities, /* 1.2.2 */
|
||||
|
@ -39,6 +39,7 @@ struct _bhyveConn {
|
||||
virCapsPtr caps;
|
||||
virDomainXMLOptionPtr xmlopt;
|
||||
char *pidfile;
|
||||
virSysinfoDefPtr hostsysinfo;
|
||||
|
||||
virCloseCallbacksPtr closeCallbacks;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user