Ejemplo n.º 1
0
        private static IComparable MemoryValueProperty(IXenObject o)
        {
            if (o is VM vm)
            {
                return(vm.is_a_real_vm() &&
                       vm.power_state == vm_power_state.Running &&
                       vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)
                        ? (IComparable)PropertyAccessorHelper.vmMemoryUsageValue(vm)
                        : null);
            }

            if (o is Host host)
            {
                return(host.Connection != null && host.Connection.IsConnected
                        ? (IComparable)PropertyAccessorHelper.hostMemoryUsageValue(host)
                        : null);
            }

            if (o is VDI vdi)
            {
                return(vdi.virtual_size == 0 ? 0.0 : vdi.physical_utilisation);
            }

            return(null);
        }
Ejemplo n.º 2
0
        private static IComparable MemoryTextProperty(IXenObject o)
        {
            if (o is VM vm)
            {
                return(vm.is_a_real_vm() &&
                       vm.power_state == vm_power_state.Running &&
                       vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)
                    ? PropertyAccessorHelper.vmMemoryUsageString(vm)
                    : null);
            }

            if (o is Host host)
            {
                return(host.Connection != null && host.Connection.IsConnected
                    ? PropertyAccessorHelper.hostMemoryUsageString(host)
                    : null);
            }

            if (o is VDI vdi)
            {
                return(PropertyAccessorHelper.vdiMemoryUsageString(vdi));
            }

            return(null);
        }
Ejemplo n.º 3
0
 private static IComparable DiskTextProperty(IXenObject o)
 {
     return(o is VM vm &&
            vm.is_a_real_vm() &&
            vm.power_state == vm_power_state.Running &&
            vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)
         ? PropertyAccessorHelper.vmDiskUsageString(vm)
         : null);
 }
Ejemplo n.º 4
0
 private static IComparable HATextProperty(IXenObject o)
 {
     if (o is VM vm)
     {
         return(PropertyAccessorHelper.GetVMHAStatus(vm));
     }
     if (o is Pool pool)
     {
         return(PropertyAccessorHelper.GetPoolHAStatus(pool));
     }
     if (o is SR sr)
     {
         return(PropertyAccessorHelper.GetSRHAStatus(sr));
     }
     return(null);
 }
Ejemplo n.º 5
0
        private static IComparable CPUValueProperty(IXenObject o)
        {
            if (o is VM vm)
            {
                return(vm.is_a_real_vm() && vm.power_state == vm_power_state.Running
                    ? (IComparable)PropertyAccessorHelper.vmCpuUsageRank(vm)
                    : null);
            }

            if (o is Host host)
            {
                return(host.Connection != null && host.Connection.IsConnected
                    ? (IComparable)PropertyAccessorHelper.hostCpuUsageRank(host)
                    : null);
            }

            return(null);
        }
Ejemplo n.º 6
0
        private static IComparable NetworkTextProperty(IXenObject o)
        {
            if (o is VM vm)
            {
                return(vm.is_a_real_vm() &&
                       vm.power_state != vm_power_state.Running &&
                       vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)
                    ? PropertyAccessorHelper.vmNetworkUsageString(vm)
                    : null);
            }

            if (o is Host host)
            {
                return(host.Connection != null && host.Connection.IsConnected
                    ? PropertyAccessorHelper.hostNetworkUsageString(host)
                    : null);
            }

            return(null);
        }