private static ScaleSetVirtualMachineStripped[] GetInstanceIds(IEnumerable <ScaleSetVirtualMachineStripped> vmScaleSetData, int poolId = TestsConstants.TestPoolId, string jsonData = TestsConstants.Json1JobIsRunning)
        {
            var dataRetriever = RetrieveTests.CreateRetriever(jsonData);

            return(Decisions.CollectInstanceIdsToDeallocate(vmScaleSetData.Where(vm => vm.VmInstanceState.Equals(PowerState.Running)),
                                                            dataRetriever.GetRuningJobs(poolId)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method will perform all changes to scale set
        /// </summary>
        private static void DeallocationWorkWithScaleSet(
            ScaleSetVirtualMachineStripped[] virtualMachinesStripped,
            JobRequest[] executingJobs,
            IVirtualMachineScaleSet scaleSet, int agentsLimit)
        {
            Console.WriteLine("Deallocating VMs");
            //we need to downscale, only running VMs shall be selected here
            var vmInstancesCollection = Decisions.CollectInstanceIdsToDeallocate(virtualMachinesStripped.Where(vm => vm.VmInstanceState.Equals(PowerState.Running)), executingJobs);

            DeallocateVms(vmInstancesCollection, scaleSet, agentsLimit);

            //if we are deprovisioning - it is some time to do some housekeeping as well
            if (Properties.IsDryRun)
            {
                return;
            }

            HouseKeeping(scaleSet);
        }
 private static ScaleSetVirtualMachineStripped[] GetInstanceIds(IEnumerable <ScaleSetVirtualMachineStripped> vmScaleSetData, int poolId = TestsConstants.TestPoolId, string jsonData = TestsConstants.Json1JobIsRunning)
 {
     return(Decisions.CollectInstanceIdsToDeallocate(vmScaleSetData.Where(vm => vm.VmInstanceState.Equals(PowerState.Running)),
                                                     HelperMethods.GetSimulatedJobRequests(poolId, jsonData)));
 }