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


C# VM.GetStorageHost方法代码示例

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


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

示例1: EnabledTargetExists

 private static bool EnabledTargetExists(VM vm, IXenConnection connection)
 {
     //if the vm has a home server check it's enabled
     Host host = vm.power_state == vm_power_state.Running ? vm.Connection.Resolve(vm.resident_on) : vm.GetStorageHost(false);
     return Helpers.EnabledTargetExists(host, connection);
 }
开发者ID:kc284,项目名称:xenadmin,代码行数:6,代码来源:StartVMCommand.cs

示例2: VNCTabView

        private bool tryToConnectRDP = false; // This parameter will be set after click "TURN ON Rremote Desktop" and will connect RDP when RDP status changed.

        #endregion Fields

        #region Constructors

        public VNCTabView(VNCView parent, VM source, string elevatedUsername, string elevatedPassword)
        {
            Program.AssertOnEventThread();

            InitializeComponent();

            HostLabel.Font = Program.HeaderGradientFont;
            HostLabel.ForeColor = Program.HeaderGradientForeColor;
            multipleDvdIsoList1.LabelSingleDvdForeColor = Program.HeaderGradientForeColor;
            multipleDvdIsoList1.LabelNewCdForeColor = Program.HeaderGradientForeColor;
            multipleDvdIsoList1.LinkLabelLinkColor = Color.White;

            #pragma warning disable 0219
            // Force the handle to be created, because resize events
            // could be fired before this component is placed on-screen.
            IntPtr _ = Handle;
            #pragma warning restore 0219

            this.parentVNCView = parent;
            this.scaleCheckBox.Checked = false;
            this.source = source;
            this.guestMetrics = source.Connection.Resolve(source.guest_metrics);
            if (this.guestMetrics != null)
                guestMetrics.PropertyChanged += guestMetrics_PropertyChanged;
            log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on {0}", this.source.Name);
            this.source.PropertyChanged += Server_PropertyChanged;
            Host_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
            VM_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(VM_CollectionChanged);
            source.Connection.Cache.RegisterCollectionChanged<VM>(VM_CollectionChangedWithInvoke);

            if (source.is_control_domain)
            {
                Host host = source.Connection.Resolve(source.resident_on);
                if (host != null)
                {
                    log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on {1}", this.source.Name, host.Name);
                    host.PropertyChanged += Server_PropertyChanged;

                    Host_metrics hostMetrics = source.Connection.Resolve(host.metrics);
                    if (hostMetrics != null)
                    {
                        log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on host metrics", this.source.Name);
                        hostMetrics.PropertyChanged += Server_PropertyChanged;
                    }

                    HostLabel.Text = string.Format(source.IsControlDomainZero ? Messages.CONSOLE_HOST : Messages.CONSOLE_HOST_NUTANIX, host.Name);
                    HostLabel.Visible = true;
                }
            }
            else
            {
                source.Connection.Cache.RegisterCollectionChanged<Host>(Host_CollectionChangedWithInvoke);
                targetHost = source.GetStorageHost(false);

                foreach (Host cachedHost in source.Connection.Cache.Hosts)
                {
                    log.DebugFormat("'{0}' console: Register Server_EnabledPropertyChanged event listener on {1}",
                                    source.Name, cachedHost.Name);
                    cachedHost.PropertyChanged += Server_EnabledPropertyChanged;
                }

                HostLabel.Visible = false;
            }

            log.DebugFormat("'{0}' console: Update power state (on VNCTabView constructor)", this.source.Name);
            updatePowerState();
            this.vncScreen = new XSVNCScreen(source, new EventHandler(RDPorVNCResizeHandler), this, elevatedUsername, elevatedPassword);
            ShowGpuWarningIfRequired(vncScreen.MustConnectRemoteDesktop());
            vncScreen.GpuStatusChanged += ShowGpuWarningIfRequired;

            if (source.IsControlDomainZero || source.IsHVM && !hasRDP) //Linux HVM guests should only have one console: the console switch button vanishes altogether.
            {
                toggleConsoleButton.Visible = false;
            }
            else
            {
                toggleConsoleButton.Visible = true;
                this.vncScreen.OnDetectRDP = this.OnDetectRDP;
                this.vncScreen.OnDetectVNC = this.OnDetectVNC;
                this.vncScreen.UserCancelledAuth += this.OnUserCancelledAuth;
                this.vncScreen.VncConnectionAttemptCancelled += this.OnVncConnectionAttemptCancelled;
            }

            LastDesktopSize = vncScreen.DesktopSize;

            this.insKeyTimer = new System.Threading.Timer(new TimerCallback(notInsKeyPressed));

            Properties.Settings.Default.PropertyChanged += Default_PropertyChanged;

            registerShortCutKeys();

            //
            // Ctlr - Alt - Ins send Ctrl - Alt - Delete, and cancels and pending full screen.
            //
//.........这里部分代码省略.........
开发者ID:ushamandya,项目名称:xenadmin,代码行数:101,代码来源:VNCTabView.cs

示例3: VNCTabView

        public VNCTabView(VNCView parent, VM source, string elevatedUsername, string elevatedPassword)
        {
            Program.AssertOnEventThread();

            InitializeComponent();

            HostLabel.Font = Program.HeaderGradientFont;
            HostLabel.ForeColor = Program.HeaderGradientForeColor;
            multipleDvdIsoList1.SetTextColor(Program.HeaderGradientForeColor);

            #pragma warning disable 0219
            // Force the handle to be created, because resize events
            // could be fired before this component is placed on-screen.
            IntPtr _ = Handle;
            #pragma warning restore 0219

            this.parentVNCView = parent;
            this.scaleCheckBox.Checked = false;
            this.source = source;
            log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on {0}", this.source.Name);
            this.source.PropertyChanged += Server_PropertyChanged;
            Host_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(Host_CollectionChanged);
            VM_CollectionChangedWithInvoke = Program.ProgramInvokeHandler(VM_CollectionChanged);
            source.Connection.Cache.RegisterCollectionChanged<VM>(VM_CollectionChangedWithInvoke);

            if (source.is_control_domain)
            {
                Host host = source.Connection.Resolve(source.resident_on);
                if (host != null)
                {
                    log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on {1}", this.source.Name, host.Name);
                    host.PropertyChanged += Server_PropertyChanged;

                    Host_metrics hostMetrics = source.Connection.Resolve(host.metrics);
                    if (hostMetrics != null)
                    {
                        log.DebugFormat("'{0}' console: Register Server_PropertyChanged event listener on host metrics", this.source.Name);
                        hostMetrics.PropertyChanged += Server_PropertyChanged;
                    }

                    HostLabel.Text = string.Format(Messages.CONSOLE_HOST, host.Name);
                    HostLabel.Visible = true;
                }
            }
            else
            {
                source.Connection.Cache.RegisterCollectionChanged<Host>(Host_CollectionChangedWithInvoke);
                targetHost = source.GetStorageHost(false);

                foreach (Host cachedHost in source.Connection.Cache.Hosts)
                {
                    log.DebugFormat("'{0}' console: Register Server_EnabledPropertyChanged event listener on {1}",
                                    source.Name, cachedHost.Name);
                    cachedHost.PropertyChanged += Server_EnabledPropertyChanged;
                }

                HostLabel.Visible = false;
            }

            log.DebugFormat("'{0}' console: Update power state (on VNCTabView constructor)", this.source.Name);
            updatePowerState();
            this.vncScreen = new XSVNCScreen(source, new EventHandler(RDPorVNCResizeHandler), this, elevatedUsername, elevatedPassword);
            ShowGpuWarningIfRequired();

            if (source.is_control_domain)
            {
                toggleConsoleButton.Visible = false;
            }
            else
            {
                toggleConsoleButton.Visible = true;
                this.vncScreen.OnDetectRDP = this.OnDetectRDP;
                this.vncScreen.OnDetectVNC = this.OnDetectVNC;
                this.vncScreen.UserCancelledAuth += this.OnUserCancelledAuth;
            }

            LastDesktopSize = vncScreen.DesktopSize;

            this.insKeyTimer = new System.Threading.Timer(new TimerCallback(notInsKeyPressed));

            Properties.Settings.Default.PropertyChanged += Default_PropertyChanged;

            registerShortCutKeys();

            //
            // Ctlr - Alt - Ins send Ctrl - Alt - Delete, and cancels and pending full screen.
            //

            KeyHandler.AddKeyHandler(ConsoleShortcutKey.CTRL_ALT_INS, cancelWaitForInsKeyAndSendCAD);

            this.vncScreen.Parent = this.contentPanel;
            this.vncScreen.Dock = DockStyle.Fill;

            this.Dock = DockStyle.Fill;

            string rdpLabel = GuessNativeConsoleLabel(source);
            this.toggleConsoleButton.Text = rdpLabel;

            UpdateFullScreenButton();

//.........这里部分代码省略.........
开发者ID:BATYD-Turksat,项目名称:xenadmin,代码行数:101,代码来源:VNCTabView.cs

示例4: SetXenObjects

        public void SetXenObjects(IXenObject orig, IXenObject clone)
        {
            vm = clone as VM;
            if (vm == null)
                return;

            Host currentAffinity = vm.Connection.Resolve(vm.affinity);
            picker.SetAffinity(vm.Connection, currentAffinity,
                              vm.HasNoDisksAndNoLocalCD
                                  ? null
                                  : vm.GetStorageHost(false));
        }
开发者ID:huizh,项目名称:xenadmin,代码行数:12,代码来源:HomeServerEditPage.cs

示例5: PageLoaded

        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            // if not using CD, use selected template storage host
            // if using CD use CD or template storage host);

               if (SelectedInstallMethod != InstallMethod.CD || SelectedCD == null)
            {
                if (SelectedTemplate == Template && CdAffinity == null)
                    return;

                CdAffinity = null;
                Template = SelectedTemplate;
                affinityPicker1.SetAffinity(Connection, Affinity, Template.GetStorageHost(true));
            }
            else
            {
                SR sr = Connection.Resolve(SelectedCD.SR);
                if (sr == null)
                    return;

                Host cdAffinity = sr.GetStorageHost();

                if (SelectedTemplate == Template && cdAffinity == CdAffinity)
                    return;

                Template = SelectedTemplate;
                CdAffinity = cdAffinity;

                affinityPicker1.SetAffinity(Connection, Affinity,
                                           CdAffinity ?? Template.GetStorageHost(false));
            }
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:34,代码来源:Page_HomeServer.cs


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