CA-200888: Write the control domain perfmon config to the correct control domain, and don't blank it when editing a VM

This commit is contained in:
Stephen Turner 2016-02-26 15:42:24 +00:00
parent ccbc07e25d
commit 3073fd071d

View File

@ -64,6 +64,7 @@ namespace XenAdmin.Actions
{ {
if (xo == null) if (xo == null)
return; return;
Host theHost = xo as Host;
// Dom0 Memory usage alert is an exception. While configuration for all the alerts (eg. related to the Host) have to be saved to this "xo", // Dom0 Memory usage alert is an exception. While configuration for all the alerts (eg. related to the Host) have to be saved to this "xo",
// dom0 Memory usage's has to be in the Dom0's other config. // dom0 Memory usage's has to be in the Dom0's other config.
@ -73,7 +74,7 @@ namespace XenAdmin.Actions
{ {
perfmonDefinitions.Remove(dom0_memory_usage); perfmonDefinitions.Remove(dom0_memory_usage);
var dom0Vm = xo.Connection.Cache.VMs.FirstOrDefault(vm => vm.is_control_domain); var dom0Vm = theHost == null ? null : theHost.ControlDomain;
if (dom0Vm != null) if (dom0Vm != null)
{ {
var dom0PerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(dom0Vm).ToList(); var dom0PerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(dom0Vm).ToList();
@ -101,7 +102,7 @@ namespace XenAdmin.Actions
} }
else else
{ {
var dom0Vm = xo.Connection.Cache.VMs.FirstOrDefault(vm => vm.is_control_domain); var dom0Vm = theHost == null ? null : theHost.ControlDomain;
if (dom0Vm != null) if (dom0Vm != null)
{ {
var dom0PerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(dom0Vm).ToList(); var dom0PerfmonDefinitions = PerfmonDefinition.GetPerfmonDefinitions(dom0Vm).ToList();
@ -127,7 +128,6 @@ namespace XenAdmin.Actions
var hosts = new List<Host>(); var hosts = new List<Host>();
Host theHost = xo as Host;
if (theHost == null) if (theHost == null)
{ {
VM vm = xo as VM; VM vm = xo as VM;