From: <do...@hy...> - 2007-12-31 02:16:43
|
Author: dougm Date: 2007-12-30 18:16:41 -0800 (Sun, 30 Dec 2007) New Revision: 24 Modified: trunk/etc/hq-plugin.xml trunk/src/org/hyperic/hq/plugin/xen/XenVmDetector.java Log: add VM OS cprop Modified: trunk/etc/hq-plugin.xml =================================================================== --- trunk/etc/hq-plugin.xml 2007-12-30 18:55:25 UTC (rev 23) +++ trunk/etc/hq-plugin.xml 2007-12-31 02:16:41 UTC (rev 24) @@ -203,6 +203,10 @@ default=""/> </config> + <properties> + <property name="os" description="OS"/> + </properties> + <plugin type="autoinventory" class="org.hyperic.hq.plugin.xen.XenVmDetector"/> Modified: trunk/src/org/hyperic/hq/plugin/xen/XenVmDetector.java =================================================================== --- trunk/src/org/hyperic/hq/plugin/xen/XenVmDetector.java 2007-12-30 18:55:25 UTC (rev 23) +++ trunk/src/org/hyperic/hq/plugin/xen/XenVmDetector.java 2007-12-31 02:16:41 UTC (rev 24) @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Properties; import org.hyperic.hq.product.AutoServerDetector; @@ -41,12 +42,20 @@ import com.xensource.xenapi.VBD; import com.xensource.xenapi.VIF; import com.xensource.xenapi.VM; +import com.xensource.xenapi.VMGuestMetrics; import com.xensource.xenapi.Types.VbdType; public class XenVmDetector extends ServerDetector implements AutoServerDetector { + private void setValue(ConfigResponse config, String key, String val) { + if (val == null) { + return; + } + config.setValue(key, val); + } + public List getServerResources(ConfigResponse platformConfig) throws PluginException { @@ -72,6 +81,10 @@ String uuid = vm.getUuid(conn); String name = vm.getNameLabel(conn); + VMGuestMetrics gmetrics = vm.getGuestMetrics(conn); + Map<String,String> os = gmetrics.getOsVersion(conn); + setValue(cprops, "os", os.get("name")); + String type = getTypeInfo().getName(); ServerResource server = new ServerResource(); |