예제 #1
0
        private static void mockedBiosThread(mockedBiosThreadParams param)
        {
            using (lockableBladeSpec blade = param.db.getBladeByIP(param.nodeIP, bladeLockType.lockBIOS, bladeLockType.lockBIOS, true, true))
            {
                blade.spec.currentlyHavingBIOSDeployed = true;
            }
            param.isStarted = true;
            param.signalOnStart.Set();

            using (lockableBladeSpec blade = param.db.getBladeByIP(param.nodeIP, bladeLockType.lockLongRunningBIOS, bladeLockType.lockLongRunningBIOS, true, true))
            {
                while (true)
                {
                    if (DateTime.Now > param.deadline)
                    {
                        using (var tmp = new tempLockElevation(blade, bladeLockType.lockBIOS, bladeLockType.lockBIOS))
                        {
                            param.parent.markLastKnownBIOS(blade, param.BIOSToWrite);
                            param.result = new result(resultCode.success);

                            return;
                        }
                    }

                    if (param.isCancelled)
                    {
                        param.result = new result(resultCode.cancelled);
                        return;
                    }

                    Thread.Sleep(TimeSpan.FromSeconds(1));
                }
            }
        }
예제 #2
0
        private void _SetBIOS(biosThreadState state)
        {
            // SCP some needed files to it.
            copyDeploymentFilesToBlade(state.blade, state.biosxml, state.connectDeadline);

            // And execute the command to deploy the BIOS via SSH.
            using (hypervisor hyp = _hostManager.makeHypervisorForBlade_LTSP(state.blade))
            {
                executionResult res = hyp.startExecutable("bash", "~/applyBIOS.sh");
                if (res.resultCode != 0)
                {
                    string msg = string.Format("Executing applyBIOS.sh on {0} resulted in error code {1}", state.nodeIP, res.resultCode);
                    msg += "stdout: " + res.stdout;
                    msg += "stderr: " + res.stderr;
                    _hostManager.addLogEvent(msg);
                    state.result = new result(resultCode.genericFail, msg);
                }
                else
                {
                    _hostManager.addLogEvent(string.Format("Deployed BIOS successfully to {0}", state.nodeIP));

                    using (var tmp = new tempLockElevation(state.blade, bladeLockType.lockNone, bladeLockType.lockBIOS))
                    {
                        _hostManager.markLastKnownBIOS(state.blade, state.biosxml);
                    }

                    state.result = new result(resultCode.success);
                }

                // All done, now we can power off and return.
                hyp.powerOff(state.connectDeadline);
            }

            state.isFinished = true;
        }
예제 #3
0
        private void setBIOS(biosThreadState state)
        {
            try
            {
                _SetBIOS(state);
            }
            catch (Exception e)
            {
                string msg = string.Format("Writing BIOS to {0} resulted in exception {1}", state.nodeIP, e);
                _hostManager.addLogEvent(msg);
                state.result = new result(resultCode.genericFail, msg);

                using (var tmp = new tempLockElevation(state.blade, bladeLockType.lockNone, bladeLockType.lockBIOS))
                {
                    _hostManager.markLastKnownBIOS(state.blade, "unknown");
                }

                state.isFinished = true;
            }
        }
예제 #4
0
        private void _GetBIOS(biosThreadState state)
        {
            copyDeploymentFilesToBlade(state.blade, null, state.connectDeadline);

            using (hypervisor hyp = _hostManager.makeHypervisorForBlade_LTSP(state.blade))
            {
                executionResult res = hyp.startExecutable("bash", "~/getBIOS.sh");
                if (res.resultCode != 0)
                {
                    string msg = string.Format("Executing getBIOS.sh on {0} resulted in error code {1}", state.nodeIP, res.resultCode);
                    msg += "stdout: " + res.stdout;
                    msg += "stderr: " + res.stderr;
                    _hostManager.addLogEvent(msg);
                    state.result = new result(resultCode.genericFail, msg);
                }
                else
                {
                    string msg = string.Format("Deployed BIOS successfully to {0}", state.nodeIP);
                    _hostManager.addLogEvent(msg);
                    state.result = new result(resultCode.success, msg);
                }

                // Retrieve the output
                state.biosxml = hyp.getFileFromGuest("currentbios.xml", state.connectDeadline);

                // All done, now we can power off and return.
                hyp.powerOff(state.connectDeadline);
            }

            using (var tmp = new tempLockElevation(state.blade, bladeLockType.lockNone, bladeLockType.lockBIOS))
            {
                _hostManager.markLastKnownBIOS(state.blade, state.biosxml);
            }

            state.isFinished = true;
        }