本文整理汇总了C#中XenAPI.Host类的典型用法代码示例。如果您正苦于以下问题:C# Host类的具体用法?C# Host怎么用?C# Host使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Host类属于XenAPI命名空间,在下文中一共展示了Host类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssignLicenseDialog
/// <summary>
/// Initializes a new instance of the <see cref="AssignLicenseDialog"/> class.
/// </summary>
/// <param name="hosts">The hosts for which the licensing is to be applied.</param>
public AssignLicenseDialog(IEnumerable<IXenObject> xos, String firstHost, String firstPort, Host.Edition firstEdition)
{
Util.ThrowIfEnumerableParameterNullOrEmpty(xos, "XenObjects");
this.xos = new List<IXenObject>(xos);
this.currentEdition = firstEdition;
InitializeComponent();
licenseServerNameTextBox.TextChanged += licenseServerPortTextBox_TextChanged;
licenseServerPortTextBox.TextChanged += licenseServerNameTextBox_TextChanged;
SetOptionsForClearwaterAndNewer();
UpdateButtonEnablement();
// if all the hosts have the same license server details then populate the textboxes.
List<Host> hosts = CreateHostsList();
if (hosts[0].license_server.ContainsKey("address") && hosts[0].license_server.ContainsKey("port") &&
hosts[0].license_server["address"] != "localhost")
{
if (hosts.TrueForAll(delegate(Host h)
{
return h.license_server.ContainsKey("address") &&
h.license_server.ContainsKey("port") &&
h.license_server["address"] == hosts[0].license_server["address"] &&
h.license_server["port"] == hosts[0].license_server["port"];
}))
{
licenseServerPortTextBox.Text = hosts[0].license_server["port"];
licenseServerNameTextBox.Text = hosts[0].license_server["address"];
}
}
else if ((!String.IsNullOrEmpty(firstHost)) && (!String.IsNullOrEmpty(firstPort)))
{
licenseServerPortTextBox.Text = firstPort;
licenseServerNameTextBox.Text = firstHost;
}
}
示例2: SrProbeAction
/// <summary>
/// Won't appear in the program history (SuppressHistory == true).
/// </summary>
/// <param name="masterUuid">The UUID of the host from which to perform the probe (usually the pool master).</param>
/// <param name="srType">netapp or iscsi</param>
public SrProbeAction(IXenConnection connection, Host host, SR.SRTypes srType, Dictionary<String, String> dconf)
: base(connection, string.Format(Messages.ACTION_SCANNING_SR_FROM, Helpers.GetName(connection)), null, true)
{
this.host = host;
this.srType = srType;
this.dconf = dconf;
switch (srType) {
case XenAPI.SR.SRTypes.nfs:
Description = string.Format(Messages.ACTION_SR_SCANNING,
XenAPI.SR.getFriendlyTypeName(srType), dconf["server"]);
break;
case XenAPI.SR.SRTypes.lvmoiscsi:
Description = string.Format(Messages.ACTION_SR_SCANNING,
XenAPI.SR.getFriendlyTypeName(srType), dconf["target"]);
break;
case XenAPI.SR.SRTypes.lvmohba:
String device = dconf.ContainsKey(DEVICE) ?
dconf[DEVICE] : dconf[SCSIid];
Description = string.Format(Messages.ACTION_SR_SCANNING,
XenAPI.SR.getFriendlyTypeName(srType), device);
break;
default:
Description = string.Format(Messages.ACTION_SR_SCANNING,
XenAPI.SR.getFriendlyTypeName(srType), Messages.REPAIRSR_SERVER); // this is a bit minging: CA-22111
break;
}
smconf = new Dictionary<string, string>();
}
示例3: CrossPoolMigrateWizard
public CrossPoolMigrateWizard(IXenConnection con, IEnumerable<SelectedItem> selection, Host targetHostPreSelection)
: base(con)
{
InitializeComponent();
hostPreSelection = targetHostPreSelection;
InitialiseWizard(selection);
}
示例4: EvacuateHostPlanAction
public EvacuateHostPlanAction(Host host)
: base(host.Connection, string.Format(Messages.PLANACTION_VMS_MIGRATING, host.Name))
{
base.TitlePlan = string.Format(Messages.MIGRATE_VMS_OFF_SERVER, host.Name);
this._host = new XenRef<Host>(host);
currentHost = host;
}
示例5: ChangeNetworkingAction
/// <summary>
///
/// </summary>
/// <param name="connection"></param>
/// <param name="pool">May be null, in which case we're acting on a single host basis.</param>
/// <param name="host">If pool is set, then host should be the pool master.</param>
/// <param name="newPIFs">New PIF instances that are to be created on the server.</param>
/// <param name="downPIFs"></param>
/// <param name="newManagement">May be null, in which case the management network will not be disturbed.
/// Note that it is still possible for the management interface to receive a new IP address even if this
/// parameter is null, because it may be in newPIFs. You only need to use this parameter if the management
/// interface is switching onto a different PIF.</param>
/// <param name="downManagement">May be null iff newManagement is null.</param>
public ChangeNetworkingAction(IXenConnection connection, Pool pool, Host host, List<PIF> newPIFs, List<PIF> downPIFs,
PIF newManagement, PIF downManagement, bool managementIPChanged)
: base(connection, Messages.ACTION_CHANGE_NETWORKING_TITLE)
{
Pool = pool;
Host = host;
this.newPIFs = newPIFs;
this.downPIFs = downPIFs;
this.newManagement = newManagement;
this.downManagement = downManagement;
this.managementIPChanged = managementIPChanged;
if (pool != null)
{
// If we're going to compute address ranges, then we need a sorted list of hosts (to keep the addresses stable).
Hosts = Connection.Cache.Hosts;
Array.Sort(Hosts);
foreach (Host h in Hosts)
{
AppliesTo.Add(h.opaque_ref);
}
}
#region RBAC Dependencies
ApiMethodsToRoleCheck.Add("vm.set_memory_limits");
ApiMethodsToRoleCheck.Add("host.management_reconfigure");
ApiMethodsToRoleCheck.Add("pif.reconfigure_ip");
ApiMethodsToRoleCheck.Add("pif.plug");
ApiMethodsToRoleCheck.AddRange(XenAPI.Role.CommonSessionApiList);
ApiMethodsToRoleCheck.AddRange(XenAPI.Role.CommonTaskApiList);
#endregion
}
示例6: NewNetworkWizard
/// <summary>
///
/// </summary>
/// <param name="connection"></param>
/// <param name="pool">May be null.</param>
/// <param name="host">Never null. In the case of a pool, "host" is set to the master.</param>
public NewNetworkWizard(Network.IXenConnection connection, Pool pool, Host host)
: base(connection)
{
InitializeComponent();
pageNetworkType = new NetWTypeSelect();
pageName = new NetWName();
pageNetworkDetails = new NetWDetails();
pageBondDetails = new NetWBondDetails();
pageChinDetails = new NetWChinDetails();
System.Diagnostics.Trace.Assert(host != null);
Pool = pool;
Host = host;
if (Pool != null)
pageBondDetails.SetPool(Pool);
else
pageBondDetails.SetHost(Host);
pageNetworkDetails.Host = host;
pageChinDetails.Host = host;
pageChinDetails.Pool = pool;
AddPage(pageNetworkType);
AddPage(new XenTabPage { Text = "" });
}
示例7: CanExecute
public static new bool CanExecute(VM vm, Host preSelectedHost)
{
if (vm == null || !vm.is_a_template || vm.DefaultTemplate || vm.Locked)
return false;
return CrossPoolMigrateCommand.CanExecute(vm, preSelectedHost);
}
示例8: CanActivate
public static bool CanActivate(Host host)
{
//This check used to be "_expiresText != Messages.LICENSE_NEVER" but I've swapped it for
//"!host.isOEM" according to the ticket CA-37336 where this 3rd part of the check was added
//OEM licenses (< XS ver 5.5) have perpetual (2036) expiry dates
return host.IsFreeLicense() && host.IsFloodgateOrLater() && !host.isOEM && !Helpers.ClearwaterOrGreater(host);
}
示例9: IqnAlert
protected IqnAlert(Host host)
{
Host = host;
HostUuid = host.uuid;
_timestamp = DateTime.UtcNow;
Connection = host.Connection;
}
示例10: ImportVmAction
public ImportVmAction(IXenConnection connection, Host affinity, string filename, SR sr)
: base(connection, string.Format(Messages.IMPORTVM_TITLE, filename, Helpers.GetName(connection)), Messages.IMPORTVM_PREP)
{
Pool = Helpers.GetPoolOfOne(connection);
m_affinity = affinity;
Host = affinity ?? connection.Resolve(Pool.master);
SR = sr;
VM = null;
m_filename = filename;
#region RBAC Dependencies
ApiMethodsToRoleCheck.AddRange(ConstantRBACRequirements);
if (affinity != null)
ApiMethodsToRoleCheck.Add("vm.set_affinity");
//??
//if (startAutomatically)
// ApiMethodsToRoleCheck.Add("vm.start");
ApiMethodsToRoleCheck.AddRange(Role.CommonTaskApiList);
ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList);
#endregion
}
示例11: CopyPatchFromHostToOther
public CopyPatchFromHostToOther(IXenConnection connection, Host hostDestiny, Pool_patch patchToCopy)
: base(connection, Messages.UPLOADING_PATCH, true)
{
_hostDestiny = hostDestiny;
_patchToCopy = patchToCopy;
Host = _hostDestiny;
}
示例12: ApplyLicenseAction
public ApplyLicenseAction(Network.IXenConnection connection, Host host, string filepath, bool activateFreeLicense)
: base(connection, string.Format(Messages.APPLYLICENSE_TITLE, host.Name), Messages.APPLYLICENSE_PREP)
{
this.Host = host;
this.Filepath = filepath;
this.ActivateFreeLicense = activateFreeLicense;
}
示例13: IsHostLicenseRestricted
private bool IsHostLicenseRestricted(Host host)
{
if(host == null)
return false;
return !host.CanApplyHotfixes;
}
示例14: EjectHostFromPoolAction
public EjectHostFromPoolAction(Pool pool,Host hostToEject)
: base(pool.Connection, string.Format(Messages.REMOVING_SERVER_FROM_POOL, hostToEject.Name, pool.Name))
{
this.Pool = pool;
this.Host = hostToEject;
this.Description = Messages.WAITING;
}
示例15: CanExecute
private bool CanExecute(Host host)
{
if (host == null)
return false;
return true;
}