本文整理汇总了C#中XenAPI类的典型用法代码示例。如果您正苦于以下问题:C# XenAPI类的具体用法?C# XenAPI怎么用?C# XenAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XenAPI类属于命名空间,在下文中一共展示了XenAPI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MessageAlert
public MessageAlert(XenAPI.Message m)
{
Message = m;
uuid = m.uuid;
_timestamp = m.timestamp;
try
{
_priority = (int)m.priority;
}
catch (OverflowException)
{
_priority = DEFAULT_PRIORITY;
}
Connection = m.Connection;
XenObject = Helpers.XenObjectFromMessage(m);
// TODO: This would be better if there was some way of getting the actual host that the XenObject belongs to
// Currently if the applies to object is not a host or pool and belongs to a slave it is filtered under the master.
Host h = XenObject as Host;
if (h == null)
h = Helpers.GetMaster(m.Connection);
if (h != null)
HostUuid = h.uuid;
}
示例2: CreateChinAction
public CreateChinAction(IXenConnection connection, XenAPI.Network newNetwork, XenAPI.Network theInterface)
: base(connection,
string.Format(Messages.NETWORK_ACTION_CREATING_NETWORK_TITLE, newNetwork.Name, Helpers.GetName(connection)))
{
this.newNetwork = newNetwork;
this.theInterface = theInterface;
}
示例3: DestroyPoolAction
public DestroyPoolAction(XenAPI.Pool pool)
: base(pool.Connection, string.Format(Messages.DESTROYING_POOL, pool.Name))
{
System.Diagnostics.Trace.Assert(pool != null);
Pool = pool;
this.Description = Messages.WAITING;
}
示例4: UnplugPlugNetworkAction
public UnplugPlugNetworkAction(XenAPI.Network network, bool suppressHistory)
: base(network.Connection, Messages.ACTION_PIF_UNPLUG_PLUG_TITLE, Messages.ACTION_PIF_UNPLUG_PLUG_DESC, suppressHistory)
{
PIFs = Connection.ResolveAll<PIF>(network.PIFs);
PIFs.RemoveAll(delegate(PIF p) { return !p.currently_attached; });
VIFs = Connection.ResolveAll<VIF>(network.VIFs);
VIFs.RemoveAll(delegate(VIF v)
{
if (!v.currently_attached)
return true;
VM vm = v.Connection.Resolve(v.VM);
if (vm == null || vm.power_state != vm_power_state.Running) // we only replug running VMs
return true;
return false;
});
network.Locked = true;
foreach (PIF p in PIFs)
p.Locked = true;
foreach (VIF v in VIFs)
v.Locked = true;
#region RBAC
ApiMethodsToRoleCheck.Add("pif.async_unplug");
ApiMethodsToRoleCheck.Add("pif.async_plug");
ApiMethodsToRoleCheck.Add("vif.async_plug");
ApiMethodsToRoleCheck.Add("vif.async_unplug");
#endregion
Pool = Helpers.GetPool(Connection);
this.network = network;
}
示例5: IscsiChoicesDialog
public IscsiChoicesDialog(IXenConnection connection, XenAPI.SR.SRInfo srInfo)
: base(connection)
{
InitializeComponent();
this.labelSRinfo.Text = String.Format(Messages.ISCSI_DIALOG_SR_DETAILS,
Util.DiskSizeString(srInfo.Size), srInfo.UUID);
}
示例6: HostPowerOnAction
public HostPowerOnAction(XenAPI.Host host)
: base(host.Connection, Messages.HOST_POWER_ON)
{
Host = host;
AddCommonAPIMethodsToRoleCheck();
ApiMethodsToRoleCheck.Add("pool.send_wlb_configuration");
ApiMethodsToRoleCheck.Add("host.power_on");
}
示例7: NetworkListViewItem
public NetworkListViewItem(IXenConnection connection, XenAPI.Network network, int index)
{
Vif = new VIF();
Vif.Connection = connection;
Vif.device = index.ToString();
Vif.network = new XenRef<XenAPI.Network>(network.opaque_ref);
CreateCells();
}
示例8: ChangeServerPasswordDialog
public ChangeServerPasswordDialog(XenAPI.Pool pool)
{
InitializeComponent();
this.pool = pool;
pool.PropertyChanged += new PropertyChangedEventHandler(Server_PropertyChanged);
UpdateText();
checkConfirmEnablement();
}
示例9: VMCrossPoolMigrateAction
public VMCrossPoolMigrateAction(VM vm, Host destinationHost, XenAPI.Network transferNetwork, VmMapping mapping)
: base(vm.Connection, GetTitle(vm, destinationHost))
{
Session = vm.Connection.Session;
Description = Messages.ACTION_PREPARING;
VM = vm;
Host = destinationHost;
Pool = Helpers.GetPool(vm.Connection);
this.mapping = mapping;
this.transferNetwork = transferNetwork;
}
示例10: MoveVirtualDiskAction
public MoveVirtualDiskAction(IXenConnection connection, XenAPI.VDI vdi, SR sr)
: base(connection, string.Format(Messages.ACTION_MOVING_VDI_TITLE, Helpers.GetName(vdi), Helpers.GetName(sr)))
{
this.vdi = vdi;
SR = sr;
vdi.Locked = true;
sr.Locked = true;
ApiMethodsToRoleCheck.Add("vdi.destroy");
ApiMethodsToRoleCheck.Add("vdi.copy");
if (vdi.type == vdi_type.suspend)
ApiMethodsToRoleCheck.Add("vm.set_suspend_VDI");
ApiMethodsToRoleCheck.AddRange(Role.CommonTaskApiList);
ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList);
}
示例11: VbdSaveAndPlugAction
public VbdSaveAndPlugAction(VM vm, XenAPI.VBD vbd, string vdiName, XenAPI.Session session, bool supress, Action showMustRebootBoxCD, Action showVBDWarningBox)
: base(vm.Connection, string.Format(Messages.ATTACHING_VIRTUAL_DISK, vdiName, vm.Name), "", supress)
{
_ShowVBDWarningBox = showVBDWarningBox;
_ShowMustRebootBoxCD = showMustRebootBoxCD;
VM = vm;
this.vbd = vbd;
// Preserve existing session if provided.
if (session != null)
this.Session = session;
ApiMethodsToRoleCheck.Add("vbd.async_plug");
ApiMethodsToRoleCheck.Add("vbd.set_userdevice");
}
示例12: NetworkAction
/// <summary>
/// Create an external (VLAN) network.
/// </summary>
/// <param name="network">A new Network instance describing the changes to be made on the server side.</param>
/// <param name="pif">The PIF representing the physical NIC from which we're basing our new VLAN.</param>
/// <param name="vlan">The new VLAN tag.</param>
public NetworkAction(IXenConnection connection, XenAPI.Network network, PIF pif, long vlan)
: base(connection, string.Format(Messages.NETWORK_ACTION_CREATING_NETWORK_TITLE, network.Name,
Helpers.GetName(connection)))
{
actionType = network_actions.create;
this.networkClone = network;
this.pif = pif;
this.vlan = vlan;
this.external = true;
this.PIFs = null;
#region RBAC Dependencies
ApiMethodsToRoleCheck.Add("network.create");
ApiMethodsToRoleCheck.Add("pool.create_VLAN_from_PIF");
#endregion
init();
}
示例13: GetImage16For
public static Image GetImage16For(XenAPI.Message.MessageType type)
{
return GetImage16For(GetIconFor(type));
}
示例14: GetIconFor
public static Icons GetIconFor(XenAPI.Message.MessageType type)
{
switch (type)
{
case XenAPI.Message.MessageType.VM_STARTED:
return Icons.VmStart;
case XenAPI.Message.MessageType.VM_SHUTDOWN:
return Icons.VmShutdown;
case XenAPI.Message.MessageType.VM_REBOOTED:
return Icons.VmReboot;
case XenAPI.Message.MessageType.VM_SUSPENDED:
return Icons.VmSuspend;
case XenAPI.Message.MessageType.VM_RESUMED:
return Icons.VmResumed;
case XenAPI.Message.MessageType.VM_CLONED:
return Icons.VmCloned;
default:
return Icons.MessageUnknown;
}
}
示例15: VMCannotSeeNetwork
public VMCannotSeeNetwork(Check check, VM vm, XenAPI.Network network)
: base(check, vm)
{
Network = network;
}