示例#1
0
 /// <summary>
 /// Start the VM's where the extradata key is set
 /// </summary>
 private void startvms()
 {
     if (machines.Length == 0)
     {
         return;
     }
     foreach (VirtualBox.IMachine m in machines)
     {
         string xtrakeys = m.GetExtraData(this.extradatakey.ToString());
         if (xtrakeys.ToLower() == "yes")
         {
             if (m.State == VirtualBox.MachineState.MachineState_PoweredOff || m.State == VirtualBox.MachineState.MachineState_Saved)
             {
                 this.EventLog.WriteEntry(String.Format("Starting VM {0} ({1})", m.Name, m.Id));
                 VirtualBox.Session session = new VirtualBox.Session();
                 try {
                     VirtualBox.IProgress progress = m.Parent.OpenRemoteSession(session, m.Id, "vrdp", "");
                     progress.WaitForCompletion(-1);
                 } catch (Exception e) {
                     this.EventLog.WriteEntry(String.Format("Error starting VM {0} ({1})\r\n\r\n{2}", m.Name, m.Id, e.ToString()), EventLogEntryType.Error);
                 }
             }
         }
     }
 }
示例#2
0
        public virtual ProgressToken Start()
        {
            Trace.Assert(getState() != VBoxWrapper.MachineState.Running);

            comVB.Session   session  = new comVB.Session();
            comVB.IProgress progress = _comMachine.LaunchVMProcess(session, "headless", "");

            return(new IProgressProgressToken(progress));
        }
示例#3
0
        private ProgressToken saveState(comVB.Session session)
        {
            comVB.IProgress progress = session.Console.SaveState();

            return(new IProgressProgressToken(progress));
        }
示例#4
0
 public IProgressProgressToken(comVB.IProgress progressToken)
 {
     _progress = progressToken;
 }
示例#5
0
        private ProgressToken hardOff(comVB.Session session)
        {
            comVB.IProgress progress = session.Console.PowerDown();

            return(new IProgressProgressToken(progress));
        }