Exemple #1
0
 /// <summary>
 /// Powers on a VM.
 /// </summary>
 /// <param name="setInUse">if set to <c>true</c> then set the VM to in use in the asset inventory system.</param>
 public void PowerOn(bool setInUse = true)
 {
     VMController.PowerOnMachine(Name);
     if (setInUse)
     {
         VMInventoryManager.SetInUse(Name);
     }
 }
        private void PowerOn(SimReserved simulator)
        {
            Thread.CurrentThread.SetName(simulator.AssetId);

            UpdateItemStatus(simulator, "Checking power status...");
            if (VMController.IsPoweredOn(simulator.VirtualMachine))
            {
                UpdateItemStatus(simulator, "Already powered on.");
            }
            else
            {
                UpdateItemStatus(simulator, "Powering On VM...");
                VMController.PowerOnMachine(simulator.VirtualMachine);
                VMInventoryManager.SetInUse(simulator.VirtualMachine);
                CancellationTokenSource task = new CancellationTokenSource();
                VMController.WaitOnMachineAvailable(simulator.VirtualMachine, task.Token);
                UpdateItemStatus(simulator, "Power On complete.");
            }
        }