예제 #1
0
        private void _ltspBootThreadStart(biosThreadState param)
        {
            using (lockableBladeSpec blade = _hostManager.db.getBladeByIP(param.nodeIP, bladeLockType.lockBIOS, bladeLockType.lockBIOS,
                                                                          permitAccessDuringBIOS: true, permitAccessDuringDeployment: true))
            {
                blade.spec.currentlyHavingBIOSDeployed = true;
            }
            param.connectDeadline = new cancellableDateTime(TimeSpan.FromMinutes(5));
            param.isStarted.Set();

            using (lockableBladeSpec blade = _hostManager.db.getBladeByIP(param.nodeIP,
                                                                          bladeLockType.lockOwnership | bladeLockType.lockSnapshot,
                                                                          bladeLockType.lockNone, permitAccessDuringBIOS: true, permitAccessDuringDeployment: true))
            {
                // Power cycle it
                _hostManager.startBladePowerOff(blade, param.connectDeadline);
                _hostManager.startBladePowerOn(blade, param.connectDeadline);

                param.blade = blade;

                // Wait for it to boot.  Note that we don't ping the client repeatedly here - since the Ping class can cause
                // a BSoD.. ;_; Instead, we wait for port 22 (SSH) to be open.
                _hostManager.setCallbackOnTCPPortOpen(22, param.onBootFinishEvent, param.onBootFailureEvent, param.connectDeadline, param);

                // Wait for the boot to either complete or to fail.
                while (true)
                {
                    if (!param.onBootFinishEvent.WaitOne(TimeSpan.FromMilliseconds(500)))
                    {
                        param.onBootFinish(param);
                        break;
                    }
                    if (!param.onBootFailureEvent.WaitOne(TimeSpan.FromMilliseconds(500)))
                    {
                        param.onBootFailure(param);
                        break;
                    }
                }
            }
        }