mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-24 22:06:59 +01:00
Merge pull request #1757 from xenserver/REQ-420
Merging REQ-420 into master
This commit is contained in:
commit
92b3dc8395
@ -92,7 +92,7 @@ namespace XenAdmin.Actions
|
||||
if (Cancelling)
|
||||
throw new CancelledException();
|
||||
|
||||
log.DebugFormat("Exporting resource list report from {1} to {2}", this.Connection.Cache.Pools[0].Name, _filename);
|
||||
log.DebugFormat("Exporting resource list report from {1} to {2}", this.Connection.Cache.Pools[0].Name(), _filename);
|
||||
|
||||
try
|
||||
{
|
||||
@ -108,7 +108,7 @@ namespace XenAdmin.Actions
|
||||
PercentComplete = 100;
|
||||
if (Cancelling || _exception is CancelledException)
|
||||
{
|
||||
log.InfoFormat("Export of Pool {0} cancelled", this.Connection.Cache.Pools[0].Name);
|
||||
log.InfoFormat("Export of Pool {0} cancelled", this.Connection.Cache.Pools[0].Name());
|
||||
this.Description = Messages.ACTION_EXPORT_DESCRIPTION_CANCELLED;
|
||||
|
||||
log.DebugFormat("Deleting {0}", _filename);
|
||||
@ -125,7 +125,7 @@ namespace XenAdmin.Actions
|
||||
}
|
||||
else if (_exception != null)
|
||||
{
|
||||
log.Warn(string.Format("Export of Pool {0} failed", this.Connection.Cache.Pools[0].Name), _exception);
|
||||
log.Warn(string.Format("Export of Pool {0} failed", this.Connection.Cache.Pools[0].Name()), _exception);
|
||||
log.DebugFormat("Progress of the action until exception: {0}", PercentComplete);
|
||||
|
||||
if (_exception is IOException)
|
||||
@ -148,7 +148,7 @@ namespace XenAdmin.Actions
|
||||
}
|
||||
else
|
||||
{
|
||||
log.InfoFormat("Export of Pool {0} successful", this.Connection.Cache.Pools[0].Name);
|
||||
log.InfoFormat("Export of Pool {0} successful", this.Connection.Cache.Pools[0].Name());
|
||||
this.Description = Messages.ACTION_EXPORT_DESCRIPTION_SUCCESSFUL;
|
||||
}
|
||||
}
|
||||
@ -514,7 +514,7 @@ namespace XenAdmin.Actions
|
||||
string ParamValuesStr;
|
||||
|
||||
ParamLabelsStr = "LBL_POOLINFO|";
|
||||
ParamValuesStr = Messages.POOL + ":" + connection.Cache.Pools[0].Name + "|";
|
||||
ParamValuesStr = Messages.POOL + ":" + connection.Cache.Pools[0].Name() + "|";
|
||||
ParamLabelsStr += "LBL_POOLUUID|";
|
||||
ParamValuesStr += Messages.UUID + ":" + connection.Cache.Pools[0].uuid + "|";
|
||||
//Host Infor
|
||||
@ -629,7 +629,7 @@ namespace XenAdmin.Actions
|
||||
foreach (XenAPI.PBD pbd in PBDs)
|
||||
{
|
||||
SR sr = pbd.Connection.Resolve(pbd.SR);
|
||||
if(sr.IsLocalSR && sr.type.ToLower() == "lvm")
|
||||
if(sr.IsLocalSR() && sr.type.ToLower() == "lvm")
|
||||
{
|
||||
srSizeString += SRSizeString(sr) + ";";
|
||||
}
|
||||
@ -643,7 +643,7 @@ namespace XenAdmin.Actions
|
||||
|
||||
HostInfo buf = new HostInfo(host.name_label, host.address, host.uuid, cpu_usage,
|
||||
host.IsMaster() ? Messages.YES : Messages.NO, network_usage, usage,
|
||||
Convert.ToString(host.Uptime), srSizeString, host.Description);
|
||||
Convert.ToString(host.Uptime()), srSizeString, host.Description());
|
||||
m_Hosts.Add(buf);
|
||||
PercentComplete = Convert.ToInt32((++itemIndex) * baseIndex / itemCount);
|
||||
}
|
||||
@ -660,7 +660,7 @@ namespace XenAdmin.Actions
|
||||
throw new CancelledException();
|
||||
|
||||
// CA-218956 - Expose HIMN when showing hidden objects
|
||||
if (network.IsGuestInstallerNetwork && !XenAdmin.Properties.Settings.Default.ShowHiddenVMs)
|
||||
if (network.IsGuestInstallerNetwork() && !XenAdmin.Properties.Settings.Default.ShowHiddenVMs)
|
||||
{
|
||||
PercentComplete = Convert.ToInt32((++itemIndex) * baseIndex / itemCount);
|
||||
continue;
|
||||
@ -670,13 +670,13 @@ namespace XenAdmin.Actions
|
||||
string type;
|
||||
if (Cancelling)
|
||||
throw new CancelledException();
|
||||
if (network.IsBond)
|
||||
if (network.IsBond())
|
||||
type = Messages.BOND;
|
||||
else if (network.IsVLAN)
|
||||
else if (network.IsVLAN())
|
||||
type = Messages.EXTERNAL_NETWORK;
|
||||
else if (pifs.Count != 0 && pifs[0].IsPhysical)
|
||||
else if (pifs.Count != 0 && pifs[0].IsPhysical())
|
||||
type = Messages.BUILTIN_NETWORK;
|
||||
else if (pifs.Count != 0 && pifs[0].IsTunnelAccessPIF)
|
||||
else if (pifs.Count != 0 && pifs[0].IsTunnelAccessPIF())
|
||||
type = Messages.CHIN;
|
||||
else if (pifs.Count == 0)
|
||||
type = Messages.SINGLE_SERVER_PRIVATE_NETWORK;
|
||||
@ -694,9 +694,9 @@ namespace XenAdmin.Actions
|
||||
|
||||
NetworkInfo buf;
|
||||
if (pifs.Count != 0)
|
||||
buf = new NetworkInfo(network.Name, Helpers.VlanString(pifs[0]), network.LinkStatusString, pifs[0].MAC, network.MTU.ToString(), type, location);
|
||||
buf = new NetworkInfo(network.Name(), Helpers.VlanString(pifs[0]), network.LinkStatusString(), pifs[0].MAC, network.MTU.ToString(), type, location);
|
||||
else
|
||||
buf = new NetworkInfo(network.Name, Messages.HYPHEN, network.LinkStatusString, Messages.HYPHEN, network.MTU.ToString(), type, location);
|
||||
buf = new NetworkInfo(network.Name(), Messages.HYPHEN, network.LinkStatusString(), Messages.HYPHEN, network.MTU.ToString(), type, location);
|
||||
|
||||
m_Networks.Add(buf);
|
||||
|
||||
@ -758,7 +758,7 @@ namespace XenAdmin.Actions
|
||||
if (locationStr.Length == 0)
|
||||
locationStr = Messages.HYPHEN;
|
||||
|
||||
SRInfo buf = new SRInfo(sr.Name, sr.uuid, sr.type, srSizeString, locationStr, sr.Description);
|
||||
SRInfo buf = new SRInfo(sr.Name(), sr.uuid, sr.type, srSizeString, locationStr, sr.Description());
|
||||
m_SRs.Add(buf);
|
||||
PercentComplete = Convert.ToInt32((++itemIndex) * baseIndex / itemCount);
|
||||
}
|
||||
@ -778,7 +778,7 @@ namespace XenAdmin.Actions
|
||||
if (Cancelling)
|
||||
throw new CancelledException();
|
||||
|
||||
if (!vm.is_a_real_vm)
|
||||
if (!vm.is_a_real_vm())
|
||||
{
|
||||
PercentComplete = Convert.ToInt32((++itemIndex) * baseIndex / itemCount);
|
||||
continue;
|
||||
@ -810,10 +810,10 @@ namespace XenAdmin.Actions
|
||||
foreach (XenRef<VBD> vbdRef in vm.VBDs)
|
||||
{
|
||||
var vbd = vm.Connection.Resolve(vbdRef);
|
||||
if (vbd != null && !vbd.IsCDROM && !vbd.IsFloppyDrive && vbd.bootable)
|
||||
if (vbd != null && !vbd.IsCDROM() && !vbd.IsFloppyDrive() && vbd.bootable)
|
||||
{
|
||||
VDI vdi = vm.Connection.Resolve(vbd.VDI);
|
||||
srInfo += vdi.name_label + ":" + vdi.SizeText + ";";
|
||||
srInfo += vdi.name_label + ":" + vdi.SizeText() + ";";
|
||||
}
|
||||
}
|
||||
if (srInfo.Length == 0)
|
||||
@ -821,17 +821,17 @@ namespace XenAdmin.Actions
|
||||
|
||||
if (vm.resident_on != null && !string.IsNullOrEmpty(vm.resident_on.opaque_ref) && !(vm.resident_on.opaque_ref.ToLower().Contains("null")))
|
||||
{
|
||||
running_on = vm.Connection.Resolve(vm.resident_on).Name;
|
||||
running_on = vm.Connection.Resolve(vm.resident_on).Name();
|
||||
}
|
||||
|
||||
string default_template_name = Messages.HYPHEN;
|
||||
if(vm.other_config.ContainsKey("base_template_name"))
|
||||
default_template_name = vm.other_config["base_template_name"];
|
||||
|
||||
VMInfo buf = new VMInfo(vm.Name, vm.uuid, PropertyAccessorHelper.vmCpuUsageStringByMetric(vm, MetricUpdater),
|
||||
VMInfo buf = new VMInfo(vm.Name(), vm.uuid, PropertyAccessorHelper.vmCpuUsageStringByMetric(vm, MetricUpdater),
|
||||
PropertyAccessorHelper.vmMemoryUsagePercentageStringByMetric(vm, MetricUpdater), srInfo, Convert.ToString(vm.VIFs.Count),
|
||||
Convert.ToString(addresses), MacInfo, OSinfo, Convert.ToString(vm.power_state),
|
||||
Convert.ToString(vm.RunningTime), running_on, default_template_name, vm.Description);
|
||||
Convert.ToString(vm.RunningTime()), running_on, default_template_name, vm.Description());
|
||||
|
||||
m_VMs.Add(buf);
|
||||
|
||||
@ -859,7 +859,7 @@ namespace XenAdmin.Actions
|
||||
string powerStatus = PropertyAccessorHelper.PGPUPowerUsageString(pGpu, MetricUpdater);
|
||||
string utilisation = PropertyAccessorHelper.PGPUUtilisationString(pGpu, MetricUpdater);
|
||||
string memInfo = PropertyAccessorHelper.PGPUMemoryUsageString(pGpu, MetricUpdater);
|
||||
PGPUInfo buf = new PGPUInfo(pGpu.Name, pGpu.uuid, host.Name, pci.pci_id, utilisation,
|
||||
PGPUInfo buf = new PGPUInfo(pGpu.Name(), pGpu.uuid, host.Name(), pci.pci_id, utilisation,
|
||||
memInfo, temperature, powerStatus);
|
||||
|
||||
m_PGPUs.Add(buf);
|
||||
@ -876,7 +876,7 @@ namespace XenAdmin.Actions
|
||||
foreach (XenAPI.VDI vdi in VDIs)
|
||||
{
|
||||
XenAPI.SR sr = Connection.Resolve(vdi.SR);
|
||||
VDIInfo buf = new VDIInfo(vdi.Name, vdi.uuid, Convert.ToString(vdi.type), vdi.SizeText, vdi.Description, sr.Name);
|
||||
VDIInfo buf = new VDIInfo(vdi.Name(), vdi.uuid, Convert.ToString(vdi.type), vdi.SizeText(), vdi.Description(), sr.Name());
|
||||
|
||||
m_VDIs.Add(buf);
|
||||
}
|
||||
@ -1154,7 +1154,7 @@ namespace XenAdmin.Actions
|
||||
fs = new FileStream(_filename, FileMode.Create);
|
||||
|
||||
//pool information part
|
||||
items.Add(Messages.POOL + ":" + Connection.Cache.Pools[0].Name);
|
||||
items.Add(Messages.POOL + ":" + Connection.Cache.Pools[0].Name());
|
||||
ComposeCSVRow(ref fs, ref items);
|
||||
items.Add(Messages.UUID + ":" + Connection.Cache.Pools[0].uuid);
|
||||
ComposeCSVRow(ref fs, ref items);
|
||||
|
@ -197,7 +197,7 @@ namespace XenAdmin.Actions
|
||||
bool ableToCompleteAction = Role.CanPerform(methodsToCheck, xenConnection, out rolesAbleToCompleteAction);
|
||||
|
||||
log.DebugFormat("Roles able to complete action: {0}", Role.FriendlyCSVRoleList(rolesAbleToCompleteAction));
|
||||
log.DebugFormat("Subject {0} has roles: {1}", xenConnection.Session.UserLogName, Role.FriendlyCSVRoleList(xenConnection.Session.Roles));
|
||||
log.DebugFormat("Subject {0} has roles: {1}", xenConnection.Session.UserLogName(), Role.FriendlyCSVRoleList(xenConnection.Session.Roles));
|
||||
|
||||
if (ableToCompleteAction)
|
||||
{
|
||||
@ -207,7 +207,7 @@ namespace XenAdmin.Actions
|
||||
|
||||
// Can't run on this connection, bail out
|
||||
string desc = string.Format(FriendlyErrorNames.RBAC_PERMISSION_DENIED_FRIENDLY_CONNECTION,
|
||||
xenConnection.Session.FriendlyRoleDescription,
|
||||
xenConnection.Session.FriendlyRoleDescription(),
|
||||
Role.FriendlyCSVRoleList(rolesAbleToCompleteAction),
|
||||
xenConnection.Name);
|
||||
throw new Exception(desc);
|
||||
|
@ -47,7 +47,7 @@ namespace XenAdmin.Actions.GUIActions
|
||||
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||
|
||||
public MeddlingAction(Task task)
|
||||
: base(task.Title, task.Description, false, false)
|
||||
: base(task.Title(), task.Description(), false, false)
|
||||
{
|
||||
RelatedTask = new XenRef<Task>(task.opaque_ref);
|
||||
|
||||
@ -126,11 +126,11 @@ namespace XenAdmin.Actions.GUIActions
|
||||
|
||||
private void SetAppliesToData(Task task)
|
||||
{
|
||||
List<string> applies_to = task.AppliesTo;
|
||||
List<string> applies_to = task.AppliesTo();
|
||||
if (applies_to != null)
|
||||
{
|
||||
AppliesTo.AddRange(applies_to);
|
||||
Description = task.Name;
|
||||
Description = task.Name();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -156,7 +156,7 @@ namespace XenAdmin.Actions.GUIActions
|
||||
private void DestroyUnwantedOperations(Task task)
|
||||
{
|
||||
string[] err = task.error_info;
|
||||
if (task.Name == "SR.create" && err != null && err.Length > 0 && err[0] == Failure.SR_BACKEND_FAILURE_107)
|
||||
if (task.Name() == "SR.create" && err != null && err.Length > 0 && err[0] == Failure.SR_BACKEND_FAILURE_107)
|
||||
{
|
||||
// This isn't an SR create at all, it is a scan for LUNs. Hide it, since the 'error' info contains loads of XML,
|
||||
// and is not useful. We don't know this until the error occurs though. Destroy the MeddlingAction.
|
||||
|
@ -49,9 +49,9 @@ namespace XenAdmin.Actions.GUIActions
|
||||
{
|
||||
public bool IsSatisfiedBy(Task task)
|
||||
{
|
||||
return (task.XenCenterUUID == Program.XenCenterUUID ||
|
||||
task.Connection.Resolve(task.subtask_of) != null ||
|
||||
task.Hidden);
|
||||
return task.XenCenterUUID() == Program.XenCenterUUID ||
|
||||
task.Connection.Resolve(task.subtask_of) != null ||
|
||||
task.IsHidden();
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,8 +67,8 @@ namespace XenAdmin.Actions.GUIActions
|
||||
|
||||
public bool IsSatisfiedBy(Task task)
|
||||
{
|
||||
return (task.AppliesTo != null ||
|
||||
task.created + task.Connection.ServerTimeOffset < DateTime.UtcNow - awareClientHeuristic);
|
||||
return task.AppliesTo() != null ||
|
||||
task.created + task.Connection.ServerTimeOffset < DateTime.UtcNow - awareClientHeuristic;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace XenAdmin.Actions.Wlb
|
||||
|
||||
try
|
||||
{
|
||||
log.Debug("Optimizing " + Pool.Name);
|
||||
log.Debug("Optimizing " + Pool.Name());
|
||||
|
||||
// for checking whether to display recommendations on optimize pool listview
|
||||
Helpers.SetOtherConfig(this.Session, this.Pool,WlbOptimizationRecommendation.OPTIMIZINGPOOL, Messages.IN_PROGRESS);
|
||||
@ -112,7 +112,7 @@ namespace XenAdmin.Actions.Wlb
|
||||
AsyncAction hostAction = null;
|
||||
int waitingInterval = 10 * 1000; // default to 10s
|
||||
|
||||
if (vmItem.Value.fromHost.IsLive)
|
||||
if (vmItem.Value.fromHost.IsLive())
|
||||
{
|
||||
hostAction = new ShutdownHostAction(fromHost, AddHostToPoolCommand.NtolDialog);
|
||||
}
|
||||
@ -140,7 +140,7 @@ namespace XenAdmin.Actions.Wlb
|
||||
}
|
||||
else
|
||||
{
|
||||
log.Debug("Migrating VM " + vm.Name);
|
||||
log.Debug("Migrating VM " + vm.Name());
|
||||
Host toHost = vmItem.Value.toHost;
|
||||
|
||||
try
|
||||
@ -182,7 +182,7 @@ namespace XenAdmin.Actions.Wlb
|
||||
}
|
||||
this.Description = Messages.WLB_OPT_OK_NOTICE_TEXT;
|
||||
Helpers.SetOtherConfig(this.Session, this.Pool, WlbOptimizationRecommendation.OPTIMIZINGPOOL, optId);
|
||||
log.Debug("Completed optimizing " + Pool.Name);
|
||||
log.Debug("Completed optimizing " + Pool.Name());
|
||||
}
|
||||
catch (Failure ex)
|
||||
{
|
||||
@ -200,7 +200,7 @@ namespace XenAdmin.Actions.Wlb
|
||||
log.Error(ex, ex);
|
||||
this.Description = Messages.WLB_OPT_FAILED;
|
||||
Helpers.SetOtherConfig(this.Session, this.Pool, WlbOptimizationRecommendation.OPTIMIZINGPOOL, optId);
|
||||
log.Debug("Optimizing " + Pool.Name + " is failed");
|
||||
log.Debug("Optimizing " + Pool.Name() + " is failed");
|
||||
}
|
||||
this.PercentComplete = 100;
|
||||
}
|
||||
@ -260,7 +260,7 @@ namespace XenAdmin.Actions.Wlb
|
||||
}
|
||||
}
|
||||
|
||||
if (!setDoNotRestart && vm.HasSavedRestartPriority)
|
||||
if (!setDoNotRestart && vm.HasSavedRestartPriority())
|
||||
{
|
||||
// If HA is turned on, setting ha_always_run will cause the VM to be started by itself
|
||||
// but when the VM fails to start we want to know why, so we do a VM.start here too.
|
||||
|
@ -203,7 +203,7 @@ namespace XenAdmin.Alerts
|
||||
case AlarmType.Storage:
|
||||
return string.Format(Messages.ALERT_ALARM_STORAGE_DESCRIPTION,
|
||||
Helpers.GetNameAndObject(XenObject),
|
||||
sr == null ? "" : sr.Name,
|
||||
sr == null ? "" : sr.Name(),
|
||||
Util.DataRateString(CurrentValue * Util.BINARY_MEGA), //xapi unit is in Mib
|
||||
Util.TimeString(TriggerPeriod),
|
||||
Util.DataRateString(TriggerLevel * Util.BINARY_MEGA));
|
||||
@ -268,7 +268,7 @@ namespace XenAdmin.Alerts
|
||||
else if (XenObject is VM)
|
||||
{
|
||||
VM vm = (VM)XenObject;
|
||||
xenObject = vm.IsControlDomainZero ? XenObject.Connection.Resolve(vm.resident_on) : XenObject;
|
||||
xenObject = vm.IsControlDomainZero() ? XenObject.Connection.Resolve(vm.resident_on) : XenObject;
|
||||
}
|
||||
|
||||
if (xenObject == null)
|
||||
|
@ -58,7 +58,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
get
|
||||
{
|
||||
return string.Format(Messages.IQN_CHECK_EXISTS_TEXT, Helpers.GetName(Host), Host.iscsi_iqn, Helpers.GetName(RepeatedIQNs[Host]));
|
||||
return string.Format(Messages.IQN_CHECK_EXISTS_TEXT, Helpers.GetName(Host), Host.GetIscsiIqn(), Helpers.GetName(RepeatedIQNs[Host]));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,8 @@ namespace XenAdmin.Alerts
|
||||
get
|
||||
{
|
||||
// If you add something to this switch statement, be sure to add a corresponding entry to FriendlyNames.
|
||||
switch (Message.Type)
|
||||
var typ = Message.Type;
|
||||
switch (typ)
|
||||
{
|
||||
case XenAPI.Message.MessageType.HA_POOL_DROP_IN_PLAN_EXISTS_FOR:
|
||||
case XenAPI.Message.MessageType.HA_POOL_OVERCOMMITTED:
|
||||
@ -157,7 +158,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
Pool pool = Helpers.GetPoolOfOne(XenObject.Connection);
|
||||
if (pool != null)
|
||||
return string.Format(FriendlyFormat(), Helpers.GetName(XenObject), pool.Name);
|
||||
return string.Format(FriendlyFormat(), Helpers.GetName(XenObject), pool.Name());
|
||||
}
|
||||
break;
|
||||
|
||||
@ -225,7 +226,7 @@ namespace XenAdmin.Alerts
|
||||
var proxy = XenObject as PVS_proxy;
|
||||
if (proxy != null)
|
||||
{
|
||||
return string.Format(FriendlyFormat(), proxy.VM, proxy.Connection.Resolve(proxy.site));
|
||||
return string.Format(FriendlyFormat(), proxy.VM(), proxy.Connection.Resolve(proxy.site));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -236,7 +237,7 @@ namespace XenAdmin.Alerts
|
||||
case Message.MessageType.VMSS_SNAPSHOT_SUCCEEDED:
|
||||
case Message.MessageType.VMSS_SNAPSHOT_LOCK_FAILED:
|
||||
VMSS vmss = Helpers.XenObjectFromMessage(Message) as VMSS;
|
||||
var policyAlertVMSS = new PolicyAlert(Message.priority, Message.name, Message.timestamp, Message.body, (vmss == null) ? "" : vmss.Name);
|
||||
var policyAlertVMSS = new PolicyAlert(Message.priority, Message.name, Message.timestamp, Message.body, (vmss == null) ? "" : vmss.Name());
|
||||
return policyAlertVMSS.Text;
|
||||
}
|
||||
|
||||
@ -246,7 +247,7 @@ namespace XenAdmin.Alerts
|
||||
|
||||
private string FriendlyFormat()
|
||||
{
|
||||
return XenAPI.Message.FriendlyBody(Message.MessageTypeString);
|
||||
return XenAPI.Message.FriendlyBody(Message.MessageTypeString());
|
||||
}
|
||||
|
||||
private static readonly Regex extAuthRegex = new Regex(@"error=(.*)");
|
||||
@ -323,7 +324,7 @@ namespace XenAdmin.Alerts
|
||||
private string GetManagementBondName()
|
||||
{
|
||||
Bond bond = NetworkingHelper.GetMasterManagementBond(Connection);
|
||||
return bond == null ? Messages.UNKNOWN : bond.Name;
|
||||
return bond == null ? Messages.UNKNOWN : bond.Name();
|
||||
}
|
||||
|
||||
public override Action FixLinkAction
|
||||
@ -333,7 +334,8 @@ namespace XenAdmin.Alerts
|
||||
if (XenObject == null)
|
||||
return null;
|
||||
|
||||
switch (Message.Type)
|
||||
var typ = Message.Type;
|
||||
switch (typ)
|
||||
{
|
||||
case XenAPI.Message.MessageType.HA_HEARTBEAT_APPROACHING_TIMEOUT:
|
||||
case XenAPI.Message.MessageType.HA_HOST_FAILED:
|
||||
@ -378,7 +380,7 @@ namespace XenAdmin.Alerts
|
||||
if (FixLinkAction == null)
|
||||
return null;
|
||||
|
||||
return Message.FriendlyAction(Message.MessageTypeString) ?? Messages.DETAILS;
|
||||
return Message.FriendlyAction(Message.MessageTypeString()) ?? Messages.DETAILS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -395,7 +397,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
get
|
||||
{
|
||||
return XenAPI.Message.FriendlyHelp(Message.MessageTypeString);
|
||||
return XenAPI.Message.FriendlyHelp(Message.MessageTypeString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -403,7 +405,7 @@ namespace XenAdmin.Alerts
|
||||
{
|
||||
get
|
||||
{
|
||||
string title = XenAPI.Message.FriendlyName(Message.MessageTypeString);
|
||||
string title = XenAPI.Message.FriendlyName(Message.MessageTypeString());
|
||||
if (string.IsNullOrEmpty(title))
|
||||
title = Message.name;
|
||||
|
||||
@ -424,7 +426,7 @@ namespace XenAdmin.Alerts
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return Message.MessageTypeString; }
|
||||
get { return Message.MessageTypeString(); }
|
||||
}
|
||||
|
||||
public override void Dismiss()
|
||||
@ -464,7 +466,7 @@ namespace XenAdmin.Alerts
|
||||
/// <returns></returns>
|
||||
public static Alert ParseMessage(XenAPI.Message msg)
|
||||
{
|
||||
if (msg.IsPerfmonAlarm)
|
||||
if (msg.IsPerfmonAlarm())
|
||||
{
|
||||
return new AlarmMessageAlert(msg);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ namespace XenAdmin.Alerts
|
||||
if(host == null)
|
||||
return false;
|
||||
|
||||
return !host.CanApplyHotfixes;
|
||||
return !host.CanApplyHotfixes();
|
||||
}
|
||||
|
||||
public XenServerPatchAlert(XenServerPatch patch)
|
||||
|
@ -93,7 +93,7 @@ namespace XenAdmin.Alerts
|
||||
List<string> names = new List<string>();
|
||||
|
||||
foreach (Host host in hosts)
|
||||
names.Add(host.Name);
|
||||
names.Add(host.Name());
|
||||
|
||||
foreach (IXenConnection connection in connections)
|
||||
names.Add(Helpers.GetName(connection));
|
||||
|
@ -83,14 +83,14 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
}
|
||||
|
||||
return !vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED);
|
||||
return !vm.GetVirtualisationStatus().HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED);
|
||||
}
|
||||
|
||||
private bool CanExecute(VBD vbd)
|
||||
{
|
||||
VM vm = vbd.Connection.Resolve<VM>(vbd.VM);
|
||||
VDI vdi = vbd.Connection.Resolve<VDI>(vbd.VDI);
|
||||
if (vm == null || vm.not_a_real_vm || vdi == null)
|
||||
if (vm == null || vm.not_a_real_vm() || vdi == null)
|
||||
return false;
|
||||
if (vm.power_state != vm_power_state.Running)
|
||||
return false;
|
||||
@ -112,7 +112,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
VM vm = vbd.Connection.Resolve<VM>(vbd.VM);
|
||||
VDI vdi = vbd.Connection.Resolve<VDI>(vbd.VDI);
|
||||
if (vm == null || vm.not_a_real_vm || vdi == null)
|
||||
if (vm == null || vm.not_a_real_vm() || vdi == null)
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
|
||||
SR sr = vdi.Connection.Resolve<SR>(vdi.SR);
|
||||
@ -120,9 +120,14 @@ namespace XenAdmin.Commands
|
||||
return Messages.SR_COULD_NOT_BE_CONTACTED;
|
||||
|
||||
if (vdi.Locked)
|
||||
return vdi.VDIType == VDI.FriendlyType.SNAPSHOT ? Messages.CANNOT_ACTIVATE_SNAPSHOT_IN_USE
|
||||
: vdi.VDIType == VDI.FriendlyType.ISO ? Messages.CANNOT_ACTIVATE_ISO_IN_USE
|
||||
: Messages.CANNOT_ACTIVATE_VD_IN_USE;
|
||||
{
|
||||
var vdiType = vdi.VDIType();
|
||||
return vdiType == VDI.FriendlyType.SNAPSHOT
|
||||
? Messages.CANNOT_ACTIVATE_SNAPSHOT_IN_USE
|
||||
: vdiType == VDI.FriendlyType.ISO
|
||||
? Messages.CANNOT_ACTIVATE_ISO_IN_USE
|
||||
: Messages.CANNOT_ACTIVATE_VD_IN_USE;
|
||||
}
|
||||
|
||||
if (vm.power_state != vm_power_state.Running)
|
||||
return string.Format(
|
||||
@ -134,7 +139,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
if (AreIODriversNeededAndMissing(vm))
|
||||
return string.Format(
|
||||
vm.HasNewVirtualisationStates ? Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_IO_DRIVERS : Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_TOOLS,
|
||||
vm.HasNewVirtualisationStates() ? Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_IO_DRIVERS : Messages.CANNOT_ACTIVATE_VD_VM_NEEDS_TOOLS,
|
||||
Helpers.GetName(vm).Ellipsise(50));
|
||||
|
||||
if (vbd.currently_attached)
|
||||
@ -172,7 +177,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
VDI vdi = vbd.Connection.Resolve<VDI>(vbd.VDI);
|
||||
VM vm = vbd.Connection.Resolve<VM>(vbd.VM);
|
||||
String title = String.Format(Messages.ACTION_DISK_ACTIVATING_TITLE, vdi.Name, vm.Name);
|
||||
String title = String.Format(Messages.ACTION_DISK_ACTIVATING_TITLE, vdi.Name(), vm.Name());
|
||||
String startDesc = Messages.ACTION_DISK_ACTIVATING;
|
||||
String endDesc = Messages.ACTION_DISK_ACTIVATED;
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace XenAdmin.Commands
|
||||
Program.HideObject(opaque_ref);
|
||||
}
|
||||
|
||||
RunMultipleActions(actions, string.Format(Messages.ADDING_SERVERS_TO_POOL, _pool.Name), Messages.POOLCREATE_ADDING, Messages.POOLCREATE_ADDED, true);
|
||||
RunMultipleActions(actions, string.Format(Messages.ADDING_SERVERS_TO_POOL, _pool.Name()), Messages.POOLCREATE_ADDING, Messages.POOLCREATE_ADDED, true);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
@ -170,7 +170,7 @@ namespace XenAdmin.Commands
|
||||
foreach (Host host in _hosts)
|
||||
{
|
||||
// only allowed to add standalone hosts.
|
||||
if (Helpers.GetPool(host.Connection) != null || host.RestrictPooling)
|
||||
if (Helpers.GetPool(host.Connection) != null || Host.RestrictPooling(host))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -186,11 +186,11 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
if (_hosts.Count == 1)
|
||||
{
|
||||
return string.Format(Messages.MAINWINDOW_CONFIRM_MOVE_TO_POOL, _hosts[0].Name.Ellipsise(500), _pool.Name.Ellipsise(500));
|
||||
return string.Format(Messages.MAINWINDOW_CONFIRM_MOVE_TO_POOL, _hosts[0].Name().Ellipsise(500), _pool.Name().Ellipsise(500));
|
||||
}
|
||||
else if (_hosts.Count > 1)
|
||||
{
|
||||
return string.Format(Messages.MAINWINDOW_CONFIRM_MOVE_TO_POOL_MULTIPLE, _pool.Name.Ellipsise(500));
|
||||
return string.Format(Messages.MAINWINDOW_CONFIRM_MOVE_TO_POOL_MULTIPLE, _pool.Name().Ellipsise(500));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
if (hostPool != null)
|
||||
{
|
||||
string text = String.Format(Messages.HOST_ALREADY_IN_POOL, hostToAdd.Name, _pool.Name, hostPool.Name);
|
||||
string text = String.Format(Messages.HOST_ALREADY_IN_POOL, hostToAdd.Name(), _pool.Name(), hostPool.Name());
|
||||
string caption = Messages.POOL_JOIN_IMPOSSIBLE;
|
||||
|
||||
using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Exclamation, text, caption)))
|
||||
|
@ -74,7 +74,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
if (vm != null)
|
||||
{
|
||||
if (vm.VBDs.Count < vm.MaxVBDsAllowed)
|
||||
if (vm.VBDs.Count < vm.MaxVBDsAllowed())
|
||||
{
|
||||
MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new NewDiskDialog(vm.Connection, vm));
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
VM vm = (VM)selection[0].XenObject;
|
||||
|
||||
if (vm.VBDs.Count >= vm.MaxVBDsAllowed)
|
||||
if (vm.VBDs.Count >= vm.MaxVBDsAllowed())
|
||||
{
|
||||
using (var dlg = new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(
|
||||
|
@ -96,7 +96,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private bool CanExecute(Host host)
|
||||
{
|
||||
return host != null && host.IsLive ;
|
||||
return host != null && host.IsLive();
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -79,7 +79,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private bool CanExecute(Host host)
|
||||
{
|
||||
return host != null && host.IsLive && Helpers.ElyOrGreater(host);
|
||||
return host != null && host.IsLive() && Helpers.ElyOrGreater(host);
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -89,7 +89,7 @@ namespace XenAdmin.Commands
|
||||
Session session = connection != null ? connection.Session : null;
|
||||
|
||||
if (host != null)
|
||||
return host.IsLive && session != null && session.IsLocalSuperuser;
|
||||
return host.IsLive() && session != null && session.IsLocalSuperuser;
|
||||
if (pool != null)
|
||||
return session != null && session.IsLocalSuperuser;
|
||||
}
|
||||
@ -112,7 +112,7 @@ namespace XenAdmin.Commands
|
||||
Host host = selection[0].XenObject as Host;
|
||||
Pool pool = selection[0].XenObject as Pool;
|
||||
|
||||
if (host != null && host.IsLive && connection.Session != null && !connection.Session.IsLocalSuperuser)
|
||||
if (host != null && host.IsLive() && connection.Session != null && !connection.Session.IsLocalSuperuser)
|
||||
{
|
||||
return Messages.AD_CANNOT_CHANGE_PASSWORD;
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
string hostName = Helpers.GetName(host.Connection);
|
||||
|
||||
if (host.RestrictPooling)
|
||||
if (Host.RestrictPooling(host))
|
||||
{
|
||||
hostName = String.Format(Messages.HOST_MENU_ADD_SERVER, hostName);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private bool CanExecute(Host host)
|
||||
{
|
||||
return host != null && host.Connection != null && host.Connection.IsConnected && Helpers.GetPool(host.Connection) == null && !host.RestrictPooling;
|
||||
return host != null && host.Connection != null && host.Connection.IsConnected && Helpers.GetPool(host.Connection) == null && !Host.RestrictPooling(host);
|
||||
}
|
||||
|
||||
public override string MenuText
|
||||
@ -119,7 +119,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
Host host = item.XenObject as Host;
|
||||
|
||||
if (host != null && host.Connection != null && host.Connection.IsConnected && Helpers.GetPool(host.Connection) == null && host.RestrictPooling)
|
||||
if (host != null && host.Connection != null && host.Connection.IsConnected && Helpers.GetPool(host.Connection) == null && Host.RestrictPooling(host))
|
||||
{
|
||||
return Messages.HOST_MENU_ADD_TO_POOL_LICENSE_RESTRICTION;
|
||||
}
|
||||
|
@ -91,8 +91,8 @@ namespace XenAdmin.Commands
|
||||
}
|
||||
|
||||
var menuText = (index + offset) < 9
|
||||
? String.Format(Messages.DYNAMIC_MENUITEM_WITH_ACCESS_KEY, (index + offset) + 1, group.Name)
|
||||
: String.Format(Messages.DYNAMIC_MENUITEM_WITHOUT_ACCESS_KEY, group.Name);
|
||||
? String.Format(Messages.DYNAMIC_MENUITEM_WITH_ACCESS_KEY, (index + offset) + 1, group.Name())
|
||||
: String.Format(Messages.DYNAMIC_MENUITEM_WITHOUT_ACCESS_KEY, group.Name());
|
||||
|
||||
var cmdGroup = new AssignGroupToVMCommand(Command.MainWindowCommandInterface, Command.GetSelection(), group, menuText);
|
||||
var itemGroup = new CommandToolStripMenuItem(cmdGroup);
|
||||
@ -151,12 +151,12 @@ namespace XenAdmin.Commands
|
||||
|
||||
public override string MenuText
|
||||
{
|
||||
get { return (String.IsNullOrEmpty(_menuText) ? _group.Name : _menuText).Ellipsise(30); }
|
||||
get { return (String.IsNullOrEmpty(_menuText) ? _group.Name() : _menuText).Ellipsise(30); }
|
||||
}
|
||||
|
||||
protected override string EnabledToolTipText
|
||||
{
|
||||
get { return _group.Name; }
|
||||
get { return _group.Name(); }
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
@ -188,7 +188,7 @@ namespace XenAdmin.Commands
|
||||
VM vm = vmsWithExistingGroup[0];
|
||||
T oldGroup = vm.Connection.Resolve(VMGroup<T>.VmToGroup(vm));
|
||||
text = string.Format(VMGroup<T>.ChangeOneWarningString,
|
||||
vm.Name.Ellipsise(250), oldGroup.Name.Ellipsise(250), groupName.Ellipsise(250));
|
||||
vm.Name().Ellipsise(250), oldGroup.Name().Ellipsise(250), groupName.Ellipsise(250));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -220,7 +220,7 @@ namespace XenAdmin.Commands
|
||||
}
|
||||
}
|
||||
|
||||
if (!ChangesOK(selection.AsXenObjects<VM>(), _group, _group.Name))
|
||||
if (!ChangesOK(selection.AsXenObjects<VM>(), _group, _group.Name()))
|
||||
return;
|
||||
|
||||
var selectedRefVMs = selection.AsXenObjects().ConvertAll<XenRef<VM>>(converterVMRefs);
|
||||
@ -279,7 +279,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
public bool CanExecute(VM vm)
|
||||
{
|
||||
return vm != null && vm.is_a_real_vm && !vm.Locked && VMGroup<T>.FeaturePossible(vm.Connection) &&
|
||||
return vm != null && vm.is_a_real_vm() && !vm.Locked && VMGroup<T>.FeaturePossible(vm.Connection) &&
|
||||
!Helpers.FeatureForbidden(vm.Connection, VMGroup<T>.FeatureRestricted);
|
||||
}
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -388,7 +388,7 @@ namespace XenAdmin.Commands
|
||||
public override bool IsValid(SelectedItemCollection selection)
|
||||
{
|
||||
return selection.ContainsOneItemOfType<XenAPI.Network>() &&
|
||||
!(selection.FirstAsXenObject as XenAPI.Network).IsGuestInstallerNetwork;
|
||||
!(selection.FirstAsXenObject as XenAPI.Network).IsGuestInstallerNetwork();
|
||||
// CA-218956 - Expose HIMN when showing hidden objects
|
||||
// HIMN should not be editable
|
||||
}
|
||||
@ -512,7 +512,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
Host host = item.XenObject as Host;
|
||||
|
||||
if (host == null || !host.IsLive)
|
||||
if (host == null || !host.IsLive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -564,10 +564,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
Host host = selection[0].XenObject as Host;
|
||||
|
||||
if (host != null)
|
||||
{
|
||||
return host.IsLive;
|
||||
}
|
||||
return host != null && host.IsLive();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -615,7 +612,7 @@ namespace XenAdmin.Commands
|
||||
if (selection.Count == 1 && selection[0].PoolAncestor == null)
|
||||
{
|
||||
Host host = selection[0].XenObject as Host;
|
||||
return host != null && host.IsLive;
|
||||
return host != null && host.IsLive();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -648,8 +645,10 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
}
|
||||
|
||||
foundAlive |= host.IsLive;
|
||||
foundDead |= !host.IsLive;
|
||||
bool isHostLive = host.IsLive();
|
||||
|
||||
foundAlive |= isHostLive;
|
||||
foundDead |= !isHostLive;
|
||||
}
|
||||
return foundAlive && foundDead;
|
||||
}
|
||||
@ -681,7 +680,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
Host host = item.XenObject as Host;
|
||||
|
||||
if (host == null || host.IsLive)
|
||||
if (host == null || host.IsLive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -721,7 +720,7 @@ namespace XenAdmin.Commands
|
||||
}
|
||||
|
||||
var pool = selection.FirstAsXenObject as Pool;
|
||||
if (pool != null && !pool.IsPoolFullyUpgraded)
|
||||
if (pool != null && !pool.IsPoolFullyUpgraded())
|
||||
items.Add(new RollingUpgradeCommand(mainWindow));
|
||||
|
||||
items.AddSeparator();
|
||||
|
@ -199,7 +199,7 @@ namespace XenAdmin.Commands
|
||||
Host host = item.Tag as Host;
|
||||
if (host != null)
|
||||
{
|
||||
VMOperationCommand cmd = new VMOperationHostCommand(Command.MainWindowCommandInterface, selection, delegate { return host; }, host.Name.EscapeAmpersands(), _operation, session);
|
||||
VMOperationCommand cmd = new VMOperationHostCommand(Command.MainWindowCommandInterface, selection, delegate { return host; }, host.Name().EscapeAmpersands(), _operation, session);
|
||||
CrossPoolMigrateCommand cpmCmd = new CrossPoolMigrateCommand(Command.MainWindowCommandInterface, selection, host, _resumeAfter);
|
||||
|
||||
VMOperationToolStripMenuSubItem tempItem = item;
|
||||
|
@ -71,7 +71,7 @@ namespace XenAdmin.Commands
|
||||
using (var dlg = new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(
|
||||
SystemIcons.Warning,
|
||||
string.Format(Messages.CONVERT_TEMPLATE_DIALOG_TEXT, vm.Name.Ellipsise(25)),
|
||||
string.Format(Messages.CONVERT_TEMPLATE_DIALOG_TEXT, vm.Name().Ellipsise(25)),
|
||||
Messages.CONVERT_TO_TEMPLATE),
|
||||
new ThreeButtonDialog.TBDButton(Messages.CONVERT, DialogResult.OK, ThreeButtonDialog.ButtonType.ACCEPT, true),
|
||||
ThreeButtonDialog.ButtonCancel))
|
||||
@ -84,7 +84,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
MainWindowCommandInterface.CloseActiveWizards(vm);
|
||||
|
||||
RunMultipleActions(actions, string.Format(Messages.ACTION_VM_TEMPLATIZING_TITLE, vm.Name),
|
||||
RunMultipleActions(actions, string.Format(Messages.ACTION_VM_TEMPLATIZING_TITLE, vm.Name()),
|
||||
Messages.ACTION_VM_TEMPLATIZING, Messages.ACTION_VM_TEMPLATIZED, true);
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(VM vm)
|
||||
{
|
||||
if (vm != null && vm.is_a_template && !vm.is_a_snapshot && !vm.Locked && vm.allowed_operations != null && !vm.InternalTemplate)
|
||||
if (vm != null && vm.is_a_template && !vm.is_a_snapshot && !vm.Locked && vm.allowed_operations != null && !vm.InternalTemplate())
|
||||
{
|
||||
if (CrossPoolCopyTemplateCommand.CanExecute(vm, null))
|
||||
return true;
|
||||
|
@ -79,7 +79,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(VM vm)
|
||||
{
|
||||
return vm != null && (CrossPoolCopyVMCommand.CanExecute(vm, null) || vm.CanBeCopied);
|
||||
return vm != null && (CrossPoolCopyVMCommand.CanExecute(vm, null) || vm.CanBeCopied());
|
||||
}
|
||||
|
||||
public override string MenuText
|
||||
|
@ -100,7 +100,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
public new static bool CanExecute(VM vm, Host preSelectedHost)
|
||||
{
|
||||
if (vm == null || !vm.is_a_template || vm.DefaultTemplate || vm.Locked)
|
||||
if (vm == null || !vm.is_a_template || vm.DefaultTemplate() || vm.Locked)
|
||||
return false;
|
||||
|
||||
return CrossPoolMigrateCommand.CanExecute(vm, preSelectedHost);
|
||||
|
@ -70,8 +70,8 @@ namespace XenAdmin.Commands
|
||||
|
||||
var cantExecuteReason = CantExecuteReason;
|
||||
return string.IsNullOrEmpty(cantExecuteReason)
|
||||
? preSelectedHost.Name.EscapeAmpersands()
|
||||
: string.Format(Messages.MAINWINDOW_CONTEXT_REASON, preSelectedHost.Name.EscapeAmpersands(), cantExecuteReason);
|
||||
? preSelectedHost.Name().EscapeAmpersands()
|
||||
: string.Format(Messages.MAINWINDOW_CONTEXT_REASON, preSelectedHost.Name().EscapeAmpersands(), cantExecuteReason);
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ namespace XenAdmin.Commands
|
||||
vm.allowed_operations != null &&
|
||||
vm.allowed_operations.Contains(vm_operations.migrate_send) &&
|
||||
!Helpers.CrossPoolMigrationRestrictedWithWlb(vm.Connection) &&
|
||||
vm.SRs.ToList().All(sr=> sr != null && !sr.HBALunPerVDI) &&
|
||||
vm.SRs().ToList().All(sr=> sr != null && !sr.HBALunPerVDI()) &&
|
||||
(preselectedHost == null || vm.Connection.Resolve(vm.resident_on) != preselectedHost); //Not the same as the pre-selected host
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
SR curSr = sr;
|
||||
var action = new DelegatedAsyncAction(pool.Connection,
|
||||
String.Format(Messages.ACTION_DR_DISABLING_ON, sr.Name), Messages.ACTION_DR_DISABLING, Messages.ACTION_DR_DISABLED,
|
||||
String.Format(Messages.ACTION_DR_DISABLING_ON, sr.Name()), Messages.ACTION_DR_DISABLING, Messages.ACTION_DR_DISABLED,
|
||||
s => SR.disable_database_replication(s, curSr.opaque_ref)) {Pool = pool};
|
||||
actions.Add(action);
|
||||
}
|
||||
@ -103,7 +103,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
SR curSr = sr;
|
||||
var action = new DelegatedAsyncAction(pool.Connection,
|
||||
String.Format(Messages.ACTION_DR_ENABLING_ON, sr.Name), Messages.ACTION_DR_ENABLING, Messages.ACTION_DR_ENABLED,
|
||||
String.Format(Messages.ACTION_DR_ENABLING_ON, sr.Name()), Messages.ACTION_DR_ENABLING, Messages.ACTION_DR_ENABLED,
|
||||
s => SR.enable_database_replication(s, curSr.opaque_ref)) { Pool = pool };
|
||||
actions.Add(action);
|
||||
}
|
||||
|
@ -85,18 +85,18 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
}
|
||||
|
||||
return !vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED);
|
||||
return !vm.GetVirtualisationStatus().HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED);
|
||||
}
|
||||
|
||||
private bool CanExecute(VBD vbd)
|
||||
{
|
||||
VDI vdi = vbd.Connection.Resolve<VDI>(vbd.VDI);
|
||||
VM vm = vbd.Connection.Resolve<VM>(vbd.VM);
|
||||
if (vm == null || vm.not_a_real_vm || vdi == null || vdi.Locked || vbd.Locked)
|
||||
if (vm == null || vm.not_a_real_vm() || vdi == null || vdi.Locked || vbd.Locked)
|
||||
return false;
|
||||
if (vm.power_state != vm_power_state.Running)
|
||||
return false;
|
||||
if (vdi.type == vdi_type.system && vbd.IsOwner)
|
||||
if (vdi.type == vdi_type.system && vbd.GetIsOwner())
|
||||
return false;
|
||||
if (AreIODriversNeededAndMissing(vm))
|
||||
return false;
|
||||
@ -114,7 +114,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
VDI vdi = vbd.Connection.Resolve<VDI>(vbd.VDI);
|
||||
VM vm = vbd.Connection.Resolve<VM>(vbd.VM);
|
||||
if (vm == null || vm.not_a_real_vm || vdi == null)
|
||||
if (vm == null || vm.not_a_real_vm() || vdi == null)
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
|
||||
|
||||
@ -123,21 +123,26 @@ namespace XenAdmin.Commands
|
||||
return Messages.SR_COULD_NOT_BE_CONTACTED;
|
||||
|
||||
if (vdi.Locked)
|
||||
return vdi.VDIType == VDI.FriendlyType.SNAPSHOT ? Messages.CANNOT_DEACTIVATE_SNAPSHOT_IN_USE
|
||||
: vdi.VDIType == VDI.FriendlyType.ISO ? Messages.CANNOT_DEACTIVATE_ISO_IN_USE
|
||||
: Messages.CANNOT_DEACTIVATE_VDI_IN_USE;
|
||||
{
|
||||
var vdiType = vdi.VDIType();
|
||||
return vdiType == VDI.FriendlyType.SNAPSHOT
|
||||
? Messages.CANNOT_DEACTIVATE_SNAPSHOT_IN_USE
|
||||
: vdiType == VDI.FriendlyType.ISO
|
||||
? Messages.CANNOT_DEACTIVATE_ISO_IN_USE
|
||||
: Messages.CANNOT_DEACTIVATE_VDI_IN_USE;
|
||||
}
|
||||
|
||||
if (vm.power_state != vm_power_state.Running)
|
||||
return string.Format(
|
||||
Messages.CANNOT_DEACTIVATE_VDI_VM_NOT_RUNNING,
|
||||
Helpers.GetName(vm).Ellipsise(50));
|
||||
|
||||
if (vdi.type == vdi_type.system && vbd.IsOwner)
|
||||
if (vdi.type == vdi_type.system && vbd.GetIsOwner())
|
||||
return Messages.TOOLTIP_DEACTIVATE_SYSVDI;
|
||||
|
||||
if (AreIODriversNeededAndMissing(vm))
|
||||
return string.Format(
|
||||
vm.HasNewVirtualisationStates ? Messages.CANNOT_DEACTIVATE_VDI_NEEDS_IO_DRIVERS : Messages.CANNOT_DEACTIVATE_VDI_NEEDS_TOOLS,
|
||||
vm.HasNewVirtualisationStates() ? Messages.CANNOT_DEACTIVATE_VDI_NEEDS_IO_DRIVERS : Messages.CANNOT_DEACTIVATE_VDI_NEEDS_TOOLS,
|
||||
Helpers.GetName(vm).Ellipsise(50));
|
||||
|
||||
if (!vbd.currently_attached)
|
||||
@ -175,7 +180,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
VDI vdi = vbd.Connection.Resolve<VDI>(vbd.VDI);
|
||||
VM vm = vbd.Connection.Resolve<VM>(vbd.VM);
|
||||
String title = String.Format(Messages.ACTION_DISK_DEACTIVATING_TITLE, vdi.Name, vm.Name);
|
||||
String title = String.Format(Messages.ACTION_DISK_DEACTIVATING_TITLE, vdi.Name(), vm.Name());
|
||||
String startDesc = Messages.ACTION_DISK_DEACTIVATING;
|
||||
String endDesc = Messages.ACTION_DISK_DEACTIVATED;
|
||||
|
||||
|
@ -141,7 +141,7 @@ namespace XenAdmin.Commands
|
||||
msg = Messages.DELETE_FOLDER_CONFIRM_SUBFOLDERS;
|
||||
}
|
||||
|
||||
return string.Format(msg, folder.Name);
|
||||
return string.Format(msg, folder.Name());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ namespace XenAdmin.Commands
|
||||
IXenConnection connection = selection[0].Connection;
|
||||
|
||||
Pool pool = selection[0].PoolAncestor;
|
||||
return pool!=null&&pool.IsVisible&& connection.Cache.HostCount == 1;
|
||||
return pool != null && pool.IsVisible() && connection.Cache.HostCount == 1;
|
||||
}
|
||||
return false;
|
||||
|
||||
|
@ -153,7 +153,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return Messages.VM_NOT_SHUT_DOWN;
|
||||
}
|
||||
else if (vm.is_a_template && vm.DefaultTemplate)
|
||||
else if (vm.is_a_template && vm.DefaultTemplate())
|
||||
{
|
||||
return Messages.CANNOT_DELETE_DEFAULT_TEMPLATE;
|
||||
}
|
||||
|
@ -104,7 +104,9 @@ namespace XenAdmin.Commands
|
||||
VDI vdi = selectedItems[0].XenObject as VDI;
|
||||
SR sr = vdi.Connection.Resolve<SR>(vdi.SR);
|
||||
bool single = selectedItems.Count == 1;
|
||||
switch (vdi.VDIType)
|
||||
|
||||
var typ = vdi.VDIType();
|
||||
switch (typ)
|
||||
{
|
||||
case VDI.FriendlyType.SNAPSHOT:
|
||||
return single ? Messages.MESSAGEBOX_DELETE_SNAPSHOT : Messages.MESSAGEBOX_DELETE_SNAPSHOT_MULTIPLE;
|
||||
@ -132,9 +134,10 @@ namespace XenAdmin.Commands
|
||||
// if there are mixed vdi types then we will use the multiple warning dialog in confirm() override
|
||||
SelectedItemCollection selectedItems = GetSelection();
|
||||
VDI vdi = selectedItems[0].XenObject as VDI;
|
||||
SR sr = vdi.Connection.Resolve<SR>(vdi.SR);
|
||||
bool single = selectedItems.Count == 1;
|
||||
switch (vdi.VDIType)
|
||||
|
||||
var typ = vdi.VDIType();
|
||||
switch (typ)
|
||||
{
|
||||
case VDI.FriendlyType.SNAPSHOT:
|
||||
return single ? Messages.MESSAGEBOX_DELETE_SNAPSHOT_TITLE : Messages.MESSAGEBOX_DELETE_SNAPSHOTS_TITLE_MULTIPLE;
|
||||
@ -173,7 +176,7 @@ namespace XenAdmin.Commands
|
||||
if (v == null)
|
||||
current = VDI.FriendlyType.NONE;
|
||||
else
|
||||
current = v.VDIType;
|
||||
current = v.VDIType();
|
||||
|
||||
if (i > 0 && current != previous)
|
||||
{
|
||||
@ -206,7 +209,8 @@ namespace XenAdmin.Commands
|
||||
List<VDI> virtualDisks = new List<VDI>();
|
||||
foreach (VDI vdi in selectedItems.AsXenObjects<VDI>())
|
||||
{
|
||||
switch (vdi.VDIType)
|
||||
var typ = vdi.VDIType();
|
||||
switch (typ)
|
||||
{
|
||||
case VDI.FriendlyType.SNAPSHOT:
|
||||
snapshots.Add(vdi);
|
||||
@ -293,16 +297,18 @@ namespace XenAdmin.Commands
|
||||
|
||||
protected bool CanExecute(VDI vdi)
|
||||
{
|
||||
if (vdi == null)
|
||||
return false;
|
||||
SR sr = vdi.Connection.Resolve<SR>(vdi.SR);
|
||||
if (vdi == null || sr == null)
|
||||
if (sr == null)
|
||||
return false;
|
||||
if (vdi.Locked)
|
||||
return false;
|
||||
if (sr.Physical)
|
||||
if (sr.Physical())
|
||||
return false;
|
||||
if (sr.IsToolsSR)
|
||||
if (sr.IsToolsSR())
|
||||
return false;
|
||||
if (vdi.IsUsedByHA)
|
||||
if (vdi.IsUsedByHA())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -329,7 +335,7 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (sr.HBALunPerVDI)
|
||||
if (sr.HBALunPerVDI())
|
||||
return true;
|
||||
if (!vdi.allowed_operations.Contains(vdi_operations.destroy))
|
||||
{
|
||||
@ -359,23 +365,23 @@ namespace XenAdmin.Commands
|
||||
if (sr == null)
|
||||
return Messages.SR_COULD_NOT_BE_CONTACTED;
|
||||
|
||||
VDI.FriendlyType vdiType = vdi.VDIType;
|
||||
VDI.FriendlyType vdiType = vdi.VDIType();
|
||||
|
||||
if (vdi.Locked)
|
||||
return vdiType == VDI.FriendlyType.SNAPSHOT ? Messages.CANNOT_DELETE_SNAPSHOT_IN_USE
|
||||
: vdiType == VDI.FriendlyType.ISO ? Messages.CANNOT_DELETE_ISO_IN_USE
|
||||
: Messages.CANNOT_DELETE_VD_IN_USE;
|
||||
|
||||
if (sr.Physical)
|
||||
if (sr.Physical())
|
||||
return FriendlyErrorNames.VDI_IS_A_PHYSICAL_DEVICE;
|
||||
|
||||
if (sr.IsToolsSR)
|
||||
if (sr.IsToolsSR())
|
||||
return Messages.CANNOT_DELETE_TOOLS_SR;
|
||||
|
||||
if (vdi.IsUsedByHA)
|
||||
if (vdi.IsUsedByHA())
|
||||
return Messages.CANNOT_DELETE_HA_VD;
|
||||
|
||||
if (vdi.IsMetadataForDR)
|
||||
if (vdi.IsMetadataForDR())
|
||||
return Messages.CANNOT_DELETE_DR_VD;
|
||||
|
||||
List<VBD> vbds = vdi.Connection.ResolveAll<VBD>(vdi.VBDs);
|
||||
|
@ -59,7 +59,7 @@ namespace XenAdmin.Commands
|
||||
List<string> result = new List<string>();
|
||||
foreach (XenAPI.Network network in connection.Cache.Networks)
|
||||
{
|
||||
result.Add(network.Name);
|
||||
result.Add(network.Name());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -82,7 +82,7 @@ namespace XenAdmin.Commands
|
||||
// We just want one, so that we can name it.
|
||||
PIF pif = pifs[0];
|
||||
|
||||
string msg = string.Format(Messages.DELETE_BOND_MESSAGE, pif.Name);
|
||||
string msg = string.Format(Messages.DELETE_BOND_MESSAGE, pif.Name());
|
||||
|
||||
bool will_disturb_primary = NetworkingHelper.ContainsPrimaryManagement(pifs);
|
||||
bool will_disturb_secondary = NetworkingHelper.ContainsSecondaryManagement(pifs);
|
||||
@ -95,7 +95,7 @@ namespace XenAdmin.Commands
|
||||
using (var dlg = new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(
|
||||
SystemIcons.Error,
|
||||
string.Format(Messages.BOND_DELETE_HA_ENABLED, pif.Name, pool.Name),
|
||||
string.Format(Messages.BOND_DELETE_HA_ENABLED, pif.Name(), pool.Name()),
|
||||
Messages.DELETE_BOND)))
|
||||
{
|
||||
dlg.ShowDialog(Parent);
|
||||
@ -146,7 +146,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
// The UI shouldn't offer deleting a bond in this case, but let's make sure we've
|
||||
// done the right thing and that the bond hasn't been deleted in the meantime. (CA-27436).
|
||||
Bond bond = pif.BondMasterOf;
|
||||
Bond bond = pif.BondMasterOf();
|
||||
if (bond != null)
|
||||
new Actions.DestroyBondAction(bond).RunAsync();
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace XenAdmin.Commands
|
||||
return false;
|
||||
}
|
||||
Pool pool = Helpers.GetPool(host.Connection);
|
||||
return pool != null && !Helpers.HostIsMaster(host) && !host.IsLive;
|
||||
return pool != null && !Helpers.HostIsMaster(host) && !host.IsLive();
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
@ -125,7 +125,7 @@ namespace XenAdmin.Commands
|
||||
Host host = (Host)selection[0].XenObject;
|
||||
Pool pool = Helpers.GetPool(host.Connection);
|
||||
|
||||
return string.Format(Messages.CONFIRM_DESTROY_HOST, host.Name);
|
||||
return string.Format(Messages.CONFIRM_DESTROY_HOST, host.Name());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(SR sr)
|
||||
{
|
||||
return sr != null && !sr.HasRunningVMs() && sr.CanCreateWithXenCenter
|
||||
return sr != null && !sr.HasRunningVMs() && sr.CanCreateWithXenCenter()
|
||||
&& sr.allowed_operations.Contains(storage_operations.destroy) && !HelpersGUI.GetActionInProgress(sr);
|
||||
}
|
||||
|
||||
@ -113,7 +113,7 @@ namespace XenAdmin.Commands
|
||||
List<SR> srs = GetSelection().AsXenObjects<SR>();
|
||||
if (srs.Count == 1)
|
||||
{
|
||||
return string.Format(Messages.MESSAGEBOX_DESTROY_SR_CONTINUE, srs[0].Name);
|
||||
return string.Format(Messages.MESSAGEBOX_DESTROY_SR_CONTINUE, srs[0].Name());
|
||||
}
|
||||
|
||||
return Messages.MESSAGEBOX_DESTROY_SRS_CONTINUE;
|
||||
@ -144,7 +144,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
if (!sr.HasPBDs)
|
||||
if (!sr.HasPBDs())
|
||||
{
|
||||
return Messages.SR_DETACHED;
|
||||
}
|
||||
@ -152,7 +152,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return Messages.SR_HAS_RUNNING_VMS;
|
||||
}
|
||||
else if (!sr.CanCreateWithXenCenter)
|
||||
else if (!sr.CanCreateWithXenCenter())
|
||||
{
|
||||
return Messages.SR_CANNOT_BE_DESTROYED_WITH_XC;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
if (sr.IsDetached)
|
||||
if (sr.IsDetached())
|
||||
{
|
||||
return Messages.SR_DETACHED;
|
||||
}
|
||||
@ -144,7 +144,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return Messages.SR_HAS_RUNNING_VMS;
|
||||
}
|
||||
if (!sr.CanCreateWithXenCenter)
|
||||
if (!sr.CanCreateWithXenCenter())
|
||||
{
|
||||
return Messages.SR_CANNOT_BE_DETACHED_WITH_XC;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
foreach (var vm in vms)
|
||||
{
|
||||
var pvsProxy = vm.PvsProxy;
|
||||
var pvsProxy = vm.PvsProxy();
|
||||
if (pvsProxy != null)
|
||||
actions.Add(new PvsProxyDestroyAction(pvsProxy));
|
||||
}
|
||||
@ -99,7 +99,7 @@ namespace XenAdmin.Commands
|
||||
if (selection.Any() && selection.AllItemsAre<VM>() && selection.GetConnectionOfAllItems() != null)
|
||||
{
|
||||
var vms = selection.AsXenObjects<VM>();
|
||||
if (vms.Any(vm => vm.PvsProxy != null))
|
||||
if (vms.Any(vm => vm.PvsProxy() != null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
if (draggedVM.power_state == vm_power_state.Running)
|
||||
{
|
||||
if (draggedVM.HasVGPUs)
|
||||
if (draggedVM.HasVGPUs())
|
||||
return Messages.MIGRATION_NOT_ALLOWED_GPU;
|
||||
else
|
||||
return Messages.MIGRATION_NOT_ALLOWED;
|
||||
@ -116,7 +116,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private bool IsAnIntraPoolMigrate(Host targetHost, VM draggedVM)
|
||||
{
|
||||
List<SR> draggedSRs = new List<SR>(draggedVM.SRs);
|
||||
List<SR> draggedSRs = new List<SR>(draggedVM.SRs());
|
||||
bool allStorageShared = draggedSRs.TrueForAll(sr => sr.shared);
|
||||
return !IsACrossPoolMigrate(targetHost, draggedVM) && !allStorageShared;
|
||||
}
|
||||
@ -259,10 +259,10 @@ namespace XenAdmin.Commands
|
||||
|
||||
if (draggedVMs.Count == 1)
|
||||
{
|
||||
return Program.MainWindow.Confirm(null, Messages.MESSAGEBOX_CONFIRM, Messages.MAINWINDOW_CONFIRM_MIGRATE, draggedVMs[0].Name, targetHost.Name);
|
||||
return Program.MainWindow.Confirm(null, Messages.MESSAGEBOX_CONFIRM, Messages.MAINWINDOW_CONFIRM_MIGRATE, draggedVMs[0].Name(), targetHost.Name());
|
||||
}
|
||||
|
||||
return Program.MainWindow.Confirm(null, Messages.MESSAGEBOX_CONFIRM, Messages.MAINWINDOW_CONFIRM_MIGRATE_MULTIPLE, targetHost.Name);
|
||||
return Program.MainWindow.Confirm(null, Messages.MESSAGEBOX_CONFIRM, Messages.MAINWINDOW_CONFIRM_MIGRATE_MULTIPLE, targetHost.Name());
|
||||
}
|
||||
|
||||
public override VirtualTreeNode HighlightNode
|
||||
|
@ -94,7 +94,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
// At least one must not currently have a PVS Proxy
|
||||
var vms = selection.AsXenObjects<VM>();
|
||||
if (vms.Any(vm => vm.PvsProxy == null))
|
||||
if (vms.Any(vm => vm.PvsProxy() == null))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -74,10 +74,10 @@ namespace XenAdmin.Commands
|
||||
});
|
||||
}
|
||||
|
||||
if ((hostAncestor != null && hostAncestor.enabled && hostAncestor.IsLive && selection[0].Connection.IsConnected)
|
||||
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.is_a_real_vm() && CanExportVm(vm) && vm.Show(Properties.Settings.Default.ShowHiddenVMs)).ToList();
|
||||
if (vms.Count > 0)
|
||||
return vms.Any(CanExportVm);
|
||||
}
|
||||
@ -95,7 +95,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
var vms = item.XenObject.Connection.Cache.VMs.Where(
|
||||
xvm =>
|
||||
xvm.is_a_real_vm && CanExportVm(xvm)&&
|
||||
xvm.is_a_real_vm() && CanExportVm(xvm) &&
|
||||
xvm.Show(Properties.Settings.Default.ShowHiddenVMs)).ToList();
|
||||
if (vms.Count == 0)
|
||||
return Messages.NO_HALTED_VMS;
|
||||
|
@ -132,7 +132,7 @@ namespace XenAdmin.Commands
|
||||
if (neededSpace >= freeSpace - spaceLeft)
|
||||
{
|
||||
string msg = string.Format(Messages.CONFIRM_EXPORT_NOT_ENOUGH_MEMORY, Util.DiskSizeString((long)neededSpace),
|
||||
Util.DiskSizeString((long)freeSpace), vm.Name);
|
||||
Util.DiskSizeString((long)freeSpace), vm.Name());
|
||||
|
||||
DialogResult dr;
|
||||
using (var d = new ThreeButtonDialog(
|
||||
@ -157,7 +157,7 @@ namespace XenAdmin.Commands
|
||||
if (diskSpaceInfo.IsFAT && neededSpace > (4 * Util.BINARY_GIGA) - 1)
|
||||
{
|
||||
string msg = string.Format(Messages.CONFIRM_EXPORT_FAT, Util.DiskSizeString((long)neededSpace),
|
||||
Util.DiskSizeString(4 * Util.BINARY_GIGA), vm.Name);
|
||||
Util.DiskSizeString(4 * Util.BINARY_GIGA), vm.Name());
|
||||
|
||||
DialogResult dr;
|
||||
using (var d = new ThreeButtonDialog(
|
||||
|
@ -146,7 +146,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
hasRunningTasks = true;
|
||||
}
|
||||
if (vm.HAIsProtected)
|
||||
if (vm.HAIsProtected())
|
||||
{
|
||||
isHAProtected = true;
|
||||
}
|
||||
@ -177,7 +177,7 @@ namespace XenAdmin.Commands
|
||||
msg = Messages.CONFIRM_FORCESHUTDOWN_VM_NO_CANCEL_TASKS;
|
||||
}
|
||||
}
|
||||
return string.Format(msg, ((VM)selection[0].XenObject).Name);
|
||||
return string.Format(msg, ((VM)selection[0].XenObject).Name());
|
||||
}
|
||||
|
||||
if (hasRunningTasks)
|
||||
|
@ -80,7 +80,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return sr != null
|
||||
&& !sr.HasRunningVMs()
|
||||
&& sr.CanCreateWithXenCenter
|
||||
&& sr.CanCreateWithXenCenter()
|
||||
&& sr.allowed_operations.Contains(storage_operations.forget)
|
||||
&& !HelpersGUI.GetActionInProgress(sr);
|
||||
}
|
||||
@ -108,7 +108,7 @@ namespace XenAdmin.Commands
|
||||
List<SR> srs = GetSelection().AsXenObjects<SR>();
|
||||
if (srs.Count == 1)
|
||||
{
|
||||
return string.Format(Messages.MESSAGEBOX_FORGET_SR_CONTINUE, srs[0].Name);
|
||||
return string.Format(Messages.MESSAGEBOX_FORGET_SR_CONTINUE, srs[0].Name());
|
||||
}
|
||||
return Messages.MESSAGEBOX_FORGET_SRS_CONTINUE;
|
||||
}
|
||||
@ -142,7 +142,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return Messages.SR_HAS_RUNNING_VMS;
|
||||
}
|
||||
else if (!sr.CanCreateWithXenCenter)
|
||||
else if (!sr.CanCreateWithXenCenter())
|
||||
{
|
||||
return Messages.SR_CANNOT_BE_FORGOTTEN_WITH_XC;
|
||||
}
|
||||
|
@ -298,9 +298,11 @@ namespace XenAdmin.Commands
|
||||
|
||||
public static bool CanExecute(VM vm)
|
||||
{
|
||||
var virtualisationStatus = vm.GetVirtualisationStatus();
|
||||
|
||||
return vm != null && !vm.is_a_template && !vm.Locked &&
|
||||
!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.UNKNOWN) &&
|
||||
(!vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) || !vm.GetVirtualisationStatus.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)) &&
|
||||
!virtualisationStatus.HasFlag(VM.VirtualisationStatus.UNKNOWN) &&
|
||||
(!virtualisationStatus.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED) || !virtualisationStatus.HasFlag(VM.VirtualisationStatus.MANAGEMENT_INSTALLED)) &&
|
||||
vm.power_state == vm_power_state.Running && !ResidentHostIsOlderThanMaster(vm)
|
||||
&& CanViewVMConsole(vm.Connection);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(VM vm)
|
||||
{
|
||||
return vm != null && vm.is_a_template && !vm.Locked && !vm.is_a_snapshot && vm.InstantTemplate;
|
||||
return vm != null && vm.is_a_template && !vm.Locked && !vm.is_a_snapshot && vm.InstantTemplate();
|
||||
}
|
||||
|
||||
public override string MenuText
|
||||
|
@ -85,16 +85,16 @@ namespace XenAdmin.Commands
|
||||
|
||||
private bool CanBeMigrated(VDI vdi)
|
||||
{
|
||||
if (vdi == null || vdi.is_a_snapshot || vdi.Locked || vdi.IsHaType)
|
||||
if (vdi == null || vdi.is_a_snapshot || vdi.Locked || vdi.IsHaType())
|
||||
return false;
|
||||
|
||||
if(vdi.Connection.ResolveAll(vdi.VBDs).Count == 0)
|
||||
return false;
|
||||
if(vdi.GetVMs().Any(vm=>!vm.IsRunning) && !Helpers.DundeeOrGreater(vdi.Connection))
|
||||
if (vdi.GetVMs().Any(vm => !vm.IsRunning()) && !Helpers.DundeeOrGreater(vdi.Connection))
|
||||
return false;
|
||||
|
||||
SR sr = vdi.Connection.Resolve(vdi.SR);
|
||||
if (sr == null || sr.HBALunPerVDI)
|
||||
if (sr == null || sr.HBALunPerVDI())
|
||||
return false;
|
||||
if (Helpers.DundeePlusOrGreater(vdi.Connection) && !sr.allowed_operations.Contains(storage_operations.vdi_mirror))
|
||||
return false;
|
||||
@ -112,17 +112,17 @@ namespace XenAdmin.Commands
|
||||
return Messages.CANNOT_MOVE_VDI_IS_SNAPSHOT;
|
||||
if (vdi.Locked)
|
||||
return Messages.CANNOT_MOVE_VDI_IN_USE;
|
||||
if (vdi.IsHaType)
|
||||
if (vdi.IsHaType())
|
||||
return Messages.CANNOT_MOVE_HA_VD;
|
||||
if (vdi.IsMetadataForDR)
|
||||
if (vdi.IsMetadataForDR())
|
||||
return Messages.CANNOT_MOVE_DR_VD;
|
||||
if (vdi.GetVMs().Any(vm => !vm.IsRunning) && !Helpers.DundeeOrGreater(vdi.Connection))
|
||||
if (vdi.GetVMs().Any(vm => !vm.IsRunning()) && !Helpers.DundeeOrGreater(vdi.Connection))
|
||||
return Messages.CANNOT_MIGRATE_VDI_NON_RUNNING_VM;
|
||||
|
||||
SR sr = vdi.Connection.Resolve(vdi.SR);
|
||||
if (sr == null)
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
if (sr.HBALunPerVDI)
|
||||
if (sr.HBALunPerVDI())
|
||||
return Messages.UNSUPPORTED_SR_TYPE;
|
||||
if (Helpers.DundeePlusOrGreater(vdi.Connection) && !sr.allowed_operations.Contains(storage_operations.vdi_mirror))
|
||||
return Messages.UNSUPPORTED_SR_TYPE;
|
||||
|
@ -87,7 +87,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(VM vm)
|
||||
{
|
||||
return vm != null && (CrossPoolMoveVMCommand.CanExecute(vm, null) || vm.CanBeMoved);
|
||||
return vm != null && (CrossPoolMoveVMCommand.CanExecute(vm, null) || vm.CanBeMoved());
|
||||
}
|
||||
|
||||
public override string MenuText
|
||||
|
@ -74,13 +74,13 @@ namespace XenAdmin.Commands
|
||||
|
||||
private bool CanBeMoved(VDI vdi)
|
||||
{
|
||||
if (vdi == null || vdi.is_a_snapshot || vdi.Locked || vdi.IsHaType)
|
||||
if (vdi == null || vdi.is_a_snapshot || vdi.Locked || vdi.IsHaType())
|
||||
return false;
|
||||
if (vdi.VBDs.Count != 0)
|
||||
return false;
|
||||
|
||||
SR sr = vdi.Connection.Resolve(vdi.SR);
|
||||
if (sr == null || sr.HBALunPerVDI)
|
||||
if (sr == null || sr.HBALunPerVDI())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -96,9 +96,9 @@ namespace XenAdmin.Commands
|
||||
return Messages.CANNOT_MOVE_VDI_IS_SNAPSHOT;
|
||||
if (vdi.Locked)
|
||||
return Messages.CANNOT_MOVE_VDI_IN_USE;
|
||||
if (vdi.IsHaType)
|
||||
if (vdi.IsHaType())
|
||||
return Messages.CANNOT_MOVE_HA_VD;
|
||||
if (vdi.IsMetadataForDR)
|
||||
if (vdi.IsMetadataForDR())
|
||||
return Messages.CANNOT_MOVE_DR_VD;
|
||||
if (vdi.VBDs.Count != 0)
|
||||
return Messages.CANNOT_MOVE_VDI_WITH_VBDS;
|
||||
@ -107,7 +107,7 @@ namespace XenAdmin.Commands
|
||||
if (sr == null)
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
|
||||
if (sr.HBALunPerVDI)
|
||||
if (sr.HBALunPerVDI())
|
||||
return Messages.UNSUPPORTED_SR_TYPE;
|
||||
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
|
@ -70,10 +70,10 @@ namespace XenAdmin.Commands
|
||||
VM snapshot = (VM)selection[0].XenObject;
|
||||
|
||||
// Generate list of all taken VM/snapshot/template names
|
||||
List<string> takenNames = new List<VM>(snapshot.Connection.Cache.VMs).ConvertAll(v => v.Name);
|
||||
List<string> takenNames = new List<VM>(snapshot.Connection.Cache.VMs).ConvertAll(v => v.Name());
|
||||
|
||||
// Generate a unique suggested name for the new template
|
||||
string defaultName = Helpers.MakeUniqueName(String.Format(Messages.TEMPLATE_FROM_SNAPSHOT_DEFAULT_NAME, snapshot.Name), takenNames);
|
||||
string defaultName = Helpers.MakeUniqueName(String.Format(Messages.TEMPLATE_FROM_SNAPSHOT_DEFAULT_NAME, snapshot.Name()), takenNames);
|
||||
string newName = InputPromptDialog.Prompt(Parent, Messages.NEW_TEMPLATE_PROMPT, Messages.SAVE_AS_TEMPLATE, defaultName, "VMSnapshotPage");
|
||||
|
||||
if (newName != null) // is null if user cancelled
|
||||
|
@ -108,7 +108,7 @@ namespace XenAdmin.Commands
|
||||
Host hostAncestor = selection.HostAncestor;
|
||||
Pool poolAncestor = selection.PoolAncestor;
|
||||
|
||||
if (hostAncestor != null && hostAncestor.enabled && hostAncestor.IsLive && selection[0].Connection.IsConnected)
|
||||
if (hostAncestor != null && hostAncestor.enabled && hostAncestor.IsLive() && selection[0].Connection.IsConnected)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(DockerContainer dockerContainer)
|
||||
{
|
||||
return dockerContainer.power_state == vm_power_state.Running && !dockerContainer.Parent.IsWindows;
|
||||
return dockerContainer.power_state == vm_power_state.Running && !dockerContainer.Parent.IsWindows();
|
||||
}
|
||||
|
||||
protected override void ExecuteCore(SelectedItemCollection selection)
|
||||
|
@ -104,7 +104,7 @@ namespace XenAdmin.Commands
|
||||
private static bool CanExecute(Host host)
|
||||
{
|
||||
return host != null
|
||||
&& !host.IsLive
|
||||
&& !host.IsLive()
|
||||
&& host.allowed_operations != null && host.allowed_operations.Contains(host_allowed_operations.power_on)
|
||||
&& !HelpersGUI.HasActiveHostAction(host)
|
||||
&& host.power_on_mode != "";
|
||||
@ -119,7 +119,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
foreach (Host host in GetSelection().AsXenObjects<Host>())
|
||||
{
|
||||
if (!CanExecute(host) && !host.IsLive)
|
||||
if (!CanExecute(host) && !host.IsLive())
|
||||
{
|
||||
return new CommandErrorDialog(Messages.ERROR_DIALOG_POWER_ON_HOST_TITLE, Messages.ERROR_DIALOG_POWER_ON_HOST_TEXT, cantExecuteReasons);
|
||||
}
|
||||
@ -150,7 +150,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
if (host.IsLive)
|
||||
if (host.IsLive())
|
||||
{
|
||||
return Messages.HOST_ALREADY_POWERED_ON;
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ namespace XenAdmin.Commands
|
||||
private static bool CanReattachSR(SR sr)
|
||||
{
|
||||
return sr != null
|
||||
&& !sr.HasPBDs
|
||||
&& sr.CanCreateWithXenCenter
|
||||
&& !sr.HasPBDs()
|
||||
&& sr.CanCreateWithXenCenter()
|
||||
&& !HelpersGUI.GetActionInProgress(sr)
|
||||
&& !(sr.type == "cslg" && Helpers.FeatureForbidden(sr.Connection, Host.RestrictStorageChoices))
|
||||
&& (SM.GetByType(sr.Connection, sr.type) != null);
|
||||
|
@ -80,7 +80,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(Host host)
|
||||
{
|
||||
return host != null && host.IsLive;
|
||||
return host != null && host.IsLive();
|
||||
}
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
@ -127,25 +127,25 @@ namespace XenAdmin.Commands
|
||||
|
||||
foreach (Host h in hosts)
|
||||
{
|
||||
if (h.HasRunningVMs)
|
||||
if (h.HasRunningVMs())
|
||||
hasRunningVMs = true;
|
||||
|
||||
if (h.Connection.ResolveAll(h.resident_VMs).Exists(v => v.HciWarnBeforeShutdown))
|
||||
if (h.Connection.ResolveAll(h.resident_VMs).Exists(v => v.HciWarnBeforeShutdown()))
|
||||
hciHosts.Add(h);
|
||||
}
|
||||
|
||||
if (hciHosts.Count > 0)
|
||||
return hciHosts.Count == 1
|
||||
? string.Format(Messages.CONFIRM_REBOOT_HCI_WARN_SERVER, hciHosts[0].Name)
|
||||
: string.Format(Messages.CONFIRM_REBOOT_HCI_WARN_SERVERS, string.Join("\n", hciHosts.Select(h => h.Name)));
|
||||
? string.Format(Messages.CONFIRM_REBOOT_HCI_WARN_SERVER, hciHosts[0].Name())
|
||||
: string.Format(Messages.CONFIRM_REBOOT_HCI_WARN_SERVERS, string.Join("\n", hciHosts.Select(h => h.Name())));
|
||||
|
||||
if (hasRunningVMs)
|
||||
return hosts.Count == 1
|
||||
? string.Format(Messages.CONFIRM_REBOOT_SERVER, hosts[0].Name)
|
||||
? string.Format(Messages.CONFIRM_REBOOT_SERVER, hosts[0].Name())
|
||||
: Messages.CONFIRM_REBOOT_SERVERS;
|
||||
|
||||
return hosts.Count == 1
|
||||
? string.Format(Messages.CONFIRM_REBOOT_SERVER_NO_VMS, hosts[0].Name)
|
||||
? string.Format(Messages.CONFIRM_REBOOT_SERVER_NO_VMS, hosts[0].Name())
|
||||
: Messages.CONFIRM_REBOOT_SERVERS_NO_VMS;
|
||||
}
|
||||
}
|
||||
@ -175,7 +175,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
foreach (Host host in GetSelection().AsXenObjects<Host>())
|
||||
{
|
||||
if (!CanExecute(host) && host.IsLive)
|
||||
if (!CanExecute(host) && host.IsLive())
|
||||
{
|
||||
return new CommandErrorDialog(Messages.ERROR_DIALOG_FORCE_REBOOT_VM_TITLE, Messages.ERROR_DIALOG_FORCE_REBOOT_VM_TEXT, cantExecuteReasons);
|
||||
}
|
||||
@ -190,7 +190,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
if (!host.IsLive)
|
||||
if (!host.IsLive())
|
||||
{
|
||||
return Messages.HOST_NOT_LIVE;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ namespace XenAdmin.Commands
|
||||
if (selection.Count == 1)
|
||||
{
|
||||
Host hostAncestor = selection[0].HostAncestor;
|
||||
return hostAncestor != null && hostAncestor.HasCrashDumps;
|
||||
return hostAncestor != null && hostAncestor.HasCrashDumps();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ namespace XenAdmin.Commands
|
||||
connection.Hostname = host.address;
|
||||
connection.Username = host.Connection.Username;
|
||||
connection.Password = host.Connection.Password;
|
||||
connection.FriendlyName = host.Name;
|
||||
connection.FriendlyName = host.Name();
|
||||
|
||||
lock (ConnectionsManager.ConnectionsLock)
|
||||
{
|
||||
@ -135,7 +135,7 @@ namespace XenAdmin.Commands
|
||||
if (host != null && host.Connection != null )
|
||||
{
|
||||
Pool pool = Helpers.GetPool(host.Connection);
|
||||
return pool != null /*&& pool.master != host.opaque_ref*/ && host.resident_VMs != null && host.resident_VMs.Count < 2 && host.IsLive;
|
||||
return pool != null && host.resident_VMs != null && host.resident_VMs.Count < 2 && host.IsLive();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -244,8 +244,8 @@ namespace XenAdmin.Commands
|
||||
|
||||
if (selection.Count == 1)
|
||||
{
|
||||
return string.Format(Messages.MAINWINDOW_CONFIRM_REMOVE_FROM_POOL, host.Name.Ellipsise(500),
|
||||
Helpers.GetName(pool).Ellipsise(500), host.Name.Ellipsise(500));
|
||||
return string.Format(Messages.MAINWINDOW_CONFIRM_REMOVE_FROM_POOL, host.Name().Ellipsise(500),
|
||||
Helpers.GetName(pool).Ellipsise(500), host.Name().Ellipsise(500));
|
||||
}
|
||||
|
||||
return string.Format(Messages.MAINWINDOW_CONFIRM_REMOVE_FROM_POOL_MULTIPLE,
|
||||
|
@ -97,7 +97,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
string newName = _newName;
|
||||
Folders.FixupRelativePath(ref newName);
|
||||
return newName != _folder.Name && !newName.Contains(";") && !newName.Contains("/"); // CA-29480
|
||||
return newName != _folder.Name() && !newName.Contains(";") && !newName.Contains("/"); // CA-29480
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
List<SR> srList = selection.AsXenObjects<SR>(CanExecute);
|
||||
|
||||
if (srList.Find(s => !s.MultipathAOK) != null)
|
||||
if (srList.Find(s => !s.MultipathAOK()) != null)
|
||||
{
|
||||
using (var dlg = new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(
|
||||
@ -97,7 +97,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private bool CanExecute(SR sr)
|
||||
{
|
||||
return sr != null && sr.HasPBDs && (sr.IsBroken() || !sr.MultipathAOK) && !HelpersGUI.GetActionInProgress(sr) && sr.CanRepairAfterUpgradeFromLegacySL;
|
||||
return sr != null && sr.HasPBDs() && (sr.IsBroken() || !sr.MultipathAOK()) && !HelpersGUI.GetActionInProgress(sr) && sr.CanRepairAfterUpgradeFromLegacySL();
|
||||
}
|
||||
|
||||
public override Image MenuImage
|
||||
|
@ -62,7 +62,7 @@ namespace XenAdmin.Commands
|
||||
protected override void ExecuteCore(SelectedItemCollection selection)
|
||||
{
|
||||
var actions = new List<AsyncAction>();
|
||||
var liveHosts = selection.AsXenObjects<Host>().Where(h => h.IsLive);
|
||||
var liveHosts = selection.AsXenObjects<Host>().Where(h => h.IsLive());
|
||||
|
||||
foreach (Host host in liveHosts)
|
||||
{
|
||||
@ -75,7 +75,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
protected override bool CanExecuteCore(SelectedItemCollection selection)
|
||||
{
|
||||
return selection.AllItemsAre<Host>() && selection.Any(item => ((Host)item.XenObject).IsLive);
|
||||
return selection.AllItemsAre<Host>() && selection.Any(item => ((Host)item.XenObject).IsLive());
|
||||
}
|
||||
|
||||
protected override string GetCantExecuteReasonCore(SelectedItem item)
|
||||
@ -85,7 +85,7 @@ namespace XenAdmin.Commands
|
||||
if (host == null)
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
|
||||
if (!host.IsLive)
|
||||
if (!host.IsLive())
|
||||
return Messages.HOST_NOT_LIVE;
|
||||
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
@ -113,7 +113,7 @@ namespace XenAdmin.Commands
|
||||
List<Host> hosts = GetSelection().AsXenObjects<Host>();
|
||||
|
||||
return hosts.Count == 1
|
||||
? string.Format(Messages.CONFIRM_RESTART_TOOLSTACK_ONE_SERVER, hosts[0].Name.Ellipsise(30))
|
||||
? string.Format(Messages.CONFIRM_RESTART_TOOLSTACK_ONE_SERVER, hosts[0].Name().Ellipsise(30))
|
||||
: Messages.CONFIRM_RESTART_TOOLSTACK_MANY_SERVERS;
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
IXenConnection connection = selection[0].Connection;
|
||||
Host host = selection[0].XenObject as Host;
|
||||
return host != null && host.IsLive;
|
||||
return host != null && host.IsLive();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
Program.Invoke(Program.MainWindow, () => Program.MainWindow.ConsolePanel.setCurrentSource(vm));
|
||||
|
||||
RevertDialog dialog = new RevertDialog(vm, _snapshot.Name);
|
||||
RevertDialog dialog = new RevertDialog(vm, _snapshot.Name());
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.Yes)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ namespace XenAdmin.Commands
|
||||
continue;
|
||||
|
||||
var pool = Helpers.GetPoolOfOne(xenConnection);
|
||||
if (pool != null && pool.IsUpgradeForbidden)
|
||||
if (pool != null && pool.IsUpgradeForbidden())
|
||||
continue;
|
||||
|
||||
return true;
|
||||
|
@ -134,7 +134,7 @@ namespace XenAdmin.Commands
|
||||
else if (xenObject is SR)
|
||||
{
|
||||
SR sr = (SR)xenObject;
|
||||
_hostAncestor = sr.Home;
|
||||
_hostAncestor = sr.Home();
|
||||
_poolAncestor = Helpers.GetPool(_connection);
|
||||
}
|
||||
else if (xenObject is VM)
|
||||
|
@ -275,7 +275,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
get
|
||||
{
|
||||
return FirstIs<Host>() && ((Host)this[0].XenObject).IsLive;
|
||||
return FirstIs<Host>() && ((Host)this[0].XenObject).IsLive();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ namespace XenAdmin.Commands
|
||||
private static bool CanExecute(SR sr)
|
||||
{
|
||||
return sr != null
|
||||
&& sr.HasPBDs
|
||||
&& sr.HasPBDs()
|
||||
&& !SR.IsDefaultSr(sr)
|
||||
&& sr.SupportsVdiCreate()
|
||||
&& (sr.shared || sr.Connection.Cache.HostCount <= 1)
|
||||
|
@ -86,7 +86,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(Host host)
|
||||
{
|
||||
return host != null && host.IsLive && !HelpersGUI.HasActiveHostAction(host) ;
|
||||
return host != null && host.IsLive() && !HelpersGUI.HasActiveHostAction(host) ;
|
||||
}
|
||||
|
||||
public override string MenuText
|
||||
@ -138,25 +138,25 @@ namespace XenAdmin.Commands
|
||||
|
||||
foreach (Host h in hosts)
|
||||
{
|
||||
if (h.HasRunningVMs)
|
||||
if (h.HasRunningVMs())
|
||||
hasRunningVMs = true;
|
||||
|
||||
if (h.Connection.ResolveAll(h.resident_VMs).Exists(v => v.HciWarnBeforeShutdown))
|
||||
if (h.Connection.ResolveAll(h.resident_VMs).Exists(v => v.HciWarnBeforeShutdown()))
|
||||
hciHosts.Add(h);
|
||||
}
|
||||
|
||||
if (hciHosts.Count > 0)
|
||||
return hciHosts.Count == 1
|
||||
? string.Format(Messages.CONFIRM_SHUTDOWN_HCI_WARN_SERVER, hciHosts[0].Name)
|
||||
: string.Format(Messages.CONFIRM_SHUTDOWN_HCI_WARN_SERVERS, string.Join("\n", hciHosts.Select(h => h.Name)));
|
||||
? string.Format(Messages.CONFIRM_SHUTDOWN_HCI_WARN_SERVER, hciHosts[0].Name())
|
||||
: string.Format(Messages.CONFIRM_SHUTDOWN_HCI_WARN_SERVERS, string.Join("\n", hciHosts.Select(h => h.Name())));
|
||||
|
||||
if (hasRunningVMs)
|
||||
return hosts.Count == 1
|
||||
? string.Format(Messages.CONFIRM_SHUTDOWN_SERVER, hosts[0].Name)
|
||||
? string.Format(Messages.CONFIRM_SHUTDOWN_SERVER, hosts[0].Name())
|
||||
: Messages.CONFIRM_SHUTDOWN_SERVERS;
|
||||
|
||||
return hosts.Count == 1
|
||||
? string.Format(Messages.CONFIRM_SHUTDOWN_SERVER_NO_VMS, hosts[0].Name)
|
||||
? string.Format(Messages.CONFIRM_SHUTDOWN_SERVER_NO_VMS, hosts[0].Name())
|
||||
: Messages.CONFIRM_SHUTDOWN_SERVERS_NO_VMS;
|
||||
}
|
||||
}
|
||||
@ -165,7 +165,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
foreach (Host host in GetSelection().AsXenObjects<Host>())
|
||||
{
|
||||
if (!CanExecute(host) && host.IsLive)
|
||||
if (!CanExecute(host) && host.IsLive())
|
||||
{
|
||||
return new CommandErrorDialog(Messages.ERROR_DIALOG_SHUTDOWN_HOST_TITLE, Messages.ERROR_DIALOG_SHUTDOWN_HOST_TEXT, cantExecuteReasons);
|
||||
}
|
||||
@ -180,7 +180,7 @@ namespace XenAdmin.Commands
|
||||
{
|
||||
return base.GetCantExecuteReasonCore(item);
|
||||
}
|
||||
if (!host.IsLive)
|
||||
if (!host.IsLive())
|
||||
{
|
||||
return Messages.HOST_ALREADY_SHUT_DOWN;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ namespace XenAdmin.Commands
|
||||
if (selection.Count == 1)
|
||||
{
|
||||
VM vm = (VM)selection[0].XenObject;
|
||||
return vm.HAIsProtected ? Messages.HA_CONFIRM_SHUTDOWN_VM : Messages.CONFIRM_SHUTDOWN_VM;
|
||||
return vm.HAIsProtected() ? Messages.HA_CONFIRM_SHUTDOWN_VM : Messages.CONFIRM_SHUTDOWN_VM;
|
||||
}
|
||||
|
||||
return Messages.CONFIRM_SHUTDOWN_VMS;
|
||||
|
@ -87,7 +87,7 @@ namespace XenAdmin.Commands
|
||||
SR sr = null;
|
||||
if (vdi != null)
|
||||
sr = vm.Connection.Resolve<SR>(vdi.SR);
|
||||
if (vdi == null || sr.IsBroken(true) || sr.IsDetached)
|
||||
if (vdi == null || sr.IsBroken(true) || sr.IsDetached())
|
||||
{
|
||||
if (!brokenCDs.ContainsKey(vm))
|
||||
{
|
||||
|
@ -151,7 +151,7 @@ namespace XenAdmin.Commands
|
||||
if (selection.Count == 1)
|
||||
{
|
||||
VM vm = (VM)selection[0].XenObject;
|
||||
return vm.HAIsProtected ? Messages.HA_CONFIRM_SUSPEND_VM : Messages.CONFIRM_SUSPEND_VM;
|
||||
return vm.HAIsProtected() ? Messages.HA_CONFIRM_SUSPEND_VM : Messages.CONFIRM_SUSPEND_VM;
|
||||
}
|
||||
return Messages.CONFIRM_SUSPEND_VMS;
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(SR sr)
|
||||
{
|
||||
return sr != null && sr.SupportsTrim && sr.GetFirstAttachedStorageHost() != null;
|
||||
return sr != null && sr.SupportsTrim() && sr.GetFirstAttachedStorageHost() != null;
|
||||
}
|
||||
|
||||
public override string MenuText
|
||||
@ -89,7 +89,7 @@ namespace XenAdmin.Commands
|
||||
protected override string GetCantExecuteReasonCore(SelectedItem item)
|
||||
{
|
||||
SR sr = item.XenObject as SR;
|
||||
if (sr != null && !sr.SupportsTrim)
|
||||
if (sr != null && !sr.SupportsTrim())
|
||||
{
|
||||
return Messages.TOOLTIP_SR_TRIM_UNSUPPORTED;
|
||||
}
|
||||
@ -106,7 +106,7 @@ namespace XenAdmin.Commands
|
||||
get
|
||||
{
|
||||
var selection = GetSelection();
|
||||
var allUnsuported = selection.Count > 1 && selection.Select(item => item.XenObject as SR).All(sr => sr != null && !sr.SupportsTrim);
|
||||
var allUnsuported = selection.Count > 1 && selection.Select(item => item.XenObject as SR).All(sr => sr != null && !sr.SupportsTrim());
|
||||
return allUnsuported ? Messages.TOOLTIP_SR_TRIM_UNSUPPORTED_MULTIPLE : base.DisabledToolTipText;
|
||||
}
|
||||
}
|
||||
|
@ -169,18 +169,19 @@ namespace XenAdmin.Commands
|
||||
if (vm == null)
|
||||
return null;
|
||||
|
||||
var status = vm.GetVirtualisationStatus();
|
||||
//trying to guess the reason
|
||||
if (vm.HasNewVirtualisationStates)
|
||||
if (vm.HasNewVirtualisationStates())
|
||||
{
|
||||
if (!vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)) //note: this will also be true when the enum is in Unknown state
|
||||
if (!status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)) //note: this will also be true when the enum is in Unknown state
|
||||
return Messages.VM_MISSING_IO_DRIVERS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vm.virtualisation_status == 0 || vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
|
||||
if (status == 0 || status.HasFlag(VM.VirtualisationStatus.UNKNOWN))
|
||||
return FriendlyErrorNames.VM_MISSING_PV_DRIVERS;
|
||||
|
||||
if (vm.virtualisation_status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
if (status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
return FriendlyErrorNames.VM_OLD_PV_DRIVERS;
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ namespace XenAdmin.Commands
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.ErrorFormat("There was an error calling assert_can_boot_here on host {0}", host.Name);
|
||||
log.ErrorFormat("There was an error calling assert_can_boot_here on host {0}", host.Name());
|
||||
log.Error(e, e);
|
||||
return Messages.HOST_MENU_UNKNOWN_ERROR;
|
||||
}
|
||||
@ -194,10 +194,10 @@ namespace XenAdmin.Commands
|
||||
if (vm.last_boot_CPU_flags["vendor"] != targetHost.cpu_info["vendor"])
|
||||
return true;
|
||||
|
||||
if (vm.IsHVM && targetHost.cpu_info.ContainsKey("features_hvm"))
|
||||
if (vm.IsHVM() && targetHost.cpu_info.ContainsKey("features_hvm"))
|
||||
return PoolJoinRules.FewerFeatures(targetHost.cpu_info["features_hvm"], vm.last_boot_CPU_flags["features"]);
|
||||
|
||||
if (!vm.IsHVM && targetHost.cpu_info.ContainsKey("features_pv"))
|
||||
if (!vm.IsHVM() && targetHost.cpu_info.ContainsKey("features_pv"))
|
||||
return PoolJoinRules.FewerFeatures(targetHost.cpu_info["features_pv"], vm.last_boot_CPU_flags["features"]);
|
||||
|
||||
return false;
|
||||
|
@ -56,7 +56,7 @@ namespace XenAdmin.Commands
|
||||
Util.ThrowIfParameterNull(host, "host");
|
||||
|
||||
_host = host;
|
||||
_menuText = _host.Name.EscapeAmpersands();
|
||||
_menuText = _host.Name().EscapeAmpersands();
|
||||
|
||||
//Default or failure case, there is no score/star rating actually, just don't display star
|
||||
_secondImage = null;
|
||||
|
@ -79,7 +79,7 @@ namespace XenAdmin.Commands
|
||||
appsToShutDown.Add(firstVm.Connection.Resolve(firstVm.appliance));
|
||||
}
|
||||
|
||||
var appNames = (from VM_appliance app in appsToShutDown select app.Name).ToArray();
|
||||
var appNames = (from VM_appliance app in appsToShutDown select app.Name()).ToArray();
|
||||
return string.Format(Messages.CONFIRM_SHUT_DOWN_APPLIANCES, string.Join(", ", appNames));
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ namespace XenAdmin.Commands
|
||||
if (selection.AllItemsAre<VM>())
|
||||
{
|
||||
var firstVm = (VM)selection.First;
|
||||
if (firstVm.IsAssignedToVapp)
|
||||
if (firstVm.IsAssignedToVapp())
|
||||
{
|
||||
var firstVapp = firstVm.appliance;
|
||||
if (selection.AsXenObjects<VM>().All(vm => vm.appliance != null && vm.appliance.opaque_ref == firstVapp.opaque_ref))
|
||||
|
@ -61,7 +61,7 @@ namespace XenAdmin.Commands
|
||||
if (selection.AllItemsAre<VM>())
|
||||
{
|
||||
var firstVm = (VM)selection.First;
|
||||
if (firstVm.IsAssignedToVapp)
|
||||
if (firstVm.IsAssignedToVapp())
|
||||
{
|
||||
var firstVapp = firstVm.appliance;
|
||||
if (selection.AsXenObjects<VM>().All(vm => vm.appliance != null && vm.appliance.opaque_ref == firstVapp.opaque_ref))
|
||||
|
@ -81,11 +81,11 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
internal readonly ConsoleKeyHandler KeyHandler = new ConsoleKeyHandler();
|
||||
|
||||
private bool hasRDP { get { return source != null ? source.HasRDP : false; } }
|
||||
private bool hasRDP { get { return source != null && source.HasRDP(); } }
|
||||
|
||||
private bool RDPEnabled { get { return source != null ? source.RDPEnabled : false; } }
|
||||
private bool RDPEnabled { get { return source != null && source.RDPEnabled(); } }
|
||||
|
||||
private bool RDPControlEnabled { get { return source != null ? source.RDPControlEnabled : false; } }
|
||||
private bool RDPControlEnabled { get { return source != null && source.RDPControlEnabled(); } }
|
||||
|
||||
public bool IsRDPControlEnabled() { return RDPControlEnabled; }
|
||||
|
||||
@ -113,7 +113,7 @@ namespace XenAdmin.ConsoleView
|
||||
this.guestMetrics = source.Connection.Resolve(source.guest_metrics);
|
||||
if (this.guestMetrics != null)
|
||||
guestMetrics.PropertyChanged += guestMetrics_PropertyChanged;
|
||||
log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on {0}", this.source.Name);
|
||||
log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on {0}", this.source.Name());
|
||||
this.source.PropertyChanged += Server_PropertyChanged;
|
||||
Host_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
|
||||
VM_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(VM_CollectionChanged);
|
||||
@ -124,17 +124,17 @@ namespace XenAdmin.ConsoleView
|
||||
Host host = source.Connection.Resolve(source.resident_on);
|
||||
if (host != null)
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on {1}", this.source.Name, host.Name);
|
||||
log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on {1}", this.source.Name(), host.Name());
|
||||
host.PropertyChanged += Server_PropertyChanged;
|
||||
|
||||
Host_metrics hostMetrics = source.Connection.Resolve(host.metrics);
|
||||
if (hostMetrics != null)
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on host metrics", this.source.Name);
|
||||
log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on host metrics", this.source.Name());
|
||||
hostMetrics.PropertyChanged += Server_PropertyChanged;
|
||||
}
|
||||
|
||||
HostLabel.Text = string.Format(source.IsControlDomainZero ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, host.Name);
|
||||
HostLabel.Text = string.Format(source.IsControlDomainZero() ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, host.Name());
|
||||
HostLabel.Visible = true;
|
||||
}
|
||||
}
|
||||
@ -146,20 +146,20 @@ namespace XenAdmin.ConsoleView
|
||||
foreach (Host cachedHost in source.Connection.Cache.Hosts)
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Register Server_EnabledPropertyChanged event listener on {1}",
|
||||
source.Name, cachedHost.Name);
|
||||
source.Name(), cachedHost.Name());
|
||||
cachedHost.PropertyChanged += Server_EnabledPropertyChanged;
|
||||
}
|
||||
|
||||
HostLabel.Visible = false;
|
||||
}
|
||||
|
||||
log.DebugFormat("'{0}' console: Update power state (on VNCTabView constructor)", this.source.Name);
|
||||
log.DebugFormat("'{0}' console: Update power state (on VNCTabView constructor)", this.source.Name());
|
||||
updatePowerState();
|
||||
this.vncScreen = new XSVNCScreen(source, new EventHandler(RDPorVNCResizeHandler), this, elevatedUsername, elevatedPassword);
|
||||
ShowGpuWarningIfRequired(vncScreen.MustConnectRemoteDesktop());
|
||||
vncScreen.GpuStatusChanged += ShowGpuWarningIfRequired;
|
||||
|
||||
if (source.IsControlDomainZero || source.IsHVM && !hasRDP) //Linux HVM guests should only have one console: the console switch button vanishes altogether.
|
||||
if (source.IsControlDomainZero() || source.IsHVM() && !hasRDP) //Linux HVM guests should only have one console: the console switch button vanishes altogether.
|
||||
{
|
||||
toggleConsoleButton.Visible = false;
|
||||
}
|
||||
@ -251,7 +251,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
private void Host_CollectionChanged(object sender, CollectionChangeEventArgs e)
|
||||
{
|
||||
if (source.IsControlDomainZero)
|
||||
if (source.IsControlDomainZero())
|
||||
return;
|
||||
|
||||
Host host = e.Element as Host;
|
||||
@ -260,14 +260,14 @@ namespace XenAdmin.ConsoleView
|
||||
if (e.Action == CollectionChangeAction.Add)
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Register Server_EnabledPropertyChanged event listener on {1}",
|
||||
source.Name, host.Name);
|
||||
source.Name(), host.Name());
|
||||
host.PropertyChanged -= Server_EnabledPropertyChanged;
|
||||
host.PropertyChanged += Server_EnabledPropertyChanged;
|
||||
}
|
||||
else if (e.Action == CollectionChangeAction.Remove)
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Unregister Server_EnabledPropertyChanged event listener on {1}",
|
||||
source.Name, host.Name);
|
||||
source.Name(), host.Name());
|
||||
host.PropertyChanged -= Server_EnabledPropertyChanged;
|
||||
}
|
||||
}
|
||||
@ -280,27 +280,27 @@ namespace XenAdmin.ConsoleView
|
||||
if (source == null)
|
||||
return;
|
||||
|
||||
log.DebugFormat("'{0}' console: Unregister Server_PropertyChanged event listener on {0}", source.Name);
|
||||
log.DebugFormat("'{0}' console: Unregister Server_PropertyChanged event listener on {0}", source.Name());
|
||||
source.PropertyChanged -= new PropertyChangedEventHandler(Server_PropertyChanged);
|
||||
source.Connection.Cache.DeregisterCollectionChanged<VM>(VM_CollectionChangedWithInvoke);
|
||||
|
||||
if (this.guestMetrics != null)
|
||||
this.guestMetrics.PropertyChanged -= guestMetrics_PropertyChanged;
|
||||
|
||||
if (source.IsControlDomainZero)
|
||||
if (source.IsControlDomainZero())
|
||||
{
|
||||
Host host = source.Connection.Resolve<Host>(source.resident_on);
|
||||
if (host != null)
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Unregister Server_PropertyChanged event listener on {1}",
|
||||
source.Name, host.Name);
|
||||
source.Name(), host.Name());
|
||||
host.PropertyChanged -= Server_PropertyChanged;
|
||||
|
||||
Host_metrics hostMetrics = source.Connection.Resolve<Host_metrics>(host.metrics);
|
||||
if (hostMetrics != null)
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Unregister Server_PropertyChanged event listener on host metrics",
|
||||
source.Name);
|
||||
source.Name());
|
||||
hostMetrics.PropertyChanged -= Server_PropertyChanged;
|
||||
}
|
||||
}
|
||||
@ -312,7 +312,7 @@ namespace XenAdmin.ConsoleView
|
||||
foreach (Host cachedHost in source.Connection.Cache.Hosts)
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Unregister Server_EnabledPropertyChanged event listener on {1}",
|
||||
source.Name, cachedHost.Name);
|
||||
source.Name(), cachedHost.Name());
|
||||
cachedHost.PropertyChanged -= Server_EnabledPropertyChanged;
|
||||
}
|
||||
}
|
||||
@ -528,7 +528,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
if (source.is_control_domain && e.PropertyName == "name_label")
|
||||
{
|
||||
string text = string.Format(source.IsControlDomainZero ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, source.AffinityServerString);
|
||||
string text = string.Format(source.IsControlDomainZero() ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, source.AffinityServerString());
|
||||
HostLabel.Text = text;
|
||||
|
||||
if (parentVNCView != null && parentVNCView.undockedForm != null)
|
||||
@ -590,7 +590,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
private void Server_EnabledPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName != "enabled" || source.IsControlDomainZero)
|
||||
if (e.PropertyName != "enabled" || source.IsControlDomainZero())
|
||||
return;
|
||||
|
||||
Host host = sender as Host;
|
||||
@ -613,7 +613,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
private void updatePowerState()
|
||||
{
|
||||
if (source.IsControlDomainZero)
|
||||
if (source.IsControlDomainZero())
|
||||
{
|
||||
Host host = source.Connection.Resolve<Host>(source.resident_on);
|
||||
if (host == null)
|
||||
@ -679,14 +679,14 @@ namespace XenAdmin.ConsoleView
|
||||
private void hideTopBarContents()
|
||||
{
|
||||
VMPowerOff();
|
||||
if (source.IsControlDomainZero)
|
||||
if (source.IsControlDomainZero())
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Hide top bar contents, server is unavailable", source.Name);
|
||||
log.DebugFormat("'{0}' console: Hide top bar contents, server is unavailable", source.Name());
|
||||
DisablePowerStateLabel(Messages.CONSOLE_HOST_DEAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Hide top bar contents, powerstate='{1}'", source.Name, vm_power_state_helper.ToString(source.power_state));
|
||||
log.DebugFormat("'{0}' console: Hide top bar contents, powerstate='{1}'", source.Name(), vm_power_state_helper.ToString(source.power_state));
|
||||
if (source.power_state == vm_power_state.Halted)
|
||||
{
|
||||
if (source.allowed_operations.Contains(vm_operations.start) &&
|
||||
@ -732,7 +732,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
private void showTopBarContents()
|
||||
{
|
||||
log.DebugFormat("'{0}' console: Show top bar contents, source is running", source.Name);
|
||||
log.DebugFormat("'{0}' console: Show top bar contents, source is running", source.Name());
|
||||
Program.AssertOnEventThread();
|
||||
VMPowerOn();
|
||||
powerStateLabel.Hide();
|
||||
@ -1375,7 +1375,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
ContextMenuItemCollection contextMenuItems = new ContextMenuItemCollection();
|
||||
|
||||
if (source.IsControlDomainZero)
|
||||
if (source.IsControlDomainZero())
|
||||
{
|
||||
// We're looking at the host console
|
||||
if (host.Connection.IsConnected)
|
||||
@ -1506,7 +1506,7 @@ namespace XenAdmin.ConsoleView
|
||||
|
||||
try
|
||||
{
|
||||
var startInfo = new ProcessStartInfo(puttyPath, source.IPAddressForSSH);
|
||||
var startInfo = new ProcessStartInfo(puttyPath, source.IPAddressForSSH());
|
||||
Process.Start(startInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -1540,10 +1540,10 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
get
|
||||
{
|
||||
if (source.IsWindows)
|
||||
if (source.IsWindows())
|
||||
return false;
|
||||
|
||||
if (source.IsControlDomainZero)
|
||||
if (source.IsControlDomainZero())
|
||||
{
|
||||
Host host = source.Connection.Resolve<Host>(source.resident_on);
|
||||
if (host == null)
|
||||
@ -1568,7 +1568,7 @@ namespace XenAdmin.ConsoleView
|
||||
return
|
||||
IsSSHConsoleSupported &&
|
||||
source.power_state == vm_power_state.Running &&
|
||||
!string.IsNullOrEmpty(source.IPAddressForSSH);
|
||||
!string.IsNullOrEmpty(source.IPAddressForSSH());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -208,13 +208,13 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
Host host = source.Connection.Resolve(source.resident_on);
|
||||
if (host == null)
|
||||
return source.Name;
|
||||
return source.Name();
|
||||
|
||||
return string.Format(source.IsControlDomainZero ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, host.Name);
|
||||
return string.Format(source.IsControlDomainZero() ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, host.Name());
|
||||
}
|
||||
else
|
||||
{
|
||||
return source.Name;
|
||||
return source.Name();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ namespace XenAdmin.ConsoleView
|
||||
[DefaultValue(false)]
|
||||
public bool UserWantsToSwitchProtocol { get; set; }
|
||||
|
||||
private bool hasRDP { get { return Source != null ? Source.HasRDP : false; } }
|
||||
private bool hasRDP { get { return Source != null && Source.HasRDP(); } }
|
||||
|
||||
/// <summary>
|
||||
/// Whether we have tried to login without providing a password (covers the case where the user
|
||||
@ -204,7 +204,7 @@ namespace XenAdmin.ConsoleView
|
||||
Dictionary<string, string> newNetworks = (sender as VM_guest_metrics).networks;
|
||||
if (!equateDictionary<string, string>(newNetworks, cachedNetworks))
|
||||
{
|
||||
Log.InfoFormat("Detected IP address change in vm {0}, repolling for VNC/RDP...", Source.Name);
|
||||
Log.InfoFormat("Detected IP address change in vm {0}, repolling for VNC/RDP...", Source.Name());
|
||||
|
||||
cachedNetworks = newNetworks;
|
||||
|
||||
@ -370,7 +370,7 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
if (pif == null)
|
||||
ipAddressesForNetworksWithoutPifs.Add(networkInfo.Value);
|
||||
else if (pif.LinkStatus == PIF.LinkState.Connected)
|
||||
else if (pif.LinkStatus() == PIF.LinkState.Connected)
|
||||
ipAddresses.Add(networkInfo.Value);
|
||||
}
|
||||
else
|
||||
@ -379,7 +379,7 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
if (pif == null)
|
||||
ipv6AddressesForNetworksWithoutPifs.Add(String.Format("[{0}]", networkInfo.Value));
|
||||
else if (pif.LinkStatus == PIF.LinkState.Connected)
|
||||
else if (pif.LinkStatus() == PIF.LinkState.Connected)
|
||||
ipv6Addresses.Add(String.Format("[{0}]", networkInfo.Value));
|
||||
}
|
||||
else
|
||||
@ -589,7 +589,7 @@ namespace XenAdmin.ConsoleView
|
||||
internal bool MustConnectRemoteDesktop()
|
||||
{
|
||||
return (UseVNC || string.IsNullOrEmpty(rdpIP)) &&
|
||||
Source.HasGPUPassthrough && Source.power_state == vm_power_state.Running;
|
||||
Source.HasGPUPassthrough() && Source.power_state == vm_power_state.Running;
|
||||
}
|
||||
|
||||
private void SetKeyboardAndMouseCapture(bool value)
|
||||
@ -706,7 +706,7 @@ namespace XenAdmin.ConsoleView
|
||||
{
|
||||
value.PropertyChanged += new PropertyChangedEventHandler(VM_PropertyChanged);
|
||||
|
||||
sourceIsPV = !value.IsHVM;
|
||||
sourceIsPV = !value.IsHVM();
|
||||
|
||||
startPolling();
|
||||
|
||||
@ -727,13 +727,13 @@ namespace XenAdmin.ConsoleView
|
||||
if (Source == null)
|
||||
return null;
|
||||
|
||||
if (Source.IsControlDomainZero)
|
||||
return string.Format(Messages.CONSOLE_HOST, Source.AffinityServerString);
|
||||
if (Source.IsControlDomainZero())
|
||||
return string.Format(Messages.CONSOLE_HOST, Source.AffinityServerString());
|
||||
|
||||
if (Source.is_control_domain)
|
||||
return string.Format(Messages.CONSOLE_HOST_NUTANIX, Source.AffinityServerString);
|
||||
return string.Format(Messages.CONSOLE_HOST_NUTANIX, Source.AffinityServerString());
|
||||
|
||||
return Source.Name;
|
||||
return Source.Name();
|
||||
}
|
||||
}
|
||||
|
||||
@ -765,9 +765,9 @@ namespace XenAdmin.ConsoleView
|
||||
}
|
||||
|
||||
//Start the polling again
|
||||
if (Source != null && !Source.IsControlDomainZero)
|
||||
if (Source != null && !Source.IsControlDomainZero())
|
||||
{
|
||||
if (!Source.IsHVM)
|
||||
if (!Source.IsHVM())
|
||||
{
|
||||
connectionPoller = new Timer(PollVNCPort, null, RETRY_SLEEP_TIME, RDP_POLL_INTERVAL);
|
||||
}
|
||||
|
@ -120,13 +120,13 @@ namespace XenAdmin.Controls
|
||||
// get the logged in username from the session to update the logged in label
|
||||
if (connection.Session.IsLocalSuperuser || XenAdmin.Core.Helpers.GetMaster(connection).external_auth_type != Auth.AUTH_TYPE_AD)
|
||||
{
|
||||
labelUsername.Text = connection.Session.UserFriendlyName;
|
||||
labelUsername.Text = connection.Session.UserFriendlyName();
|
||||
}
|
||||
else
|
||||
{
|
||||
labelUsername.Text = string.Format("{0} ({1})",
|
||||
connection.Session.UserFriendlyName,
|
||||
connection.Session.FriendlySingleRoleDescription); ;
|
||||
connection.Session.UserFriendlyName(),
|
||||
connection.Session.FriendlySingleRoleDescription());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,13 +258,14 @@ namespace XenAdmin.Controls
|
||||
private void UpdateDetails()
|
||||
{
|
||||
ImageCell.Value = Images.GetImage16For(Server);
|
||||
NameCell.Value = Server.Name;
|
||||
NameCell.Value = Server.Name();
|
||||
|
||||
Enabled = Server.IsLive;
|
||||
bool isLiveHost = Server.IsLive();
|
||||
Enabled = isLiveHost;
|
||||
|
||||
if (showReason)
|
||||
{
|
||||
ReasonCell.Value = Server.IsLive ? Server.HostMemoryString : Messages.HOMESERVER_PICKER_HOST_NOT_LIVE;
|
||||
ReasonCell.Value = isLiveHost ? Server.HostMemoryString() : Messages.HOMESERVER_PICKER_HOST_NOT_LIVE;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -88,12 +88,12 @@ namespace XenAdmin.Controls.Ballooning
|
||||
if (host == null || host_metrics == null)
|
||||
return;
|
||||
long total = host_metrics.memory_total;
|
||||
long free = host.memory_free_calc;
|
||||
long free = host.memory_free_calc();
|
||||
long used = total - free;
|
||||
long xen_memory = host.xen_memory_calc;
|
||||
long avail = host.memory_available_calc;
|
||||
long tot_dyn_max = host.tot_dyn_max + xen_memory;
|
||||
long dom0 = host.dom0_memory;
|
||||
long xen_memory = host.xen_memory_calc();
|
||||
long avail = host.memory_available_calc();
|
||||
long tot_dyn_max = host.tot_dyn_max() + xen_memory;
|
||||
long dom0 = host.dom0_memory();
|
||||
|
||||
long overcommit = total > 0
|
||||
? (long)Math.Round((double)tot_dyn_max / (double)total * 100.0)
|
||||
|
@ -84,7 +84,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
DrawSegment(g, xen_memory - dom0_memory, bytesPerPixel, Messages.MEMORY_XEN, null, BallooningColors.HostShinyBar_Xen, ref left);
|
||||
|
||||
// A bar for Dom0 memory
|
||||
DrawSegment(g, dom0_memory, bytesPerPixel, string.Format(Messages.CONTROL_DOM_ON_HOST, host.Name), null, BallooningColors.HostShinyBar_ControlDomain, ref left);
|
||||
DrawSegment(g, dom0_memory, bytesPerPixel, string.Format(Messages.CONTROL_DOM_ON_HOST, host.Name()), null, BallooningColors.HostShinyBar_ControlDomain, ref left);
|
||||
|
||||
// A bar for each VM
|
||||
int i = 0;
|
||||
@ -97,7 +97,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
VM_metrics metrics = vm_metrics[vm];
|
||||
if (metrics != null)
|
||||
{
|
||||
DrawSegment(g, metrics.memory_actual, bytesPerPixel, vm.Name, vm,
|
||||
DrawSegment(g, metrics.memory_actual, bytesPerPixel, vm.Name(), vm,
|
||||
BallooningColors.HostShinyBar_VMs[i++ % BallooningColors.HostShinyBar_VMs.Length],
|
||||
ref left);
|
||||
}
|
||||
@ -123,7 +123,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
string bytesString = Util.MemorySizeStringSuitableUnits(mem, false);
|
||||
string caption = name + "\n" + bytesString;
|
||||
string toolTip = name + "\n" + string.Format(Messages.CURRENT_MEMORY_USAGE, Util.MemorySizeStringSuitableUnits(mem, true));
|
||||
if (vm != null && vm.has_ballooning)
|
||||
if (vm != null && vm.has_ballooning())
|
||||
{
|
||||
if (vm.memory_dynamic_max == vm.memory_static_max)
|
||||
toolTip += string.Format("\n{0}: {1}\n{2}: {3}",
|
||||
|
@ -88,11 +88,11 @@ namespace XenAdmin.Controls.Ballooning
|
||||
{
|
||||
// If all the Virtualisation Statuses are the same, report that reason.
|
||||
// Otherwise give a generic message.
|
||||
VM.VirtualisationStatus vs0 = vm0.GetVirtualisationStatus;
|
||||
VM.VirtualisationStatus vs0 = vm0.GetVirtualisationStatus();
|
||||
bool identical = true;
|
||||
foreach (VM vm in vms)
|
||||
{
|
||||
if (vm.GetVirtualisationStatus != vs0)
|
||||
if (vm.GetVirtualisationStatus() != vs0)
|
||||
{
|
||||
identical = false;
|
||||
break;
|
||||
@ -100,11 +100,11 @@ namespace XenAdmin.Controls.Ballooning
|
||||
}
|
||||
if (identical)
|
||||
{
|
||||
var status = vm0.GetVirtualisationStatus;
|
||||
var status = vm0.GetVirtualisationStatus();
|
||||
if (status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_NOTSUPPORTED_PLURAL;
|
||||
else if (!status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = vm0.HasNewVirtualisationStates ? Messages.DMC_UNAVAILABLE_NO_IO_NO_MGMNT_PLURAL : Messages.DMC_UNAVAILABLE_NOTOOLS_PLURAL;
|
||||
labelDMCUnavailable.Text = vm0.HasNewVirtualisationStates() ? Messages.DMC_UNAVAILABLE_NO_IO_NO_MGMNT_PLURAL : Messages.DMC_UNAVAILABLE_NOTOOLS_PLURAL;
|
||||
else if (status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_OLDTOOLS_PLURAL;
|
||||
else
|
||||
@ -121,12 +121,12 @@ namespace XenAdmin.Controls.Ballooning
|
||||
}
|
||||
else
|
||||
{
|
||||
var status = vm0.GetVirtualisationStatus;
|
||||
var status = vm0.GetVirtualisationStatus();
|
||||
|
||||
if (status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_NOTSUPPORTED;
|
||||
else if (!status.HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED))
|
||||
labelDMCUnavailable.Text = vm0.HasNewVirtualisationStates ? Messages.DMC_UNAVAILABLE_NO_IO_NO_MGMNT : Messages.DMC_UNAVAILABLE_NOTOOLS;
|
||||
labelDMCUnavailable.Text = vm0.HasNewVirtualisationStates() ? Messages.DMC_UNAVAILABLE_NO_IO_NO_MGMNT : Messages.DMC_UNAVAILABLE_NOTOOLS;
|
||||
else if (status.HasFlag(VM.VirtualisationStatus.PV_DRIVERS_OUT_OF_DATE))
|
||||
labelDMCUnavailable.Text = Messages.DMC_UNAVAILABLE_OLDTOOLS;
|
||||
else
|
||||
|
@ -54,7 +54,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
set
|
||||
{
|
||||
base.VMs = value;
|
||||
ballooning = vm0.has_ballooning;
|
||||
ballooning = vm0.has_ballooning();
|
||||
firstPaint = true;
|
||||
maxMemAllowed = CalcMaxMemAllowed();
|
||||
}
|
||||
@ -104,10 +104,10 @@ namespace XenAdmin.Controls.Ballooning
|
||||
|
||||
private long CalcMaxMemAllowed()
|
||||
{
|
||||
long ans = (vms.Count == 0 ? VM.DEFAULT_MEM_ALLOWED : vms[0].MaxMemAllowed);
|
||||
long ans = (vms.Count == 0 ? VM.DEFAULT_MEM_ALLOWED : vms[0].MaxMemAllowed());
|
||||
foreach (VM vm in vms)
|
||||
{
|
||||
long max = vm.MaxMemAllowed;
|
||||
long max = vm.MaxMemAllowed();
|
||||
if (max < ans)
|
||||
ans = max;
|
||||
}
|
||||
@ -246,7 +246,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
bool pv = false;
|
||||
foreach (VM vm in vms)
|
||||
{
|
||||
if (vm.IsHVM)
|
||||
if (vm.IsHVM())
|
||||
hvm = true;
|
||||
else
|
||||
pv = true;
|
||||
|
@ -73,13 +73,13 @@ namespace XenAdmin.Controls.Ballooning
|
||||
// So "good" VMs are ones which are halted, or running with known virtualisation status.
|
||||
editButton.Visible =
|
||||
(null == vms.Find(vm => !(vm.power_state == vm_power_state.Halted ||
|
||||
vm.power_state == vm_power_state.Running && !vm.virtualisation_status.HasFlag(XenAPI.VM.VirtualisationStatus.UNKNOWN))));
|
||||
vm.power_state == vm_power_state.Running && !vm.GetVirtualisationStatus().HasFlag(XenAPI.VM.VirtualisationStatus.UNKNOWN))));
|
||||
|
||||
// Shiny bar
|
||||
vmShinyBar.Initialize(vm0, vms.Count > 1, CalcMemoryUsed(), false);
|
||||
|
||||
// Spinners
|
||||
bool ballooning = vm0.has_ballooning;
|
||||
bool ballooning = vm0.has_ballooning();
|
||||
if (ballooning)
|
||||
{
|
||||
valueDynMin.Text = Util.MemorySizeStringSuitableUnits(vm0.memory_dynamic_min, true);
|
||||
@ -116,7 +116,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
{
|
||||
if (vms.Count == 1)
|
||||
{
|
||||
if (vm0.advanced_ballooning)
|
||||
if (vm0.advanced_ballooning())
|
||||
(new BallooningDialogAdvanced(vm0)).ShowDialog();
|
||||
else
|
||||
(new BallooningDialog(vm0)).ShowDialog();
|
||||
|
@ -144,7 +144,7 @@ namespace XenAdmin.Controls.Ballooning
|
||||
this.static_max = vm.memory_static_max;
|
||||
this.dynamic_min = dynamic_min_orig = Util.CorrectRoundingErrors(vm.memory_dynamic_min);
|
||||
this.dynamic_max = dynamic_max_orig = Util.CorrectRoundingErrors(vm.memory_dynamic_max);
|
||||
this.has_ballooning = vm.has_ballooning;
|
||||
this.has_ballooning = vm.has_ballooning();
|
||||
this.allowEdit = allowEdit;
|
||||
}
|
||||
|
||||
|
@ -183,16 +183,16 @@ namespace XenAdmin.Controls
|
||||
{
|
||||
string description = PIFDescription(pif);
|
||||
XenAPI.Network network = Connection.Resolve<XenAPI.Network>(pif.network);
|
||||
PIF_metrics metrics = pif.PIFMetrics;
|
||||
PIF_metrics metrics = pif.PIFMetrics();
|
||||
|
||||
int rowIndex = dataGridView1.Rows.Add(new object[]
|
||||
{
|
||||
false,
|
||||
String.Format("{0} {1}", pif.Name, description),
|
||||
String.Format("{0} {1}", pif.Name(), description),
|
||||
pif.MAC,
|
||||
(network.PIFs.Count > 1) ? network.LinkStatusString : pif.LinkStatusString,
|
||||
pif.Carrier ? pif.Speed : Messages.HYPHEN,
|
||||
pif.Carrier ? pif.Duplex : Messages.HYPHEN,
|
||||
(network.PIFs.Count > 1) ? network.LinkStatusString() : pif.LinkStatusString(),
|
||||
pif.Carrier() ? pif.Speed() : Messages.HYPHEN,
|
||||
pif.Carrier() ? pif.Duplex() : Messages.HYPHEN,
|
||||
metrics == null ? "" : metrics.vendor_name,
|
||||
metrics == null ? "" : metrics.device_name,
|
||||
metrics == null ? "" : metrics.pci_bus_path
|
||||
@ -226,8 +226,8 @@ namespace XenAdmin.Controls
|
||||
|
||||
private string PIFDescription(PIF pif)
|
||||
{
|
||||
Bond bond = pif.BondSlaveOf;
|
||||
return bond == null ? "" : string.Format(Messages.ALREADY_IN_BOND, bond.Name);
|
||||
Bond bond = pif.BondSlaveOf();
|
||||
return bond == null ? "" : string.Format(Messages.ALREADY_IN_BOND, bond.Name());
|
||||
}
|
||||
|
||||
internal DialogResult ShowCreationWarning()
|
||||
@ -259,7 +259,7 @@ namespace XenAdmin.Controls
|
||||
using (var dlg = new ThreeButtonDialog(
|
||||
new ThreeButtonDialog.Details(
|
||||
SystemIcons.Error,
|
||||
string.Format(Messages.BOND_CREATE_HA_ENABLED, pool.Name),
|
||||
string.Format(Messages.BOND_CREATE_HA_ENABLED, pool.Name()),
|
||||
Messages.BOND_CREATE)))
|
||||
{
|
||||
dlg.ShowDialog(this);
|
||||
|
@ -106,10 +106,10 @@ namespace XenAdmin.Controls
|
||||
if (sr.content_type != SR.Content_Type_ISO)
|
||||
continue;
|
||||
|
||||
if (DisplayPhysical && !sr.Physical)
|
||||
if (DisplayPhysical && !sr.Physical())
|
||||
continue;
|
||||
|
||||
if (DisplayISO && (sr.Physical || (noTools && sr.IsToolsSR)))
|
||||
if (DisplayISO && (sr.Physical() || (noTools && sr.IsToolsSR())))
|
||||
continue;
|
||||
|
||||
if (vm == null && sr.IsBroken())
|
||||
@ -139,7 +139,7 @@ namespace XenAdmin.Controls
|
||||
}
|
||||
}
|
||||
|
||||
items.Add(new ToStringWrapper<SR>(sr, sr.Name));
|
||||
items.Add(new ToStringWrapper<SR>(sr, sr.Name()));
|
||||
}
|
||||
|
||||
if (items.Count > 0)
|
||||
@ -194,17 +194,17 @@ namespace XenAdmin.Controls
|
||||
Items.Add(srWrapper);
|
||||
|
||||
List<ToStringWrapper<VDI>> items = new List<ToStringWrapper<VDI>>();
|
||||
if (srWrapper.item.Physical)
|
||||
if (srWrapper.item.Physical())
|
||||
{
|
||||
List<ToStringWrapper<VDI>> vdis = new List<ToStringWrapper<VDI>>();
|
||||
foreach (VDI vdi in connection.ResolveAll<VDI>(srWrapper.item.VDIs))
|
||||
{
|
||||
ToStringWrapper<VDI> vdiWrapper = new ToStringWrapper<VDI>(vdi, vdi.Name);
|
||||
ToStringWrapper<VDI> vdiWrapper = new ToStringWrapper<VDI>(vdi, vdi.Name());
|
||||
vdis.Add(vdiWrapper);
|
||||
}
|
||||
vdis.Sort(new Comparison<ToStringWrapper<VDI>>(delegate(ToStringWrapper<VDI> object1, ToStringWrapper<VDI> object2)
|
||||
{
|
||||
return Core.StringUtility.NaturalCompare(object1.item.Name, object2.item.Name);
|
||||
return Core.StringUtility.NaturalCompare(object1.item.Name(), object2.item.Name());
|
||||
}));
|
||||
|
||||
Host host = srWrapper.item.GetStorageHost();
|
||||
@ -212,29 +212,29 @@ namespace XenAdmin.Controls
|
||||
{
|
||||
for (int i = 0; i < vdis.Count; i++)
|
||||
{
|
||||
items.Add(new ToStringWrapper<VDI>(vdis[i].item, " " + string.Format(Messages.ISOCOMBOBOX_CD_DRIVE, i, host.Name)));
|
||||
items.Add(new ToStringWrapper<VDI>(vdis[i].item, " " + string.Format(Messages.ISOCOMBOBOX_CD_DRIVE, i, host.Name())));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (srWrapper.item.IsToolsSR)
|
||||
if (srWrapper.item.IsToolsSR())
|
||||
{
|
||||
foreach (VDI vdi in connection.ResolveAll<VDI>(srWrapper.item.VDIs))
|
||||
{
|
||||
if (vdi.IsToolsIso)
|
||||
items.Add(new ToStringWrapper<VDI>(vdi, " " + vdi.Name));
|
||||
if (vdi.IsToolsIso())
|
||||
items.Add(new ToStringWrapper<VDI>(vdi, " " + vdi.Name()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (VDI vdi in connection.ResolveAll<VDI>(srWrapper.item.VDIs))
|
||||
{
|
||||
items.Add(new ToStringWrapper<VDI>(vdi, " " + vdi.Name));
|
||||
items.Add(new ToStringWrapper<VDI>(vdi, " " + vdi.Name()));
|
||||
}
|
||||
items.Sort(new Comparison<ToStringWrapper<VDI>>(delegate(ToStringWrapper<VDI> object1, ToStringWrapper<VDI> object2)
|
||||
{
|
||||
return Core.StringUtility.NaturalCompare(object1.item.Name, object2.item.Name);
|
||||
return Core.StringUtility.NaturalCompare(object1.item.Name(), object2.item.Name());
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ namespace XenAdmin.Controls
|
||||
IncludePoolNameInComboBox = IncludePoolNameInComboBox,
|
||||
IsManagement = pif.management,
|
||||
Network = network,
|
||||
NetworkIsConnected = pif.LinkStatus == PIF.LinkState.Connected,
|
||||
NetworkIsConnected = pif.LinkStatus() == PIF.LinkState.Connected,
|
||||
HasIPAddress = pif.IsManagementInterface(false)
|
||||
};
|
||||
}
|
||||
@ -131,7 +131,7 @@ namespace XenAdmin.Controls
|
||||
var selectedItem = (NetworkComboBoxItem)SelectedItem;
|
||||
return selectedItem == null
|
||||
? new KeyValuePair<string, string>(string.Empty, string.Empty)
|
||||
: new KeyValuePair<string, string>(selectedItem.Network.uuid, selectedItem.Network.Name);
|
||||
: new KeyValuePair<string, string>(selectedItem.Network.uuid, selectedItem.Network.Name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -51,12 +51,12 @@ namespace XenAdmin.Controls
|
||||
IncludePoolNameInComboBox = false;
|
||||
|
||||
if (IsManagement && IncludePoolNameInComboBox)
|
||||
return String.Format(Messages.MANAGEMENT_NETWORK_WITH_POOL, Network.Name, pool.Name);
|
||||
return String.Format(Messages.MANAGEMENT_NETWORK_WITH_POOL, Network.Name(), pool.Name());
|
||||
if (IsManagement && !IncludePoolNameInComboBox)
|
||||
return String.Format(Messages.MANAGEMENT_NETWORK, Network.Name);
|
||||
return String.Format(Messages.MANAGEMENT_NETWORK, Network.Name());
|
||||
if (!IsManagement && IncludePoolNameInComboBox)
|
||||
return String.Format(Messages.NETWORK_WITH_POOL, Network.Name, pool.Name);
|
||||
return Network.Name;
|
||||
return String.Format(Messages.NETWORK_WITH_POOL, Network.Name(), pool.Name());
|
||||
return Network.Name();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -125,8 +125,8 @@ namespace XenAdmin.Controls
|
||||
VgpuTypes = vgpuType == null ? null : new[] {vgpuType};
|
||||
if (vgpuType != null)
|
||||
{
|
||||
IsVgpuSubitem = gpuGroup.HasVGpu;
|
||||
IsFractionalVgpu = !vgpuType.IsPassthrough;
|
||||
IsVgpuSubitem = gpuGroup.HasVGpu();
|
||||
IsFractionalVgpu = !vgpuType.IsPassthrough();
|
||||
if (disabledVGpuTypes != null && disabledVGpuTypes.Select(t => t.opaque_ref).Contains(vgpuType.opaque_ref))
|
||||
IsNotEnabledVgpu = true;
|
||||
}
|
||||
@ -154,17 +154,17 @@ namespace XenAdmin.Controls
|
||||
else if (VgpuTypes == null || VgpuTypes.Length == 0 || VgpuTypes[0] == null)
|
||||
{
|
||||
//this refers to an item mapping a GPU with only passthrough type
|
||||
displayName = GpuGroup.Name;
|
||||
displayName = GpuGroup.Name();
|
||||
}
|
||||
else if (IsVgpuSubitem)
|
||||
{
|
||||
//this refers to vGPU type which is a subitem of a GPU group
|
||||
displayName = VgpuTypes[0].Description;
|
||||
displayName = VgpuTypes[0].Description();
|
||||
}
|
||||
else
|
||||
{
|
||||
//this refers to a GPU group head item, which is also non-selectable
|
||||
displayName = GpuGroup.Name;
|
||||
displayName = GpuGroup.Name();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,7 +168,7 @@ namespace XenAdmin.Controls
|
||||
return;
|
||||
}
|
||||
|
||||
VM dom0 = source.ControlDomainZero;
|
||||
VM dom0 = source.ControlDomainZero();
|
||||
if (dom0 == null)
|
||||
{
|
||||
log.Error("No dom0 on host when connecting to host VNC console.");
|
||||
@ -194,7 +194,7 @@ namespace XenAdmin.Controls
|
||||
return false;
|
||||
}
|
||||
|
||||
string roleList = source.IsControlDomainZero ? "http/connect_console/host_console" : "http/connect_console";
|
||||
string roleList = source.IsControlDomainZero() ? "http/connect_console/host_console" : "http/connect_console";
|
||||
List<Role> validRoles = Role.ValidRoleList(roleList, source.Connection);
|
||||
allowedRoles = validRoles;
|
||||
return source.Connection.Session.Roles.Find(r => validRoles.Contains(r)) == null;
|
||||
@ -327,24 +327,24 @@ namespace XenAdmin.Controls
|
||||
Program.AssertOnEventThread();
|
||||
try
|
||||
{
|
||||
log.DebugFormat("ConsolePanel: closeVNCForSource({0}) in delegate", vm.Name);
|
||||
log.DebugFormat("ConsolePanel: closeVNCForSource({0}) in delegate", vm.Name());
|
||||
closeVNCForSource(vm, true);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
log.ErrorFormat("ConsolePanel: Exception closing the VNC console for {0}: {1}",
|
||||
vm.Name, exception.Message);
|
||||
vm.Name(), exception.Message);
|
||||
}
|
||||
|
||||
t.Stop();
|
||||
CloseVNCTimers.Remove(vm);
|
||||
log.DebugFormat(
|
||||
"ConsolePanel: CloseVNCTimer({0}): Timer stopped and removed in delegate",
|
||||
vm.Name);
|
||||
vm.Name());
|
||||
};
|
||||
|
||||
CloseVNCTimers.Add(vm, t);
|
||||
log.DebugFormat("ConsolePanel: CloseVNCTimer({0}): Start timer (timers count {1})", vm.Name, CloseVNCTimers.Count);
|
||||
log.DebugFormat("ConsolePanel: CloseVNCTimer({0}): Start timer (timers count {1})", vm.Name(), CloseVNCTimers.Count);
|
||||
t.Start();
|
||||
}
|
||||
|
||||
@ -357,7 +357,7 @@ namespace XenAdmin.Controls
|
||||
|
||||
CloseVNCTimers[vm].Stop();
|
||||
CloseVNCTimers.Remove(vm);
|
||||
log.DebugFormat("ConsolePanel: StopCloseVncTimer({0}): Timer stopped and removed", vm.Name);
|
||||
log.DebugFormat("ConsolePanel: StopCloseVncTimer({0}): Timer stopped and removed", vm.Name());
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -374,7 +374,7 @@ namespace XenAdmin.Controls
|
||||
return;
|
||||
}
|
||||
|
||||
VM cvm = source.OtherControlDomains.FirstOrDefault();
|
||||
VM cvm = source.OtherControlDomains().FirstOrDefault();
|
||||
if (cvm == null)
|
||||
{
|
||||
log.Error("Could not find CVM console on host.");
|
||||
|
@ -76,7 +76,7 @@ namespace XenAdmin.Controls.CustomDataGraph
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return HelpersGUI.DateTimeToString(Message.TimestampLocal, Messages.DATEFORMAT_DMY_HM, true);
|
||||
return HelpersGUI.DateTimeToString(Message.TimestampLocal(), Messages.DATEFORMAT_DMY_HM, true);
|
||||
}
|
||||
|
||||
public bool Equals(DataEvent other)
|
||||
|
@ -146,7 +146,7 @@ namespace XenAdmin.Controls.GPU
|
||||
|
||||
private void SetWindowTitle()
|
||||
{
|
||||
var name = PGpuList[0].Name;
|
||||
var name = PGpuList[0].Name();
|
||||
Text = PGpuList.Count == 1
|
||||
? String.Format(Messages.GPU_GROUP_NAME_AND_NO_OF_GPUS_ONE, name)
|
||||
: String.Format(Messages.GPU_GROUP_NAME_AND_NO_OF_GPUS, name, PGpuList.Count);
|
||||
@ -211,17 +211,20 @@ namespace XenAdmin.Controls.GPU
|
||||
|
||||
private void SetCells()
|
||||
{
|
||||
bool isPassThru = VGpuType.IsPassthrough;
|
||||
bool isPassThru = VGpuType.IsPassthrough();
|
||||
|
||||
nameColumn.Value = isPassThru ? Messages.VGPU_PASSTHRU_TOSTRING : VGpuType.model_name;
|
||||
|
||||
if (!isPassThru)
|
||||
vGpusPerGpuColumn.Value = VGpuType.Capacity;
|
||||
vGpusPerGpuColumn.Value = VGpuType.Capacity();
|
||||
else
|
||||
vGpusPerGpuColumn.Value = string.Empty;
|
||||
|
||||
if (!isPassThru)
|
||||
maxResolutionColumn.Value = (VGpuType.MaxResolution == "0x0" || String.IsNullOrEmpty(VGpuType.MaxResolution)) ? "" : VGpuType.MaxResolution;
|
||||
{
|
||||
var maxRes = VGpuType.MaxResolution();
|
||||
maxResolutionColumn.Value = maxRes == "0x0" || String.IsNullOrEmpty(maxRes) ? "" : maxRes;
|
||||
}
|
||||
|
||||
if (!isPassThru)
|
||||
maxDisplaysColumn.Value = VGpuType.max_heads < 1 ? "" : String.Format("{0}",VGpuType.max_heads);
|
||||
|
@ -51,9 +51,9 @@ namespace XenAdmin.Controls.GPU
|
||||
: this()
|
||||
{
|
||||
this.xenObject = xenObject;
|
||||
pGpuLabel.Text = pGpuList[0].Name;
|
||||
pGpuLabel.Text = pGpuList[0].Name();
|
||||
RepopulateAllowedTypes(pGpuList[0]);
|
||||
vGpuCapability = !Helpers.FeatureForbidden(xenObject, Host.RestrictVgpu) && pGpuList[0].HasVGpu;
|
||||
vGpuCapability = !Helpers.FeatureForbidden(xenObject, Host.RestrictVgpu) && pGpuList[0].HasVGpu();
|
||||
Rebuild(pGpuList);
|
||||
SetupPage();
|
||||
}
|
||||
@ -88,7 +88,7 @@ namespace XenAdmin.Controls.GPU
|
||||
// add host label if needed
|
||||
if (showingHostLabel && (hostRef == null || pgpu.host.opaque_ref != hostRef.opaque_ref))
|
||||
{
|
||||
AddHostLabel(new Label { Text = String.Format(Messages.GPU_ON_HOST_LABEL, host.Name)}, ref index);
|
||||
AddHostLabel(new Label { Text = String.Format(Messages.GPU_ON_HOST_LABEL, host.Name())}, ref index);
|
||||
hostRef = pgpu.host;
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ namespace XenAdmin.Controls.GPU
|
||||
public void UpdateDetails()
|
||||
{
|
||||
ImageCell.Value = EnabledType ? Resources._000_Tick_h32bit_16 : Resources._000_Abort_h32bit_16;
|
||||
NameCell.Value = VGpuType.Name;
|
||||
NameCell.Value = VGpuType.Name();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ namespace XenAdmin.Controls.GPU
|
||||
vms[vgpu] = vgpu.Connection.Resolve(vgpu.VM);
|
||||
|
||||
maxCapacity = 1;
|
||||
if (!Helpers.FeatureForbidden(pGPU, Host.RestrictVgpu) && pGPU.HasVGpu && pGPU.supported_VGPU_max_capacities != null)
|
||||
if (!Helpers.FeatureForbidden(pGPU, Host.RestrictVgpu) && pGPU.HasVGpu() && pGPU.supported_VGPU_max_capacities != null)
|
||||
{
|
||||
foreach (var n in pGPU.supported_VGPU_max_capacities.Values)
|
||||
{
|
||||
@ -102,7 +102,7 @@ namespace XenAdmin.Controls.GPU
|
||||
{
|
||||
var vGpuType = PGPU.Connection.Resolve(vgpu.type);
|
||||
|
||||
DrawSegment(g, segmentLength, vm.Name, vGpuType != null ? vGpuType.model_name : "",
|
||||
DrawSegment(g, segmentLength, vm.Name(), vGpuType != null ? vGpuType.model_name : "",
|
||||
GpuShinyBarColors.GpuShinyBar_VMs[i++ % GpuShinyBarColors.GpuShinyBar_VMs.Length],
|
||||
ref left);
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ namespace XenAdmin.Controls
|
||||
if(Sr == null)
|
||||
return false;
|
||||
|
||||
return Sr.HBALunPerVDI;
|
||||
return Sr.HBALunPerVDI();
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ namespace XenAdmin.Controls
|
||||
if (Vdi == null)
|
||||
return String.Empty;
|
||||
|
||||
return Vdi.Name;
|
||||
return Vdi.Name();
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ namespace XenAdmin.Controls
|
||||
if (Sr == null)
|
||||
return String.Empty;
|
||||
|
||||
return Sr.Name;
|
||||
return Sr.Name();
|
||||
}
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ namespace XenAdmin.Controls
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return String.Format(Messages.VALUE_HYPHEN_VALUE, Vdi.name_label, Vdi.SizeText);
|
||||
return String.Format(Messages.VALUE_HYPHEN_VALUE, Vdi.name_label, Vdi.SizeText());
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
|
@ -114,7 +114,7 @@ namespace XenAdmin.Controls
|
||||
// remove VBD listeners
|
||||
var vbds = vm.Connection.ResolveAll(VM.VBDs);
|
||||
|
||||
foreach (var vbd in vbds.Where(vbd => vbd.IsCDROM || vbd.IsFloppyDrive))
|
||||
foreach (var vbd in vbds.Where(vbd => vbd.IsCDROM() || vbd.IsFloppyDrive()))
|
||||
{
|
||||
vbd.PropertyChanged -= vbd_PropertyChanged;
|
||||
}
|
||||
@ -148,14 +148,14 @@ namespace XenAdmin.Controls
|
||||
VM.Connection.CachePopulated += new EventHandler<EventArgs>(CachePopulatedMethod);
|
||||
return;
|
||||
}
|
||||
vbds.RemoveAll(delegate(VBD vbd) { return !vbd.IsCDROM && !vbd.IsFloppyDrive; });
|
||||
vbds.RemoveAll(vbd => !vbd.IsCDROM() && !vbd.IsFloppyDrive());
|
||||
vbds.Sort();
|
||||
int dvdCount = 0;
|
||||
int floppyCount = 0;
|
||||
foreach (VBD vbd in vbds)
|
||||
{
|
||||
vbd.PropertyChanged +=new PropertyChangedEventHandler(vbd_PropertyChanged);
|
||||
if (vbd.IsCDROM)
|
||||
if (vbd.IsCDROM())
|
||||
{
|
||||
dvdCount++;
|
||||
VbdCombiItem i = new VbdCombiItem();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user