mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CP-17756: The dom0 VM is found now using the new field Host.control_domain as
there can be more than one control domains. For older hosts return the control domain with domid 0. Renamed property.
This commit is contained in:
parent
94df31b878
commit
56265bbfd6
@ -275,19 +275,20 @@ namespace XenAdmin.SettingsPanels
|
||||
// Dom0 memory usage is stored in the other_config of the Dom0 vm not on the host (or any other XenObject)
|
||||
try
|
||||
{
|
||||
if (_XenObject is Host)
|
||||
var host = _XenObject as Host;
|
||||
if (host != null)
|
||||
{
|
||||
var controlDomain = (_XenObject as Host).ControlDomain;
|
||||
var dom0 = host.ControlDomainZero;
|
||||
|
||||
if (controlDomain != null)
|
||||
if (dom0 != null)
|
||||
{
|
||||
var controlDomainPerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(controlDomain);
|
||||
var controlDomainPerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(dom0);
|
||||
|
||||
if (controlDomainPerfmonDefinitions != null)
|
||||
{
|
||||
for (int ii = 0; ii < controlDomainPerfmonDefinitions.Length; ii++)
|
||||
for (int i = 0; i < controlDomainPerfmonDefinitions.Length; i++)
|
||||
{
|
||||
var def = controlDomainPerfmonDefinitions[ii];
|
||||
var def = controlDomainPerfmonDefinitions[i];
|
||||
|
||||
if (def != null && def.IsDom0MemoryUsage)
|
||||
dom0MemoryAlert.Populate(def);
|
||||
|
@ -74,7 +74,7 @@ namespace XenAdmin.Actions
|
||||
{
|
||||
perfmonDefinitions.Remove(dom0_memory_usage);
|
||||
|
||||
var dom0Vm = theHost == null ? null : theHost.ControlDomain;
|
||||
var dom0Vm = theHost == null ? null : theHost.ControlDomainZero;
|
||||
if (dom0Vm != null)
|
||||
{
|
||||
var dom0PerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(dom0Vm).ToList();
|
||||
@ -102,7 +102,7 @@ namespace XenAdmin.Actions
|
||||
}
|
||||
else
|
||||
{
|
||||
var dom0Vm = theHost == null ? null : theHost.ControlDomain;
|
||||
var dom0Vm = theHost == null ? null : theHost.ControlDomainZero;
|
||||
if (dom0Vm != null)
|
||||
{
|
||||
var dom0PerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(dom0Vm).ToList();
|
||||
|
@ -1038,18 +1038,18 @@ namespace XenAPI
|
||||
/// <summary>
|
||||
/// Will return null if cannot find connection or any control domain in list of vms
|
||||
/// </summary>
|
||||
public VM ControlDomain
|
||||
public VM ControlDomainZero
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Connection == null)
|
||||
return null;
|
||||
foreach (VM vm in Connection.ResolveAll<VM>(resident_VMs))
|
||||
{
|
||||
if (vm.is_control_domain)
|
||||
return vm;
|
||||
}
|
||||
return null;
|
||||
|
||||
if (Helpers.DundeePlusOrGreater(Connection))
|
||||
return Connection.Resolve(control_domain);
|
||||
|
||||
var vms = Connection.ResolveAll(resident_VMs);
|
||||
return vms.FirstOrDefault(vm => vm.is_control_domain && vm.domid == 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ namespace XenAPI
|
||||
private const int DEFAULT_NUM_VBDS_ALLOWED = 16;
|
||||
public const long DEFAULT_MEM_ALLOWED = 1 * Util.BINARY_TERA;
|
||||
public const int DEFAULT_CORES_PER_SOCKET = 1;
|
||||
public const long MAX_SOCKETS = 16; // current hard limit in Xen: CA-198276
|
||||
public const long MAX_SOCKETS = 16; // current hard limit in Xen: CA-198276
|
||||
|
||||
private SnapshotsView _snapshotView = SnapshotsView.None;
|
||||
|
||||
@ -1472,6 +1472,29 @@ namespace XenAPI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the VM is the dom0 (the flag is_control_domain may also apply to other control domains)
|
||||
/// </summary>
|
||||
public bool IsControlDomainZero
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!is_control_domain)
|
||||
return false;
|
||||
|
||||
var host = Connection.Resolve(resident_on);
|
||||
if (host == null)
|
||||
return false;
|
||||
|
||||
if (Helpers.DundeePlusOrGreater(Connection))
|
||||
return host.control_domain == opaque_ref;
|
||||
|
||||
var vms = Connection.ResolveAll(host.resident_VMs);
|
||||
var first = vms.FirstOrDefault(vm => vm.is_control_domain && vm.domid == 0);
|
||||
return first != null && first.opaque_ref == opaque_ref;
|
||||
}
|
||||
}
|
||||
|
||||
public bool not_a_real_vm
|
||||
{
|
||||
get { return is_a_snapshot || is_a_template || is_control_domain; }
|
||||
|
Loading…
Reference in New Issue
Block a user