On Tue, Nov 02, 2010 at 05:36:47PM +0100, Daniel Veillard wrote:
Read and store the data when initializing the driver.
Signed-off-by: Daniel Veillard <veillard(a)redhat.com>
---
src/qemu/qemu_conf.h | 2 ++
src/qemu/qemu_driver.c | 7 +++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index bbe6887..13ddbb2 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -169,6 +169,8 @@ struct qemud_driver {
pciDeviceList *activePciHostdevs;
virBitmapPtr reservedVNCPorts;
+
+ virSysinfoDefPtr hostsysinfo;
};
typedef struct _qemuDomainPCIAddressSet qemuDomainPCIAddressSet;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4e590e3..25f52c4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -77,6 +77,7 @@
#include "xml.h"
#include "cpu/cpu.h"
#include "macvtap.h"
+#include "sysinfo.h"
#include "domain_nwfilter.h"
#include "hooks.h"
#include "storage_file.h"
@@ -1753,6 +1754,10 @@ qemudStartup(int privileged) {
virBitmapAlloc(QEMU_VNC_PORT_MAX - QEMU_VNC_PORT_MIN)) == NULL)
goto out_of_memory;
+ /* read the host sysinfo */
+ if (privileged)
+ qemu_driver->hostsysinfo = virSysinfoRead();
+
if (privileged) {
if (virAsprintf(&qemu_driver->logDir,
"%s/log/libvirt/qemu", LOCAL_STATE_DIR) == -1)
@@ -2059,6 +2064,8 @@ qemudShutdown(void) {
virDomainObjListDeinit(&qemu_driver->domains);
virBitmapFree(qemu_driver->reservedVNCPorts);
+ virSysinfoDefFree(qemu_driver->hostsysinfo);
+
VIR_FREE(qemu_driver->securityDriverName);
VIR_FREE(qemu_driver->logDir);
VIR_FREE(qemu_driver->configDir);
ACK
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://deltacloud.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|