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


C# IXenConnection类代码示例

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


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

示例1: ExportApplianceWizard

		public ExportApplianceWizard(IXenConnection con, SelectedItemCollection selection)
			: base(con)
		{
			InitializeComponent();

		    m_pageExportAppliance = new ExportAppliancePage();
            m_pageRbac = new RBACWarningPage();
		    m_pageExportSelectVMs = new ExportSelectVMsPage();
            m_pageExportEula = new ExportEulaPage();
		    m_pageExportOptions = new ExportOptionsPage();
		    m_pageTvmIp = new TvmIpPage();
            m_pageFinish = new ExportFinishPage();

			m_selectedObject = selection.FirstAsXenObject;

			if (selection.Count == 1 && (m_selectedObject is VM || m_selectedObject is VM_appliance))
				m_pageExportAppliance.ApplianceFileName = m_selectedObject.Name;

			m_pageExportAppliance.OvfModeOnly = m_selectedObject is VM_appliance;
			m_pageTvmIp.IsExportMode = true;
			m_pageFinish.SummaryRetreiver = GetSummary;
			m_pageExportSelectVMs.SelectedItems = selection;

            AddPages(m_pageExportAppliance, m_pageExportSelectVMs, m_pageFinish);
		}
开发者ID:huizh,项目名称:xenadmin,代码行数:25,代码来源:ExportApplianceWizard.cs

示例2: UploadPatchAction

        /// <summary>
        /// This constructor is used to upload a single 'normal' patch
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="path"></param>
        public UploadPatchAction(IXenConnection connection, string path)
            : base(connection, null, Messages.UPLOADING_PATCH)
        {
            Host master = Helpers.GetMaster(connection);
            if (master == null)
                throw new NullReferenceException();

            ApiMethodsToRoleCheck.Add("pool.sync_database");
            ApiMethodsToRoleCheck.Add("http/put_oem_patch_stream");
            ApiMethodsToRoleCheck.Add("http/put_pool_patch_upload");

            if (master.isOEM)
            {
                embeddedHosts = new List<Host>(connection.Cache.Hosts);
                embeddedPatchPath = path;

                retailHosts = new List<Host>();
                retailPatchPath = string.Empty;
            }
            else
            {

                retailHosts = new List<Host>(new Host[] { master });
                retailPatchPath = path;

                embeddedHosts = new List<Host>();
                embeddedPatchPath = string.Empty;

            }

            Host = master;
        }
开发者ID:ChrisH4rding,项目名称:xenadmin,代码行数:37,代码来源:UploadPatchAction.cs

