The platform specifies the binary wordsize for a Host system. So for a 64 bit installation, this will return 64. If it's a 32 bit installation on a 64 bit system, it will return 32.
Signed-off-by: Darryl L. Pierce dpierce@redhat.com --- src/host.cpp | 14 ++++++++++++++ src/host.h | 2 ++ src/qmf/hostagent.cpp | 1 + src/schema-host.xml | 2 +- 4 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/src/host.cpp b/src/host.cpp index e653107..cdf47e9 100644 --- a/src/host.cpp +++ b/src/host.cpp @@ -22,6 +22,7 @@ #include <fstream> #include "host.h" #include <libvirt/libvirt.h> +#include <limits.h> #include "processor.h" #include <set> #include <string> @@ -217,6 +218,19 @@ host_get_hypervisor() return hypervisor; }
+unsigned int +host_get_platform() +{ + static unsigned int wordsize = 0; + + if(wordsize == 0) + { + wordsize = sizeof(void *) * CHAR_BIT; + } + + return wordsize; +} + string host_get_architecture() { diff --git a/src/host.h b/src/host.h index b6e9ffb..e1dd02b 100644 --- a/src/host.h +++ b/src/host.h @@ -50,6 +50,8 @@ string host_get_hostname();
string host_get_hypervisor();
+unsigned int host_get_platform(); + string host_get_architecture();
unsigned int host_get_memory(); diff --git a/src/qmf/hostagent.cpp b/src/qmf/hostagent.cpp index 350323f..c9c18f7 100644 --- a/src/qmf/hostagent.cpp +++ b/src/qmf/hostagent.cpp @@ -43,6 +43,7 @@ HostAgent::setup(ManagementAgent* agent) _management_object->set_uuid(host_get_uuid()); _management_object->set_hostname(host_get_hostname()); _management_object->set_hypervisor(host_get_hypervisor()); + _management_object->set_platform(host_get_platform()); _management_object->set_arch(host_get_architecture()); _management_object->set_memory(host_get_memory());
diff --git a/src/schema-host.xml b/src/schema-host.xml index e5253a5..2c6e52e 100644 --- a/src/schema-host.xml +++ b/src/schema-host.xml @@ -9,7 +9,7 @@ <property name="memory" type="int64" access="RO" desc="Amount of primary memory for host (kb)" unit="kb" /> <property name="arch" type="sstr" access="RO" desc="Architecture of host" /> <property name="hypervisor" type="sstr" access="RO" desc="Hypervisor used by host" /> - <property name="platform" type="sstr" access="RO" desc="The wordsize for the host." /> + <property name="platform" type="uint8" access="RO" desc="The wordsize for the host." /> <property name="cpu_model" type="lstr" access="RO" desc="The process model description." /> <property name="cpu_count" type="uint8" access="RO" desc="The number of physical CPUs." /> <property name="cpu_cores" type="uint8" access="RO" desc="The total number of processor cores." />