Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx> --- src/vz/vz_driver.c | 25 +++++++++++++++++++++++++ src/vz/vz_utils.h | 1 + 2 files changed, 26 insertions(+) diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index e9fe89f..dce7a87 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -177,6 +177,7 @@ static void vzDriverDispose(void * obj) virObjectUnref(conn->domains); virObjectUnref(conn->caps); virObjectUnref(conn->xmlopt); + virSysinfoDefFree(conn->hostsysinfo); virObjectEventStateFree(conn->domainEventState); } @@ -310,6 +311,7 @@ vzDriverObjNew(void) return NULL; } + conn->hostsysinfo = virSysinfoRead(); prlsdkLoadDomains(conn); return conn; } @@ -423,6 +425,28 @@ static char *vzConnectGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED) return virGetHostname(); } +static char * +vzConnectGetSysinfo(virConnectPtr conn, unsigned int flags) +{ + vzConnPtr privconn = conn->privateData; + vzDriverPtr driver = privconn->driver; + virBuffer buf = VIR_BUFFER_INITIALIZER; + + virCheckFlags(0, NULL); + + if (!driver->hostsysinfo) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Host SMBIOS information is not available")); + return NULL; + } + + if (virSysinfoFormat(&buf, driver->hostsysinfo) < 0) + return NULL; + if (virBufferCheckError(&buf) < 0) + return NULL; + + return virBufferContentAndReset(&buf); +} static int vzConnectListDomains(virConnectPtr conn, int *ids, int maxids) @@ -1559,6 +1583,7 @@ static virHypervisorDriver vzHypervisorDriver = { .connectClose = vzConnectClose, /* 0.10.0 */ .connectGetVersion = vzConnectGetVersion, /* 0.10.0 */ .connectGetHostname = vzConnectGetHostname, /* 0.10.0 */ + .connectGetSysinfo = vzConnectGetSysinfo, /* 1.3.4 */ .connectGetMaxVcpus = vzConnectGetMaxVcpus, /* 1.2.21 */ .nodeGetInfo = vzNodeGetInfo, /* 0.10.0 */ .nodeGetCPUStats = vzNodeGetCPUStats, /* 1.2.21 */ diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h index ce2fd92..01a680c 100644 --- a/src/vz/vz_utils.h +++ b/src/vz/vz_utils.h @@ -72,6 +72,7 @@ struct _vzDriver { virObjectEventStatePtr domainEventState; /* Immutable pointer, self-locking APIs */ virConnectCloseCallbackDataPtr closeCallback; + virSysinfoDefPtr hostsysinfo; unsigned long vzVersion; vzCapabilities vzCaps; }; -- 2.4.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list