internal Guid DeployVirtualMachine() { Guid id = Guid.Empty; try { DeployVirtualMachineRequest request = new DeployVirtualMachineRequest() { TemplateId = Guid.Parse(_templateId), ServiceOfferingId = Guid.Parse(_serviceOfferingId), DisplayName = "Test-Generated", ZoneId = Guid.Parse(_zoneId), UserData = "my user data", StartVm = !_deployStopped }; if (!string.IsNullOrEmpty(this._networkId)) { request.NetworkIds = new[] { Guid.Parse(_networkId) }.ToList(); } id = _client.DeployVirtualMachine(request).jobid; _logWriter("Deployed new VM, jobid " + id); } catch (System.Exception wex) { _logWriter(wex.Message); System.Diagnostics.Debug.Fail("Not supposed to throw during deploy VM"); } return(id); }
public string CreateVirtualMachine(string name, string networkId, string zoneId, string serviceOfferingId, string templateId, string userData) { try { DeployVirtualMachineRequest request = new DeployVirtualMachineRequest() { DisplayName = name, TemplateId = templateId, ZoneId = zoneId, ServiceOfferingId = serviceOfferingId, UserData = userData }; request.Parameters["name"] = name; request.WithNetworkIds(networkId); return(client.DeployVirtualMachine(request)); } catch (Exception e) { Console.WriteLine(e); return(null); } }
internal Guid DeployVirtualMachine() { Guid id = Guid.Empty; try { DeployVirtualMachineRequest request = new DeployVirtualMachineRequest() { TemplateId = Guid.Parse(_templateId), ServiceOfferingId = Guid.Parse(_serviceOfferingId), DisplayName = "Test-Generated", ZoneId = Guid.Parse(_zoneId), UserData = "my user data", StartVm = !_deployStopped }; if (!string.IsNullOrEmpty(this._networkId)) { request.NetworkIds = new[] { Guid.Parse(_networkId) }.ToList(); } id = _client.DeployVirtualMachine(request).jobid; _logWriter("Deployed new VM, jobid " + id); } catch (System.Exception wex) { _logWriter(wex.Message); System.Diagnostics.Debug.Fail("Not supposed to throw during deploy VM"); } return id; }
internal string DeployVirtualMachine() { string id = string.Empty; var session = new CloudStack.SDK.Client(serviceUri, apiKey, secretKey); try { DeployVirtualMachineRequest request = new DeployVirtualMachineRequest() { TemplateId = templateId, ServiceOfferingId = serviceOfferingId, DisplayName = "Test-Generated", ZoneId = zoneId, UserData = "my user data", StartVm = !deployStopped }; if (!string.IsNullOrEmpty(this.networkId)) { request.WithNetworkIds(networkId); } id = session.DeployVirtualMachine(request); logWriter("Deployed new VM, id " + id); } catch (System.Exception wex) { logWriter(wex.Message); System.Diagnostics.Debug.Fail("Not supposed to throw during deploy VM"); } return id; }