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


C# XenAPI.Session类代码示例

本文整理汇总了C#中XenAPI.Session的典型用法代码示例。如果您正苦于以下问题:C# Session类的具体用法?C# Session怎么用?C# Session使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Session类属于XenAPI命名空间,在下文中一共展示了Session类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: create_new_blob

        /// <summary>
        /// Backward compatibility for SR.create_new_blob in XenServer 6.0.
        /// </summary>
        public static XenRef<Blob> create_new_blob(Session session, string _sr, string _name, string _mime_type)
        {
            if (Helper.APIVersionMeets(session, API_Version.API_1_10))
                System.Diagnostics.Debug.Assert(false, "Cannot use this call on XenServer 6.1 or newer.");

            return XenRef<Blob>.Create(session.proxy.sr_create_new_blob(session.uuid, (_sr != null) ? _sr : "", (_name != null) ? _name : "", (_mime_type != null) ? _mime_type : "").parse());
        }
开发者ID:ordenull,项目名称:skinnybox,代码行数:10,代码来源:SR2.cs

示例2: create

        // Backward compatibility for Bond.create in XenServer 6.0.
        public static XenRef<Bond> create(Session session, string _network, List<XenRef<PIF>> _members, string _mac, bond_mode _mode)
        {
            if (Helper.APIVersionMeets(session, API_Version.API_1_10))
                System.Diagnostics.Debug.Assert(false, "Cannot use this call on XenServer 6.1 or newer.");

            return XenRef<Bond>.Create(session.proxy.bond_create(session.uuid, (_network != null) ? _network : "", (_members != null) ? Helper.RefListToStringArray(_members) : new string[] { }, (_mac != null) ? _mac : "", bond_mode_helper.ToString(_mode)).parse());
        }
开发者ID:ordenull,项目名称:skinnybox,代码行数:8,代码来源:Bond2.cs

示例3: introduce

        /// <summary>
        /// Backward compatibility for VDI.introduce in XenServer 6.0.
        /// </summary>
        public static XenRef<VDI> introduce(Session session, string _uuid, string _name_label, string _name_description, string _sr, vdi_type _type, bool _sharable, bool _read_only, Dictionary<string, string> _other_config, string _location, Dictionary<string, string> _xenstore_data, Dictionary<string, string> _sm_config)
        {
            if (Helper.APIVersionMeets(session, API_Version.API_1_10))
                System.Diagnostics.Debug.Assert(false, "Cannot use this call on XenServer 6.1 or newer.");

            return XenRef<VDI>.Create(session.proxy.vdi_introduce(session.uuid, (_uuid != null) ? _uuid : "", (_name_label != null) ? _name_label : "", (_name_description != null) ? _name_description : "", (_sr != null) ? _sr : "", vdi_type_helper.ToString(_type), _sharable, _read_only, Maps.convert_to_proxy_string_string(_other_config), (_location != null) ? _location : "", Maps.convert_to_proxy_string_string(_xenstore_data), Maps.convert_to_proxy_string_string(_sm_config)).parse());
        }
开发者ID:ordenull,项目名称:skinnybox,代码行数:10,代码来源:VDI2.cs

