public void setQuickStats( HostListSummaryQuickStats quickStats) { this.quickStats = quickStats; }
void handleChanges(PropertyChange[] changes) { for (int pci = 0; pci < changes.Length; ++pci) { String name = changes[pci].name; Object value = changes[pci].val; PropertyChangeOp op = changes[pci].op; if (op != PropertyChangeOp.remove) { Console.WriteLine(" Property Name: " + name); if ("summary.quickStats".Equals(name)) { if (value.GetType().Name.Equals("VirtualMachineQuickStats")) { VirtualMachineQuickStats vmqs = (VirtualMachineQuickStats)value; String cpu = vmqs.overallCpuUsage.ToString() == null ? "unavailable" :vmqs.overallCpuUsage.ToString(); String memory = vmqs.hostMemoryUsage.ToString() == null ? "unavailable" : vmqs.hostMemoryUsage.ToString(); Console.WriteLine(" Guest Status: " + vmqs.guestHeartbeatStatus.ToString()); Console.WriteLine(" CPU Load %: " + cpu); Console.WriteLine(" Memory Load %: " + memory); } else if (value.GetType().Name.Equals("HostListSummaryQuickStats")) { HostListSummaryQuickStats hsqs = (HostListSummaryQuickStats)value; String cpu = hsqs.overallCpuUsage.ToString() == null ? "unavailable" : hsqs.overallCpuUsage.ToString(); String memory = hsqs.overallMemoryUsage.ToString() == null ? "unavailable" : hsqs.overallMemoryUsage.ToString(); Console.WriteLine(" CPU Load %: " + cpu); Console.WriteLine(" Memory Load %: " + memory); } } else if ("runtime".Equals(name)) { if (value.GetType().Name.Equals("VirtualMachineRuntimeInfo")) { VirtualMachineRuntimeInfo vmri = (VirtualMachineRuntimeInfo)value; Console.WriteLine(" Power State: " + vmri.powerState.ToString()); Console.WriteLine(" Connection State: " + vmri.connectionState.ToString()); DateTime bTime = vmri.bootTime; if (bTime != null) { Console.WriteLine(" Boot Time: " + bTime.TimeOfDay); } long mOverhead = vmri.memoryOverhead; if (mOverhead.ToString() != null) { Console.WriteLine(" Memory Overhead: " + mOverhead); } } else if (value.GetType().Name.Equals("HostRuntimeInfo")) { HostRuntimeInfo hri = (HostRuntimeInfo)value; Console.WriteLine(" Connection State: " + hri.connectionState.ToString()); DateTime bTime = hri.bootTime; if (bTime != null) { Console.WriteLine(" Boot Time: " + bTime.TimeOfDay); } } } else if ("name".Equals(name)) { Console.WriteLine(" " + value); } else { Console.WriteLine(" " + value.ToString()); } } else { Console.WriteLine("Property Name: " + name + " value removed."); } } }
public Host(ManagedObjectReference _this, String name, HostHardwareSummary hardware, HostSystemConnectionState connectionState, ManagedEntityStatus overallStatus, HostListSummaryQuickStats quickStats) { this.setMoRef(_this); this.setName(name); this.setHardware(hardware); this.setConnectionState(connectionState); this.setOverallStatus(overallStatus); this.setQuickStats(quickStats); }