mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 15:29:26 +01:00
Renamed VM method is_a_real_vm to IsRealVm.
The new name complies with C# conventions and allows distinguishing it from xapi field names. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
00c3a87dad
commit
d94c55533c
@ -776,7 +776,7 @@ namespace XenAdmin.Actions
|
||||
if (Cancelling)
|
||||
throw new CancelledException();
|
||||
|
||||
if (!vm.is_a_real_vm())
|
||||
if (!vm.IsRealVm())
|
||||
{
|
||||
PercentComplete = Convert.ToInt32((++itemIndex) * baseIndex / itemCount);
|
||||
continue;
|
||||
|
@ -86,7 +86,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
VM vm = vbd.Connection.Resolve<VM>(vbd.VM);
|
||||
VDI vdi = vbd.Connection.Resolve<VDI>(vbd.VDI);
|
||||
if (vm == null || !vm.is_a_real_vm() || vdi == null)
|
||||
if (vm == null || !vm.IsRealVm() || vdi == null)
|
||||
return false;
|
||||
if (vm.power_state != vm_power_state.Running)
|
||||
return false;
|
||||
@ -114,7 +114,7 @@ namespace XenAdmin.Commands
|
||||
if (vm.is_a_template)
|
||||
return Messages.CANNOT_ACTIVATE_TEMPLATE_DISK;
|
||||
|
||||
if (!vm.is_a_real_vm())
|
||||
if (!vm.IsRealVm())
|
||||
return base.GetCantRunReasonCore(item);
|
||||
|
||||
SR sr = vdi.Connection.Resolve<SR>(vdi.SR);
|
||||
|
@ -276,7 +276,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
public bool CanRun(VM vm)
|
||||
{
|
||||
return vm != null && vm.is_a_real_vm() && !vm.Locked && VMGroup<T>.FeaturePossible(vm.Connection) &&
|
||||
return vm != null && vm.IsRealVm() && !vm.Locked && VMGroup<T>.FeaturePossible(vm.Connection) &&
|
||||
!Helpers.FeatureForbidden(vm.Connection, VMGroup<T>.FeatureRestricted);
|
||||
}
|
||||
protected override bool CanRunCore(SelectedItemCollection selection)
|
||||
|
@ -87,7 +87,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
VDI vdi = vbd.Connection.Resolve<VDI>(vbd.VDI);
|
||||
VM vm = vbd.Connection.Resolve<VM>(vbd.VM);
|
||||
if (vm == null || !vm.is_a_real_vm() || vdi == null || vdi.Locked || vbd.Locked)
|
||||
if (vm == null || !vm.IsRealVm() || vdi == null || vdi.Locked || vbd.Locked)
|
||||
return false;
|
||||
if (vm.power_state != vm_power_state.Running)
|
||||
return false;
|
||||
@ -115,7 +115,7 @@ namespace XenAdmin.Commands
|
||||
if (vm.is_a_template)
|
||||
return Messages.CANNOT_ACTIVATE_TEMPLATE_DISK;
|
||||
|
||||
if (!vm.is_a_real_vm())
|
||||
if (!vm.IsRealVm())
|
||||
return base.GetCantRunReasonCore(item);
|
||||
|
||||
SR sr = vdi.Connection.Resolve<SR>(vdi.SR);
|
||||
|
@ -77,7 +77,7 @@ namespace XenAdmin.Commands
|
||||
if ((hostAncestor != null && hostAncestor.enabled && hostAncestor.IsLive() && selection[0].Connection.IsConnected)
|
||||
|| (poolAncestor != null && Helpers.PoolHasEnabledHosts(poolAncestor)))
|
||||
{
|
||||
var vms = selection.FirstAsXenObject.Connection.Cache.VMs.Where(vm => vm.is_a_real_vm() && CanExportVm(vm) && vm.Show(Properties.Settings.Default.ShowHiddenVMs)).ToList();
|
||||
var vms = selection.FirstAsXenObject.Connection.Cache.VMs.Where(vm => vm.IsRealVm() && CanExportVm(vm) && vm.Show(Properties.Settings.Default.ShowHiddenVMs)).ToList();
|
||||
if (vms.Count > 0)
|
||||
return vms.Any(CanExportVm);
|
||||
}
|
||||
@ -95,7 +95,7 @@ namespace XenAdmin.Commands
|
||||
if (item != null && item.Connection != null)
|
||||
{
|
||||
var vms = item.Connection.Cache.VMs.Where(xvm =>
|
||||
xvm.is_a_real_vm() && CanExportVm(xvm) &&
|
||||
xvm.IsRealVm() && CanExportVm(xvm) &&
|
||||
xvm.Show(Properties.Settings.Default.ShowHiddenVMs)).ToList();
|
||||
|
||||
if (vms.Count == 0)
|
||||
|
@ -93,7 +93,7 @@ namespace XenAdmin.Diagnostics.Checks
|
||||
VMsWithProblems.Add(residentVM.opaque_ref);
|
||||
}
|
||||
|
||||
if (restrictMigration && residentVM.is_a_real_vm() && !VMsWithProblems.Contains(residentVM.opaque_ref))
|
||||
if (restrictMigration && residentVM.IsRealVm() && !VMsWithProblems.Contains(residentVM.opaque_ref))
|
||||
{
|
||||
problems.Add(new CannotMigrateVM(this, residentVM, CannotMigrateVM.CannotMigrateVMReason.LicenseRestriction));
|
||||
VMsWithProblems.Add(residentVM.opaque_ref);
|
||||
|
@ -57,7 +57,7 @@ namespace XenAdmin.Diagnostics.Checks
|
||||
}
|
||||
|
||||
//vCPU configuration check
|
||||
foreach (var vm in Host.Connection.Cache.VMs.Where(vm => vm.is_a_real_vm()))
|
||||
foreach (var vm in Host.Connection.Cache.VMs.Where(vm => vm.IsRealVm()))
|
||||
{
|
||||
if (!vm.HasValidVCPUConfiguration())
|
||||
return new InvalidVCPUConfiguration(this, vm);
|
||||
@ -71,7 +71,7 @@ namespace XenAdmin.Diagnostics.Checks
|
||||
if (pool == null)
|
||||
return false;
|
||||
|
||||
if (!pool.Connection.Cache.VMs.Any(vm => vm.is_a_real_vm() && vm.power_state != vm_power_state.Halted))
|
||||
if (!pool.Connection.Cache.VMs.Any(vm => vm.IsRealVm() && vm.power_state != vm_power_state.Halted))
|
||||
return false;
|
||||
|
||||
foreach (var host1 in pool.Connection.Cache.Hosts)
|
||||
|
@ -48,7 +48,7 @@ namespace XenAdmin.Diagnostics.Problems.PoolProblem
|
||||
public CPUIncompatibilityProblem(Check check, Pool pool)
|
||||
: base(check, pool)
|
||||
{
|
||||
foreach (var vm in pool.Connection.Cache.VMs.Where(vm => vm.is_a_real_vm() && vm.power_state != vm_power_state.Halted))
|
||||
foreach (var vm in pool.Connection.Cache.VMs.Where(vm => vm.IsRealVm() && vm.power_state != vm_power_state.Halted))
|
||||
{
|
||||
vmsOnHosts.Add(vm, vm.resident_on);
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ namespace XenAdmin.Dialogs.ScheduledSnapshots
|
||||
private void RefreshRow()
|
||||
{
|
||||
PolicyName = Policy.Name();
|
||||
PolicyVmCount = Policy.VMs.FindAll(vm => Policy.Connection.Resolve(vm).is_a_real_vm()).Count;
|
||||
PolicyVmCount = Policy.VMs.FindAll(vm => Policy.Connection.Resolve(vm).IsRealVm()).Count;
|
||||
PolicyStatus = Policy.enabled ? Messages.ENABLED : Messages.DISABLED;
|
||||
|
||||
//the policy is in server's local time zone
|
||||
@ -178,7 +178,7 @@ namespace XenAdmin.Dialogs.ScheduledSnapshots
|
||||
|
||||
foreach (var vm in pool.Connection.Cache.VMs)
|
||||
{
|
||||
if (vm.is_a_real_vm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs))
|
||||
if (vm.IsRealVm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs))
|
||||
{
|
||||
realVMs++;
|
||||
if (vm.Connection.Resolve(vm.snapshot_schedule) != null)
|
||||
|
@ -308,7 +308,7 @@ namespace XenAdmin.Dialogs
|
||||
foreach (VIF vif in xenConnection.Cache.VIFs)
|
||||
{
|
||||
var vm = xenConnection.Resolve(vif.VM);
|
||||
if (vif != ExistingVif && vif.MAC == SelectedMac && vm != null && vm.is_a_real_vm())
|
||||
if (vif != ExistingVif && vif.MAC == SelectedMac && vm != null && vm.IsRealVm())
|
||||
{
|
||||
using (var dlg = new WarningDialog(string.Format(Messages.PROBLEM_MAC_ADDRESS_IS_DUPLICATE, SelectedMac, vm.NameWithLocation()),
|
||||
ThreeButtonDialog.ButtonYes,
|
||||
|
@ -126,7 +126,7 @@ namespace XenAdmin.TabPages
|
||||
|
||||
private bool VMWanted(VM vm, Host host)
|
||||
{
|
||||
return vm.is_a_real_vm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs) && vm.Home() == host;
|
||||
return vm.IsRealVm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs) && vm.Home() == host;
|
||||
}
|
||||
|
||||
private readonly CollectionChangeEventHandler VM_CollectionChangedWithInvoke;
|
||||
@ -261,7 +261,7 @@ namespace XenAdmin.TabPages
|
||||
{
|
||||
// Only observe real VMs (but templates come through here too because
|
||||
// they change into real VMs during VM creation).
|
||||
if (!((VM)sender).is_a_real_vm())
|
||||
if (!((VM)sender).IsRealVm())
|
||||
return;
|
||||
|
||||
// These are used by MainWindow.VMHome() to determine which host the VM belongs to
|
||||
|
@ -101,7 +101,7 @@ namespace XenAdmin.TabPages
|
||||
if (XenAdminConfigManager.Provider.ObjectIsHidden(vm.opaque_ref))
|
||||
return false;
|
||||
|
||||
return vm.is_a_real_vm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs) && !vm.IsBeingCreated;
|
||||
return vm.IsRealVm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs) && !vm.IsBeingCreated;
|
||||
}
|
||||
|
||||
private static bool VmIsJustAdded(VM vm)
|
||||
@ -138,7 +138,7 @@ namespace XenAdmin.TabPages
|
||||
foreach (var vm in Connection.Cache.VMs)
|
||||
{
|
||||
// Add all real VMs and templates that begin with __gui__ (because this may be a new VM)
|
||||
var addVm = vm.is_a_real_vm() || VmIsJustAdded(vm) || vm.IsBeingCreated;
|
||||
var addVm = vm.IsRealVm() || VmIsJustAdded(vm) || vm.IsBeingCreated;
|
||||
|
||||
if (!addVm)
|
||||
continue;
|
||||
|
@ -184,7 +184,7 @@ namespace XenAdmin.Wizards.ExportWizard
|
||||
|
||||
private bool IsVmExportable(VM vm)
|
||||
{
|
||||
if (!vm.is_a_real_vm())
|
||||
if (!vm.IsRealVm())
|
||||
return false;
|
||||
|
||||
if (!vm.Show(Properties.Settings.Default.ShowHiddenVMs))
|
||||
|
@ -115,7 +115,7 @@ namespace XenAdmin.Wizards.GenericPages
|
||||
dataGridView1.Rows.Clear();
|
||||
foreach (var vm in Pool.Connection.Cache.VMs)
|
||||
{
|
||||
if (searchTextBox1.Matches(vm.Name()) && vm.is_a_real_vm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs))
|
||||
if (searchTextBox1.Matches(vm.Name()) && vm.IsRealVm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs))
|
||||
dataGridView1.Rows.Add(new VMDataGridViewRow(SelectedVMs.Contains(vm), vm));
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ namespace XenAdmin.Wizards.GenericPages
|
||||
foreach (var vm in Pool.Connection.Cache.VMs)
|
||||
{
|
||||
int index = 0;
|
||||
if (vm.is_a_real_vm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs))
|
||||
if (vm.IsRealVm() && vm.Show(Properties.Settings.Default.ShowHiddenVMs))
|
||||
{
|
||||
bool selected = group != null && VMGroup<T>.GroupToVMs(group).Contains(new XenRef<VM>(vm.opaque_ref));
|
||||
index = dataGridView1.Rows.Add(new VMDataGridViewRow(selected, vm));
|
||||
|
@ -393,7 +393,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
foreach (var vmRef in server.resident_VMs)
|
||||
{
|
||||
var vm = server.Connection.Resolve(vmRef);
|
||||
if (vm != null && vm.is_a_real_vm() && predicate.Invoke(vm))
|
||||
if (vm != null && vm.IsRealVm() && predicate.Invoke(vm))
|
||||
sb.AppendIndented(vm.Name()).AppendLine();
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ namespace XenAdmin.Actions.DR
|
||||
foreach (var vmRef in vms.Keys)
|
||||
{
|
||||
VM vm = vms[vmRef];
|
||||
if (!vm.is_a_real_vm())
|
||||
if (!vm.IsRealVm())
|
||||
continue;
|
||||
vm.opaque_ref = vmRef.opaque_ref;
|
||||
_poolMetadata.Vms.Add(vmRef, vm);
|
||||
|
@ -62,7 +62,7 @@ namespace XenAdmin.Actions.HostActions
|
||||
|
||||
foreach(VM vm in Connection.ResolveAll(Host.resident_VMs))
|
||||
{
|
||||
if (!vm.is_a_real_vm())
|
||||
if (!vm.IsRealVm())
|
||||
continue;
|
||||
|
||||
if (VmsRefsNotMigratable.Contains(vm.opaque_ref))
|
||||
|
@ -254,7 +254,7 @@ namespace XenAdmin.Model
|
||||
public static ComparableList<DockerContainer> GetDockerVMs(IXenObject o)
|
||||
{
|
||||
var vm = o as VM;
|
||||
if (vm != null && vm.is_a_real_vm())
|
||||
if (vm != null && vm.IsRealVm())
|
||||
{
|
||||
return new ComparableList<DockerContainer>(DockerContainers.GetContainersFromOtherConfig(vm));
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ namespace XenAdmin.Core
|
||||
{
|
||||
foreach (VM vm in connection.Cache.VMs)
|
||||
{
|
||||
if (vm.is_a_real_vm() && vm.power_state == XenAPI.vm_power_state.Running)
|
||||
if (vm.IsRealVm() && vm.power_state == XenAPI.vm_power_state.Running)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -883,7 +883,7 @@ namespace XenAPI
|
||||
{
|
||||
var vms = from XenRef<VM> vmref in resident_VMs
|
||||
let vm = Connection.Resolve(vmref)
|
||||
where vm != null && vm.is_a_real_vm() && !vm.IsHVM()
|
||||
where vm != null && vm.IsRealVm() && !vm.IsHVM()
|
||||
select vmref;
|
||||
|
||||
return vms.ToList();
|
||||
@ -893,7 +893,7 @@ namespace XenAPI
|
||||
{
|
||||
var vms = from XenRef<VM> vmref in resident_VMs
|
||||
let vm = Connection.Resolve(vmref)
|
||||
where vm != null && vm.is_a_real_vm() && vm.IsHVM()
|
||||
where vm != null && vm.IsRealVm() && vm.IsHVM()
|
||||
select vmref;
|
||||
|
||||
return vms.ToList();
|
||||
@ -904,7 +904,7 @@ namespace XenAPI
|
||||
{
|
||||
var vms = from XenRef<VM> vmref in resident_VMs
|
||||
let vm = Connection.Resolve(vmref)
|
||||
where vm != null && vm.is_a_real_vm()
|
||||
where vm != null && vm.IsRealVm()
|
||||
select vmref;
|
||||
|
||||
return vms.ToList();
|
||||
|
@ -275,7 +275,7 @@ namespace XenAPI
|
||||
|
||||
public bool IsPvVm()
|
||||
{
|
||||
return is_a_real_vm() && !IsHVM() && !other_config.ContainsKey("pvcheckpass");
|
||||
return IsRealVm() && !IsHVM() && !other_config.ContainsKey("pvcheckpass");
|
||||
}
|
||||
|
||||
public bool IsUEFIEnabled()
|
||||
@ -1104,7 +1104,7 @@ namespace XenAPI
|
||||
{
|
||||
if (this.Connection != null)
|
||||
{
|
||||
if (this.is_a_real_vm())
|
||||
if (this.IsRealVm())
|
||||
{
|
||||
return base.NameWithLocation();
|
||||
}
|
||||
@ -1221,7 +1221,7 @@ namespace XenAPI
|
||||
/// </summary>
|
||||
public bool HaCanProtect(bool showHiddenVMs)
|
||||
{
|
||||
return is_a_real_vm() && Show(showHiddenVMs);
|
||||
return IsRealVm() && Show(showHiddenVMs);
|
||||
|
||||
}
|
||||
|
||||
@ -1331,7 +1331,7 @@ namespace XenAPI
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool is_a_real_vm()
|
||||
public bool IsRealVm()
|
||||
{
|
||||
return !is_a_snapshot && !is_a_template && !is_control_domain;
|
||||
}
|
||||
@ -1373,7 +1373,7 @@ namespace XenAPI
|
||||
|
||||
public bool IsConversionVM()
|
||||
{
|
||||
return is_a_real_vm() && BoolKey(other_config, "conversionvm");
|
||||
return IsRealVm() && BoolKey(other_config, "conversionvm");
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
@ -63,7 +63,7 @@ namespace XenAPI
|
||||
|
||||
foreach (var otherVm in vmsNotInCurApp)
|
||||
{
|
||||
if (otherVm.is_a_real_vm() && otherVm.power_state != vm_power_state.Halted && otherVm.SRs().Intersect(thisVm.SRs()).FirstOrDefault() != null && !fateSharingVms.Contains(otherVm))
|
||||
if (otherVm.IsRealVm() && otherVm.power_state != vm_power_state.Halted && otherVm.SRs().Intersect(thisVm.SRs()).FirstOrDefault() != null && !fateSharingVms.Contains(otherVm))
|
||||
fateSharingVms.Add(otherVm);
|
||||
}
|
||||
}
|
||||
|
@ -302,12 +302,12 @@ namespace XenAdmin.XenSearch
|
||||
property_types.Add(PropertyNames.in_any_appliance, typeof(bool));
|
||||
property_types.Add(PropertyNames.disks, typeof(VDI));
|
||||
|
||||
properties[PropertyNames.os_name] = o => o is VM vm && vm.is_a_real_vm() ? vm.GetOSName() : null;
|
||||
properties[PropertyNames.power_state] = o => o is VM vm && vm.is_a_real_vm() ? (IComparable)vm.power_state : null;
|
||||
properties[PropertyNames.vendor_device_state] = o => o is VM vm && vm.is_a_real_vm() ? (bool?)vm.WindowsUpdateCapable() : null;
|
||||
properties[PropertyNames.virtualisation_status] = o => o is VM vm && vm.is_a_real_vm() ? (IComparable)vm.GetVirtualisationStatus(out _) : null;
|
||||
properties[PropertyNames.start_time] = o => o is VM vm && vm.is_a_real_vm() ? (DateTime?)vm.GetStartTime() : null;
|
||||
properties[PropertyNames.read_caching_enabled] = o => o is VM vm && vm.is_a_real_vm() ? (bool?)vm.ReadCachingEnabled() : null;
|
||||
properties[PropertyNames.os_name] = o => o is VM vm && vm.IsRealVm() ? vm.GetOSName() : null;
|
||||
properties[PropertyNames.power_state] = o => o is VM vm && vm.IsRealVm() ? (IComparable)vm.power_state : null;
|
||||
properties[PropertyNames.vendor_device_state] = o => o is VM vm && vm.IsRealVm() ? (bool?)vm.WindowsUpdateCapable() : null;
|
||||
properties[PropertyNames.virtualisation_status] = o => o is VM vm && vm.IsRealVm() ? (IComparable)vm.GetVirtualisationStatus(out _) : null;
|
||||
properties[PropertyNames.start_time] = o => o is VM vm && vm.IsRealVm() ? (DateTime?)vm.GetStartTime() : null;
|
||||
properties[PropertyNames.read_caching_enabled] = o => o is VM vm && vm.IsRealVm() ? (bool?)vm.ReadCachingEnabled() : null;
|
||||
|
||||
properties[PropertyNames.label] = Helpers.GetName;
|
||||
properties[PropertyNames.pool] = o => o == null ? null : Helpers.GetPool(o.Connection);
|
||||
@ -329,7 +329,7 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
properties[PropertyNames.memory] = o =>
|
||||
{
|
||||
if (o is VM vm && vm.is_a_real_vm() && vm.Connection != null)
|
||||
if (o is VM vm && vm.IsRealVm() && vm.Connection != null)
|
||||
{
|
||||
var metrics = vm.Connection.Resolve(vm.metrics);
|
||||
if (metrics != null)
|
||||
@ -340,7 +340,7 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
properties[PropertyNames.ha_restart_priority] = delegate(IXenObject o)
|
||||
{
|
||||
if (o is VM vm && vm.is_a_real_vm())
|
||||
if (o is VM vm && vm.IsRealVm())
|
||||
{
|
||||
Pool pool = Helpers.GetPool(vm.Connection);
|
||||
if (pool != null && pool.ha_enabled)
|
||||
@ -359,7 +359,7 @@ namespace XenAdmin.XenSearch
|
||||
if (o is VM_appliance app)
|
||||
return app;
|
||||
|
||||
if (o is VM vm && vm.is_a_real_vm() && vm.Connection != null)
|
||||
if (o is VM vm && vm.IsRealVm() && vm.Connection != null)
|
||||
return vm.Connection.Resolve(vm.appliance);
|
||||
|
||||
return null;
|
||||
@ -369,7 +369,7 @@ namespace XenAdmin.XenSearch
|
||||
{
|
||||
if (o is VM_appliance)
|
||||
return true;
|
||||
if (o is VM vm && vm.is_a_real_vm() && vm.Connection != null)
|
||||
if (o is VM vm && vm.IsRealVm() && vm.Connection != null)
|
||||
return vm.Connection.Resolve(vm.appliance) != null;
|
||||
return null;
|
||||
};
|
||||
@ -422,7 +422,7 @@ namespace XenAdmin.XenSearch
|
||||
private static IComparable UptimeProperty(IXenObject o)
|
||||
{
|
||||
if (o is VM vm)
|
||||
return vm.is_a_real_vm() ? vm.RunningTime() : null;
|
||||
return vm.IsRealVm() ? vm.RunningTime() : null;
|
||||
|
||||
if (o is Host host)
|
||||
return host.Uptime();
|
||||
@ -433,7 +433,7 @@ namespace XenAdmin.XenSearch
|
||||
private static IComparable CPUTextProperty(IXenObject o)
|
||||
{
|
||||
if (o is VM vm)
|
||||
return vm.is_a_real_vm() && vm.power_state == vm_power_state.Running
|
||||
return vm.IsRealVm() && vm.power_state == vm_power_state.Running
|
||||
? PropertyAccessorHelper.vmCpuUsageString(vm)
|
||||
: null;
|
||||
|
||||
@ -448,7 +448,7 @@ namespace XenAdmin.XenSearch
|
||||
private static IComparable CPUValueProperty(IXenObject o)
|
||||
{
|
||||
if (o is VM vm)
|
||||
return vm.is_a_real_vm() && vm.power_state == vm_power_state.Running
|
||||
return vm.IsRealVm() && vm.power_state == vm_power_state.Running
|
||||
? (IComparable)PropertyAccessorHelper.vmCpuUsageRank(vm)
|
||||
: null;
|
||||
|
||||
@ -464,7 +464,7 @@ namespace XenAdmin.XenSearch
|
||||
{
|
||||
if (o is VM vm)
|
||||
{
|
||||
return vm.is_a_real_vm() &&
|
||||
return vm.IsRealVm() &&
|
||||
vm.power_state == vm_power_state.Running &&
|
||||
vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)
|
||||
? PropertyAccessorHelper.vmMemoryUsageString(vm)
|
||||
@ -486,7 +486,7 @@ namespace XenAdmin.XenSearch
|
||||
{
|
||||
if (o is VM vm)
|
||||
{
|
||||
return vm.is_a_real_vm() &&
|
||||
return vm.IsRealVm() &&
|
||||
vm.power_state == vm_power_state.Running &&
|
||||
vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)
|
||||
? (IComparable)PropertyAccessorHelper.vmMemoryUsageRank(vm)
|
||||
@ -508,7 +508,7 @@ namespace XenAdmin.XenSearch
|
||||
{
|
||||
if (o is VM vm)
|
||||
{
|
||||
return vm.is_a_real_vm() &&
|
||||
return vm.IsRealVm() &&
|
||||
vm.power_state == vm_power_state.Running &&
|
||||
vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)
|
||||
? (IComparable)PropertyAccessorHelper.vmMemoryUsageValue(vm)
|
||||
@ -530,7 +530,7 @@ namespace XenAdmin.XenSearch
|
||||
{
|
||||
if (o is VM vm)
|
||||
{
|
||||
return vm.is_a_real_vm() &&
|
||||
return vm.IsRealVm() &&
|
||||
vm.power_state == vm_power_state.Running &&
|
||||
vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)
|
||||
? PropertyAccessorHelper.vmNetworkUsageString(vm)
|
||||
@ -548,7 +548,7 @@ namespace XenAdmin.XenSearch
|
||||
private static IComparable DiskTextProperty(IXenObject o)
|
||||
{
|
||||
return o is VM vm &&
|
||||
vm.is_a_real_vm() &&
|
||||
vm.IsRealVm() &&
|
||||
vm.power_state == vm_power_state.Running &&
|
||||
vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)
|
||||
? PropertyAccessorHelper.vmDiskUsageString(vm)
|
||||
@ -670,7 +670,7 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
if (o is VM vm)
|
||||
{
|
||||
if (vm.is_a_real_vm() && vm.Connection != null)
|
||||
if (vm.IsRealVm() && vm.Connection != null)
|
||||
foreach (VIF vif in vm.Connection.ResolveAll(vm.VIFs))
|
||||
{
|
||||
XenAPI.Network network = vm.Connection.Resolve(vif.network);
|
||||
@ -752,7 +752,7 @@ namespace XenAdmin.XenSearch
|
||||
vms.Add(container.Parent);
|
||||
}
|
||||
|
||||
vms.RemoveAll(vm => !vm.is_a_real_vm());
|
||||
vms.RemoveAll(vm => !vm.IsRealVm());
|
||||
return vms;
|
||||
}
|
||||
|
||||
@ -815,7 +815,7 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
if (o is VM vm)
|
||||
{
|
||||
if (vm.is_a_real_vm())
|
||||
if (vm.IsRealVm())
|
||||
foreach (VBD vbd in vm.Connection.ResolveAll(vm.VBDs))
|
||||
{
|
||||
VDI vdi = vbd.Connection.Resolve(vbd.VDI);
|
||||
@ -855,7 +855,7 @@ namespace XenAdmin.XenSearch
|
||||
}
|
||||
else if (o is VM vm)
|
||||
{
|
||||
if (vm.is_a_real_vm())
|
||||
if (vm.IsRealVm())
|
||||
foreach (VBD vbd in vm.Connection.ResolveAll(vm.VBDs))
|
||||
{
|
||||
VDI vdi = vbd.Connection.Resolve(vbd.VDI);
|
||||
@ -875,7 +875,7 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
if (o is VM vm)
|
||||
{
|
||||
if (!vm.is_a_real_vm())
|
||||
if (!vm.IsRealVm())
|
||||
return addresses;
|
||||
|
||||
VM_guest_metrics metrics = vm.Connection.Resolve(vm.guest_metrics);
|
||||
|
@ -265,7 +265,7 @@ namespace XenAdmin.XenSearch
|
||||
if (o is Host)
|
||||
return "30";
|
||||
VM vm = o as VM;
|
||||
if (vm != null && vm.is_a_real_vm())
|
||||
if (vm != null && vm.IsRealVm())
|
||||
return "40";
|
||||
return o.GetType().ToString();
|
||||
}
|
||||
|
@ -357,7 +357,7 @@ namespace XenAdmin.XenSearch
|
||||
// Special case: if the type is VM, and the object is not a real VM,
|
||||
// it's not a group. This is because snapshots are XMO<VM>s internally,
|
||||
// but we want to group them by the real VM they came from.
|
||||
if (o is VM vm && !vm.is_a_real_vm())
|
||||
if (o is VM vm && !vm.IsRealVm())
|
||||
return false;
|
||||
|
||||
// Otherwise this is a group
|
||||
|
@ -315,7 +315,7 @@ namespace XenAdmin.XenSearch
|
||||
|
||||
public static string GetVMHAStatus(VM vm)
|
||||
{
|
||||
if (!vm.is_a_real_vm())
|
||||
if (!vm.IsRealVm())
|
||||
return "-";
|
||||
return Helpers.RestartPriorityI18n(vm.HARestartPriority());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user