示例3: PopulateComboBox

        public void PopulateComboBox(IXenConnection connection)
        {
            PopulateConnection = connection;
            Items.Clear();

            var pifArray = connection.Cache.PIFs;

            foreach (var pif in pifArray)
            {
                var curPif = pif;
                var count = (from NetworkComboBoxItem existingItem in Items
                             where existingItem.Network.opaque_ref == curPif.network.opaque_ref
                             select existingItem).Count();
                if (count > 0)
                    continue;

                
                var item = CreateNewItem(pif);

                AddItemToComboBox(item);

                if (item.IsManagement)
                {
                    SelectedItem = item;
                }
                    
            }
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:28,代码来源:NetworkComboBox.cs

示例4: CreateSession

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

示例5: PatchPrechecksOnMultipleHostsInAPoolPlanAction

 public PatchPrechecksOnMultipleHostsInAPoolPlanAction(IXenConnection connection, XenServerPatch patch, List<Host> hosts, List<PoolPatchMapping> mappings)
     : base(connection, string.Format("Precheck for {0} in {1}...", patch.Name, connection.Name))
 {
     this.patch = patch;
     this.hosts = hosts;
     this.mappings = mappings;
 }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:7,代码来源:PatchPrechecksOnMultipleHostsAction.cs

示例6: XenServerHealthCheckBundleUpload

 public XenServerHealthCheckBundleUpload(IXenConnection _connection)
 {
     connection = _connection;
     server.HostName = connection.Hostname;
     server.UserName = connection.Username;
     server.Password = connection.Password;
 }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:7,代码来源:XenServerHealthCheckBundleUpload.cs

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

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

示例9: CheckActiveServerLicense

        /// <summary>
        /// Call this to check the server licenses when a connection has been made or on periodic check.
        /// If a license has expired, the user is warned.
        /// The logic for the periodic license warning check: only shows the less than 30 day warnings once every day XC is running.
        /// </summary>
        /// <param name="connection">The connection to check licenses on</param>
        /// <param name="periodicCheck">Whehter it is a periodic check</param>
        internal bool CheckActiveServerLicense(IXenConnection connection, bool periodicCheck)
        {
            if (Helpers.ClearwaterOrGreater(connection))
                return false;

            DateTime now = DateTime.UtcNow - connection.ServerTimeOffset;
            foreach (Host host in connection.Cache.Hosts)
            {
                if (host.IsXCP)
                    continue;

                DateTime expiryDate = host.LicenseExpiryUTC;
                TimeSpan timeToExpiry = expiryDate.Subtract(now);

                if (expiryDate < now)
                {
                    // License has expired. Pop up the License Manager.
                    Program.Invoke(Program.MainWindow, () => showLicenseSummaryExpired(host, now, expiryDate));
                    return true;
                }
                if (timeToExpiry < CONNECTION_WARN_THRESHOLD &&
                    (!periodicCheck || DateTime.UtcNow.Subtract(lastPeriodicLicenseWarning) > RUNNING_WARN_FREQUENCY))
                {
                    // If the license is sufficiently close to expiry date, show the warning
                    // If it's a periodic check, only warn if XC has been open for one day
                    if (periodicCheck)
                        lastPeriodicLicenseWarning = DateTime.UtcNow;
                    Program.Invoke(Program.MainWindow, () => showLicenseSummaryWarning(Helpers.GetName(host), now, expiryDate));
                    return true;
                }
            }
            return false;
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:40,代码来源:LicenseTimer.cs

示例10: ImportWizard

		public ImportWizard(IXenConnection con, IXenObject xenObject, string filename, bool ovfModeOnly)
			: base(con)
		{
			InitializeComponent();

		    m_pageStorage = new ImportSelectStoragePage();
		    m_pageNetwork = new ImportSelectNetworkPage();
		    m_pageHost = new ImportSelectHostPage();
		    m_pageSecurity = new ImportSecurityPage();
		    m_pageEula = new ImportEulaPage();
		    m_pageOptions = new ImportOptionsPage();
		    m_pageFinish = new ImportFinishPage();
		    m_pageRbac = new RBACWarningPage();
		    m_pageTvmIp = new TvmIpPage();
		    m_pageVMconfig = new ImageVMConfigPage();
		    m_pageImportSource = new ImportSourcePage();
		    m_pageXvaStorage = new StoragePickerPage();
		    m_pageXvaNetwork = new NetworkPickerPage();
		    m_pageXvaHost = new GlobalSelectHost();
            lunPerVdiMappingPage = new LunPerVdiImportPage { Connection = con };

			m_selectedObject = xenObject;
            m_pageTvmIp.IsExportMode = false;
			m_pageFinish.SummaryRetreiver = GetSummary;
			m_pageXvaStorage.ImportVmCompleted += m_pageXvaStorage_ImportVmCompleted;

			if (!string.IsNullOrEmpty(filename))
				m_pageImportSource.SetFileName(filename);

			m_pageImportSource.OvfModeOnly = ovfModeOnly;
            AddPages(m_pageImportSource, m_pageHost, m_pageStorage, m_pageNetwork, m_pageFinish);
		}
开发者ID:huizh,项目名称:xenadmin,代码行数:32,代码来源:ImportWizard.cs

示例11: CopyPatchFromHostToOther

 public CopyPatchFromHostToOther(IXenConnection connection, Host hostDestiny, Pool_patch patchToCopy)
     : base(connection, Messages.UPLOADING_PATCH, true)
 {
     _hostDestiny = hostDestiny;
     _patchToCopy = patchToCopy;
     Host = _hostDestiny;
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:7,代码来源:CopyPatchFromHostToOther.cs

示例12: SetVMOtherConfigAction

 public SetVMOtherConfigAction(IXenConnection connection, VM vm, string key, string val)
     : base(connection, "Set VM other_config", true)
 {
     VM = vm;
     Key = key;
     Val = val;
 }
开发者ID:huizh,项目名称:xenadmin,代码行数:7,代码来源:SetVMOtherConfigAction.cs

示例13: CrossPoolMigrateWizard

        public CrossPoolMigrateWizard(IXenConnection con, IEnumerable<SelectedItem> selection, WizardMode mode)
			: base(con)
        {
            InitializeComponent();
            wizardMode = mode;
            InitialiseWizard(selection);
        }
开发者ID:agimofcarmen,项目名称:xenadmin,代码行数:7,代码来源:CrossPoolMigrateWizard.cs

示例14: AddServerDialog

        /// <summary>
        /// Dialog with defaults taken from an existing IXenConnection
        /// </summary>
        /// <param name="connection">The IXenConnection from which the values will be taken.  May be null, in which case an appropriate new
        /// connection will be created when the dialog is completed.</param>
        public AddServerDialog(IXenConnection connection, bool changedPass)
            : base(connection)
        {
            _changedPass = changedPass;

            InitializeComponent();

            PopulateXenServerHosts();
            if (connection != null)
            {
                ServerNameComboBox.Text = connection.HostnameWithPort;
                UsernameTextBox.Text = connection.Username;
                PasswordTextBox.Text = connection.Password ?? "";
            }

            // we have an inner table layout panel due to the group box. Align the columns by examining lables sizes
            Label[] labels = { UsernameLabel, PasswordLabel, ServerNameLabel };
            int biggest = 0;
            foreach (Label l in labels)
            {
                if (l.Width > biggest)
                    biggest = l.Width;
            }
            // set the minimum size of one label from each table which will make sure the columns line up
            UsernameLabel.MinimumSize = new Size(biggest, UsernameLabel.Height);
            ServerNameLabel.MinimumSize = new Size(biggest, ServerNameLabel.Height);

        }
开发者ID:robhoes,项目名称:xenadmin,代码行数:33,代码来源:AddServerDialog.cs

示例15: DialogWithProgress

        /// <summary>
        /// All dialog that extend this one MUST be set to the same size as this, otherwise layout will break.
        /// If you want I different size, I suggest you do it in you derived forms on_load.
        /// </summary>
        /// <param name="connection"></param>
        public DialogWithProgress(IXenConnection connection)
            : base(connection)
        {
            InitializeComponent();

            RegisterProgressControls();
        }
开发者ID:heiden-deng,项目名称:xenadmin,代码行数:12,代码来源:DialogWithProgress.cs


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