示例4: RunWithSession

        protected override void RunWithSession(ref Session session)
        {
            List<VM> vmObjs = new List<VM>();
            foreach (XenRef<VM> vm in _vms)
                vmObjs.Add(TryResolveWithTimeout(vm));

            PBD.CheckAndPlugPBDsFor(vmObjs);

            int vmCount = _vms.Count;
            int i = 0;

            foreach (VM vm in vmObjs)
            {
                XenRef<Task> task = DoPerVM(session, vm);

                try
                {
                    PollTaskForResult(Connection, ref session, task, delegate(int progress)
                                                                                                 {
                                                                                                     PercentComplete = (progress / vmCount) + ((100 * i) / vmCount);
                                                                                                 });

                    i++;
                }
                finally
                {
                    Task.destroy(session, task);
                }
            }
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:30,代码来源:VMsPlanAction.cs

示例5: SetSecretInfo

        public static void SetSecretInfo(Session session, Dictionary<string, string> config, string infoKey, string infoValue)
        {
            if (string.IsNullOrEmpty(infoKey))
                return;

            if (infoValue == null)
            {
                if (config.ContainsKey(infoKey))
                {
                    TryToDestroySecret(session, config[infoKey]);
                    config.Remove(infoKey);
                }
            }
            else if (config.ContainsKey(infoKey))
            {
                try
                {
                    string secretRef = Secret.get_by_uuid(session, config[infoKey]);
                    Secret.set_value(session, secretRef, infoValue);
                }
                catch (Failure)
                {
                    config[infoKey] = Secret.CreateSecret(session, infoValue);
                }
                catch (WebException)
                {
                    config[infoKey] = Secret.CreateSecret(session, infoValue);
                }
            }
            else
            {
                config[infoKey] = Secret.CreateSecret(session, infoValue);
            }
        }
开发者ID:robhoes,项目名称:xenadmin,代码行数:34,代码来源:SaveHealthCheckSettingsAction.cs

示例6: CreateSession

 public static Session CreateSession(Session session, IXenConnection connection, int timeout)
 {
     if (Helpers.DbProxyIsSimulatorUrl(session.Url))
         return new Session(session, DbProxy.GetProxy(connection, session.Url), connection);
     else
         return new Session(session, connection, timeout);
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:7,代码来源:SessionFactory.cs

示例7: UserDetails

 /// <summary>
 /// Makes server calls, call off the event thread.
 /// </summary>
 /// <param name="session"></param>
 /// <param name="SID"></param>
 private UserDetails(Session session)
 {
     userSid = session.UserSid;
     userDisplayName = GetDisplayName(session);
     userName = GetName(session);
     GetGroupMembership(session);
 }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:12,代码来源:UserDetails.cs

示例8: Main

        public static void Main(string[] args)
        {
            if (args.Length < 3)
            {
                System.Console.WriteLine("Required arguments: host-ip username password\n");
                return;
            }

            // Host information necessary to get started
            string hostname = args[0];
            int port = 80; // default
            string username = args[1];
            string password = args[2];

            // Establish a session
            Session session = new Session(hostname, port);

            // Authenticate with username and password. The third parameter tells the server which API version we support.
            session.login_with_password(username, password, API_Version.API_1_3);

            List<XenRef<VM>> vmRefs = VM.get_all(session);
            foreach (XenRef<VM> vmRef in vmRefs)
            {
                VM vm = VM.get_record(session, vmRef);
                System.Console.WriteLine("Name: {0}\nvCPUs: {1}\nDescription: {2}\n-", vm.name_label, vm.VCPUs_at_startup, vm.name_description);
            }
        }
开发者ID:jonludlam,项目名称:xen-api-sdk,代码行数:27,代码来源:Program.cs

示例9: RunWithSession

 protected override void RunWithSession(ref Session session)
 {
     base.WaitForAgent(ref session, delegate(Session _session)
                                        {
                                            XenAPI.Host.async_restart_agent(_session, Host.opaque_ref);
                                        });
 }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:7,代码来源:RestartAgentPlanAction.cs

示例10: RunWithSession

        protected override void RunWithSession(ref Session session)
        {
            var master = Helpers.GetMaster(host.Connection);
            var mapping = mappings.Find(m => m.XenServerPatch.Equals(xenServerPatch)
                                             && m.MasterHost != null && master != null && m.MasterHost.uuid == master.uuid);

            if (mapping != null && (mapping.Pool_patch != null || mapping.Pool_update != null))
            {
                XenRef<Task> task = null;

                if (mapping.Pool_patch != null)
                {
                    task = Pool_patch.async_apply(session, mapping.Pool_patch.opaque_ref, host.opaque_ref);
                }
                else
                {
                    task = Pool_update.async_apply(session, mapping.Pool_update.opaque_ref, host.opaque_ref);
                }

                PollTaskForResultAndDestroy(Connection, ref session, task);
            }
            else
            {
                if (xenServerPatch != null && master != null)
                    log.ErrorFormat("Mapping not found for patch {0} on master {1}", xenServerPatch.Uuid, master.uuid);

                throw new Exception("Pool_patch or Pool_update not found.");
            }
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:29,代码来源:ApplyXenServerPatchPlanAction.cs

示例11: RoleElevationDialog

        /// <summary>
        /// Displays a dialog informing the user they need a different role to complete the task, and offers the chance to switch user. Optionally logs 
        /// out the elevated session. If successful exposes the elevated session, password and username as fields.
        /// </summary>
        /// <param name="connection">The current server connection with the role information</param>
        /// <param name="session">The session on which we have been denied access</param>
        /// <param name="authorizedRoles">A list of roles that are able to complete the task</param>
        /// <param name="actionTitle">A description of the current action, if null or empty will not be displayed</param>
        public RoleElevationDialog(IXenConnection connection, Session session, List<Role> authorizedRoles, string actionTitle)
        {
            InitializeComponent();
            Image icon = SystemIcons.Exclamation.ToBitmap();
            pictureBox1.Image = icon;
            pictureBox1.Width = icon.Width;
            pictureBox1.Height = icon.Height;
            this.connection = connection;
            UserDetails ud = session.CurrentUserDetails;
            labelCurrentUserValue.Text = ud.UserDisplayName ?? ud.UserName ?? Messages.UNKNOWN_AD_USER;
            labelCurrentRoleValue.Text = Role.FriendlyCSVRoleList(session.Roles);
            authorizedRoles.Sort((r1, r2) => r2.CompareTo(r1));
            labelRequiredRoleValue.Text = Role.FriendlyCSVRoleList(authorizedRoles);
            labelServerValue.Text = Helpers.GetName(connection);
            labelServer.Text = Helpers.IsPool(connection) ? Messages.POOL_COLON : Messages.SERVER_COLON;
            originalUsername = session.Connection.Username;
            originalPassword = session.Connection.Password;

            if (string.IsNullOrEmpty(actionTitle))
            {
                labelCurrentAction.Visible = false;
                labelCurrentActionValue.Visible = false;
            }
            else
            {
                labelCurrentActionValue.Text = actionTitle;
            }

            this.authorizedRoles = authorizedRoles;
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:38,代码来源:RoleElevationDialog.cs

示例12: db_introduce

        /// <summary>
        /// Backward compatibility for PIF.db_introduce in XenServer 6.0.
        /// </summary>
        public static XenRef<PIF> db_introduce(Session session, string _device, string _network, string _host, string _mac, long _mtu, long _vlan, bool _physical, ip_configuration_mode _ip_configuration_mode, string _ip, string _netmask, string _gateway, string _dns, string _bond_slave_of, string _vlan_master_of, bool _management, Dictionary<string, string> _other_config, bool _disallow_unplug)
        {
            if (Helper.APIVersionMeets(session, API_Version.API_1_10))
                System.Diagnostics.Debug.Assert(false, "Cannot use this call on XenServer 6.1 or newer.");

            return XenRef<PIF>.Create(session.proxy.pif_db_introduce(session.uuid, (_device != null) ? _device : "", (_network != null) ? _network : "", (_host != null) ? _host : "", (_mac != null) ? _mac : "", _mtu.ToString(), _vlan.ToString(), _physical, ip_configuration_mode_helper.ToString(_ip_configuration_mode), (_ip != null) ? _ip : "", (_netmask != null) ? _netmask : "", (_gateway != null) ? _gateway : "", (_dns != null) ? _dns : "", (_bond_slave_of != null) ? _bond_slave_of : "", (_vlan_master_of != null) ? _vlan_master_of : "", _management, Maps.convert_to_proxy_string_string(_other_config), _disallow_unplug).parse());
        }
开发者ID:ordenull,项目名称:skinnybox,代码行数:10,代码来源:PIF2.cs

示例13: RunWithSession

        protected override void RunWithSession(ref Session session)
        {

            XenRef<Task> task = Pool_patch.async_pool_clean(session, _patchRef.opaque_ref);

            PollTaskForResultAndDestroy(Connection, ref session, task);
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:7,代码来源:RemoveUpdateFile.cs

示例14: RunWithSession

        protected override void RunWithSession(ref Session session)
        {
            this.visible = false;

            lock (patch)
            {
                this.visible = true;
                this._title = string.Format(Messages.PATCHINGWIZARD_DOWNLOADUPDATE_ACTION_TITLE_DOWNLOADING, patch.Name);

                if (Cancelling)
                    return;

                //if it has not been already downloaded
                if (!AllDownloadedPatches.Any(dp => dp.Key == patch && !string.IsNullOrEmpty(dp.Value))
                    || !File.Exists(AllDownloadedPatches[patch]))
                {
                    DownloadFile(ref session);
                }
                else
                {
                    this.visible = false;
                    this._title = string.Format(Messages.PATCHINGWIZARD_DOWNLOADUPDATE_ACTION_TITLE_SKIPPING, patch.Name);
                }
            }
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:25,代码来源:DownloadPatchPlanAction.cs

示例15: WlbRecommendations

        /// <summary>
        /// Initializes a new instance of the <see cref="WlbRecommendations"/> class.
        /// </summary>
        /// <param name="vms">The VMs that the recommendations are required for.</param>
        /// <param name="session">The session.</param>
        public WlbRecommendations(IEnumerable<VM> vms, Session session)
        {
            Util.ThrowIfEnumerableParameterNullOrEmpty(vms, "vms");
            Util.ThrowIfParameterNull(session, "session");

            _vms = new ReadOnlyCollection<VM>(new List<VM>(vms));
            _session = session;
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:13,代码来源:WlbRecommendations.cs


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