当前位置: 首页>>代码示例>>C#>>正文


C# XenAPI类代码示例

本文整理汇总了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;
        }
开发者ID:haxard,项目名称:xenadmin,代码行数:26,代码来源:MessageAlert.cs

示例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;
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:7,代码来源:CreateChinAction.cs

示例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;
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:7,代码来源:DestroyPoolAction.cs

示例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;
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:32,代码来源:UnplugPlugNetworkAction.cs

示例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);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:8,代码来源:IscsiChoicesDialog.cs

示例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");
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:9,代码来源:HostPowerOnAction.cs

示例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();
        }
开发者ID:vtsingaras,项目名称:xenadmin,代码行数:10,代码来源:Page_Networking.cs

示例8: ChangeServerPasswordDialog

        public ChangeServerPasswordDialog(XenAPI.Pool pool)
        {
            InitializeComponent();

            this.pool = pool;

            pool.PropertyChanged += new PropertyChangedEventHandler(Server_PropertyChanged);

            UpdateText();
            checkConfirmEnablement();
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:11,代码来源:ChangeServerPasswordDialog.cs

示例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;
 }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:11,代码来源:VMCrossPoolMigrateAction.cs

示例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);
 }
开发者ID:robhoes,项目名称:xenadmin,代码行数:14,代码来源:MoveVirtualDiskAction.cs

示例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");
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:14,代码来源:VbdSaveAndPlugAction.cs

示例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();
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:24,代码来源:NetworkAction.cs

示例13: GetImage16For

 public static Image GetImage16For(XenAPI.Message.MessageType type)
 {
     return GetImage16For(GetIconFor(type));
 }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:4,代码来源:Images.cs

示例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;
            }
        }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:26,代码来源:Images.cs

示例15: VMCannotSeeNetwork

 public VMCannotSeeNetwork(Check check,  VM vm, XenAPI.Network network)
     : base(check,  vm)
 {
     Network = network;
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:5,代码来源:VMCannotSeeNetwork.cs


注:本文中的XenAPI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。