diff --git a/XenAdmin/Actions/GUIActions/ExportResourceReportAction.cs b/XenAdmin/Actions/GUIActions/ExportResourceReportAction.cs index cf0749873..722e662d2 100755 --- a/XenAdmin/Actions/GUIActions/ExportResourceReportAction.cs +++ b/XenAdmin/Actions/GUIActions/ExportResourceReportAction.cs @@ -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; diff --git a/XenAdmin/Commands/ActivateVBDCommand.cs b/XenAdmin/Commands/ActivateVBDCommand.cs index c762c660f..2de60a3b6 100644 --- a/XenAdmin/Commands/ActivateVBDCommand.cs +++ b/XenAdmin/Commands/ActivateVBDCommand.cs @@ -86,7 +86,7 @@ namespace XenAdmin.Commands { VM vm = vbd.Connection.Resolve(vbd.VM); VDI vdi = vbd.Connection.Resolve(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(vdi.SR); diff --git a/XenAdmin/Commands/Controls/AssignVMGroupToolStripMenuItem.cs b/XenAdmin/Commands/Controls/AssignVMGroupToolStripMenuItem.cs index 1ec4a002b..a9dc74f69 100644 --- a/XenAdmin/Commands/Controls/AssignVMGroupToolStripMenuItem.cs +++ b/XenAdmin/Commands/Controls/AssignVMGroupToolStripMenuItem.cs @@ -276,7 +276,7 @@ namespace XenAdmin.Commands public bool CanRun(VM vm) { - return vm != null && vm.is_a_real_vm() && !vm.Locked && VMGroup.FeaturePossible(vm.Connection) && + return vm != null && vm.IsRealVm() && !vm.Locked && VMGroup.FeaturePossible(vm.Connection) && !Helpers.FeatureForbidden(vm.Connection, VMGroup.FeatureRestricted); } protected override bool CanRunCore(SelectedItemCollection selection) diff --git a/XenAdmin/Commands/DeactivateVBDCommand.cs b/XenAdmin/Commands/DeactivateVBDCommand.cs index f55a4861e..c40250ba4 100644 --- a/XenAdmin/Commands/DeactivateVBDCommand.cs +++ b/XenAdmin/Commands/DeactivateVBDCommand.cs @@ -87,7 +87,7 @@ namespace XenAdmin.Commands { VDI vdi = vbd.Connection.Resolve(vbd.VDI); VM vm = vbd.Connection.Resolve(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(vdi.SR); diff --git a/XenAdmin/Commands/ExportCommand.cs b/XenAdmin/Commands/ExportCommand.cs index 2c00f62f5..386152348 100644 --- a/XenAdmin/Commands/ExportCommand.cs +++ b/XenAdmin/Commands/ExportCommand.cs @@ -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) diff --git a/XenAdmin/Diagnostics/Checks/AssertCanEvacuateCheck.cs b/XenAdmin/Diagnostics/Checks/AssertCanEvacuateCheck.cs index 27cc48dcb..8cab9cfd4 100644 --- a/XenAdmin/Diagnostics/Checks/AssertCanEvacuateCheck.cs +++ b/XenAdmin/Diagnostics/Checks/AssertCanEvacuateCheck.cs @@ -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); diff --git a/XenAdmin/Diagnostics/Checks/AssertCanEvacuateUpgradeCheck.cs b/XenAdmin/Diagnostics/Checks/AssertCanEvacuateUpgradeCheck.cs index dd4f89b1b..b6e44dd0e 100644 --- a/XenAdmin/Diagnostics/Checks/AssertCanEvacuateUpgradeCheck.cs +++ b/XenAdmin/Diagnostics/Checks/AssertCanEvacuateUpgradeCheck.cs @@ -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) diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs index 74a838294..6e4aced45 100644 --- a/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/CPUIncompatibilityProblem.cs @@ -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); } diff --git a/XenAdmin/Dialogs/ScheduledSnapshots/ScheduledSnapshotsDialog.cs b/XenAdmin/Dialogs/ScheduledSnapshots/ScheduledSnapshotsDialog.cs index 85eb20705..cc7bbc360 100644 --- a/XenAdmin/Dialogs/ScheduledSnapshots/ScheduledSnapshotsDialog.cs +++ b/XenAdmin/Dialogs/ScheduledSnapshots/ScheduledSnapshotsDialog.cs @@ -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) diff --git a/XenAdmin/Dialogs/VIFDialog.cs b/XenAdmin/Dialogs/VIFDialog.cs index 5c0f8f318..591144338 100644 --- a/XenAdmin/Dialogs/VIFDialog.cs +++ b/XenAdmin/Dialogs/VIFDialog.cs @@ -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, diff --git a/XenAdmin/TabPages/BallooningPage.cs b/XenAdmin/TabPages/BallooningPage.cs index 36a087088..5c4283c9a 100644 --- a/XenAdmin/TabPages/BallooningPage.cs +++ b/XenAdmin/TabPages/BallooningPage.cs @@ -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 diff --git a/XenAdmin/TabPages/PvsPage.cs b/XenAdmin/TabPages/PvsPage.cs index d7eee2122..e52a39bf7 100644 --- a/XenAdmin/TabPages/PvsPage.cs +++ b/XenAdmin/TabPages/PvsPage.cs @@ -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; diff --git a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs index 5056573bd..a2f6dd64b 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs @@ -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)) diff --git a/XenAdmin/Wizards/GenericPages/NewVMGroupVMsPage.cs b/XenAdmin/Wizards/GenericPages/NewVMGroupVMsPage.cs index b4fc3a172..189f1c25f 100644 --- a/XenAdmin/Wizards/GenericPages/NewVMGroupVMsPage.cs +++ b/XenAdmin/Wizards/GenericPages/NewVMGroupVMsPage.cs @@ -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.GroupToVMs(group).Contains(new XenRef(vm.opaque_ref)); index = dataGridView1.Rows.Add(new VMDataGridViewRow(selected, vm)); diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs index 254464d59..9460dc762 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_ModePage.cs @@ -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(); } } diff --git a/XenModel/Actions/DR/VdiLoadMetadataAction.cs b/XenModel/Actions/DR/VdiLoadMetadataAction.cs index ec18ba133..fa82e744b 100644 --- a/XenModel/Actions/DR/VdiLoadMetadataAction.cs +++ b/XenModel/Actions/DR/VdiLoadMetadataAction.cs @@ -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); diff --git a/XenModel/Actions/Host/VMsWhichCanBeMigratedAction.cs b/XenModel/Actions/Host/VMsWhichCanBeMigratedAction.cs index d38a96e58..d98938ba3 100644 --- a/XenModel/Actions/Host/VMsWhichCanBeMigratedAction.cs +++ b/XenModel/Actions/Host/VMsWhichCanBeMigratedAction.cs @@ -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)) diff --git a/XenModel/DockerContainers.cs b/XenModel/DockerContainers.cs index fdc91c2b0..f49409b1d 100644 --- a/XenModel/DockerContainers.cs +++ b/XenModel/DockerContainers.cs @@ -254,7 +254,7 @@ namespace XenAdmin.Model public static ComparableList GetDockerVMs(IXenObject o) { var vm = o as VM; - if (vm != null && vm.is_a_real_vm()) + if (vm != null && vm.IsRealVm()) { return new ComparableList(DockerContainers.GetContainersFromOtherConfig(vm)); } diff --git a/XenModel/PoolJoinRules.cs b/XenModel/PoolJoinRules.cs index 043520b5d..45a7d6670 100644 --- a/XenModel/PoolJoinRules.cs +++ b/XenModel/PoolJoinRules.cs @@ -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; diff --git a/XenModel/XenAPI-Extensions/Host.cs b/XenModel/XenAPI-Extensions/Host.cs index 49336ba8c..4f255a1d5 100644 --- a/XenModel/XenAPI-Extensions/Host.cs +++ b/XenModel/XenAPI-Extensions/Host.cs @@ -883,7 +883,7 @@ namespace XenAPI { var vms = from XenRef 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 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 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(); diff --git a/XenModel/XenAPI-Extensions/VM.cs b/XenModel/XenAPI-Extensions/VM.cs index 093cf88f0..9b4e93dad 100644 --- a/XenModel/XenAPI-Extensions/VM.cs +++ b/XenModel/XenAPI-Extensions/VM.cs @@ -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 /// 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() diff --git a/XenModel/XenAPI-Extensions/VM_appliance.cs b/XenModel/XenAPI-Extensions/VM_appliance.cs index 76580d519..02d11a581 100644 --- a/XenModel/XenAPI-Extensions/VM_appliance.cs +++ b/XenModel/XenAPI-Extensions/VM_appliance.cs @@ -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); } } diff --git a/XenModel/XenSearch/Common.cs b/XenModel/XenSearch/Common.cs index 4b83a138f..7c13e731a 100644 --- a/XenModel/XenSearch/Common.cs +++ b/XenModel/XenSearch/Common.cs @@ -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); diff --git a/XenModel/XenSearch/GroupAlg.cs b/XenModel/XenSearch/GroupAlg.cs index 7e9381d79..a10f25671 100644 --- a/XenModel/XenSearch/GroupAlg.cs +++ b/XenModel/XenSearch/GroupAlg.cs @@ -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(); } diff --git a/XenModel/XenSearch/GroupingTypes.cs b/XenModel/XenSearch/GroupingTypes.cs index a4f5317d2..a4a5e7a3c 100644 --- a/XenModel/XenSearch/GroupingTypes.cs +++ b/XenModel/XenSearch/GroupingTypes.cs @@ -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 XMOs 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 diff --git a/XenModel/XenSearch/PropertyAccessorHelper.cs b/XenModel/XenSearch/PropertyAccessorHelper.cs index 3d1cb56ed..fa1c04493 100644 --- a/XenModel/XenSearch/PropertyAccessorHelper.cs +++ b/XenModel/XenSearch/PropertyAccessorHelper.cs @@ -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()); }