Ejemplo n.º 1
0
 internal bool NewVirtualMachine()
 {
     var cmdlet = (NewEsxiVmCommand)Cmdlet;
     var codeRunner = new CrossHostCodeRunner();
     return codeRunner.Run(
         ConnectionData.Entries.First(cInfo => cInfo.Host == cmdlet.Server),
         string.Format(Commands.CreateVirtualMachine, cmdlet.Name, cmdlet.Path)
     );
 }
Ejemplo n.º 2
0
        internal bool NewVirtualMachine()
        {
            var cmdlet     = (NewEsxiVmCommand)Cmdlet;
            var codeRunner = new CrossHostCodeRunner();

            return(codeRunner.Run(
                       ConnectionData.Entries.First(cInfo => cInfo.Host == cmdlet.Server),
                       string.Format(Commands.CreateVirtualMachine, cmdlet.Name, cmdlet.Path)
                       ));
        }
Ejemplo n.º 3
0
 IEnumerable<IEsxiVirtualMachine> GetMachinesFromServer(IEnumerable<ConnectionInfo> connectionInfos)
 {
     var vms = new List<IEsxiVirtualMachine>();
     
     var codeRunner = new CrossHostCodeRunner();
     Func<PlainTextDataConverter, string, string, List<IEsxiVirtualMachine>> runnerFunc = (runner, textData, server) => runner.GetMachines(textData, server);
     foreach (var connInfo in connectionInfos)
         // TODO: error handling
         vms.AddRange(codeRunner.Run<PlainTextDataConverter, List<IEsxiVirtualMachine>>(connInfo, Commands.GetVirtualMachines, runnerFunc));
     return vms;
 }
Ejemplo n.º 4
0
 void UnregisterMachinesOnServer(string serverName, IGrouping<string, IEsxiVirtualMachine> machineGroup)
 {
     var codeRunner = new CrossHostCodeRunner();
     // TODO: error handling
     foreach (var virtualMachine in machineGroup)
         codeRunner.Run(
             ConnectionData.Entries
                 .First(info => 0 == string.Compare(info.Host, serverName, StringComparison.OrdinalIgnoreCase)),
             string.Format(Commands.UnregisterVirtualMachine, virtualMachine.Id)
             );
 }