示例#1
0
文件: VMSystem.cs 项目: liguifa/VMM
 public SystemActiveResponseMessage ActiveSystem(SystemActiveRequestMessage request)
 {
     List<SystemInfoResponseMessage.VMSystem> outSystems = new List<SystemInfoResponseMessage.VMSystem>();
     object syncRoot = new object();
     Parallel.ForEach(Config.GetInstance("vmware.config").Machines, machine =>
     {
         VMware manager = new VMware(machine.Address, machine.Username, machine.Password);
         manager.ActiveSystem(request.Names);
     });
     return new SystemActiveResponseMessage();
 }
示例#2
0
文件: VMSystem.cs 项目: liguifa/VMM
 public SystemInfoResponseMessage GetSystemInfo(SystemInfoRequestMessage request)
 {
     List<SystemInfoResponseMessage.VMSystem> outSystems = new List<SystemInfoResponseMessage.VMSystem>();
     object syncRoot = new object();
     Parallel.ForEach(Config.GetInstance("vmware.config").Machines, machine =>
     {
         VMware manager = new VMware(machine.Address, machine.Username, machine.Password);
         List<SystemInfoResponseMessage.VMSystem> systems = manager.GetVMSystems();
         lock (syncRoot)
         {
             outSystems = outSystems.Concat(systems).ToList();
         }
     });
     outSystems = outSystems.OrderBy(d => d.Name).ToList(); ;
     SystemInfoResponseMessage response = new SystemInfoResponseMessage();
     response.VMSystyems = outSystems.Skip((request.pageIndex - 1) * request.pageSize).Take(request.pageSize).ToList();
     return response;
 }