POSHOrigin_vSphere icon indicating copy to clipboard operation
POSHOrigin_vSphere copied to clipboard

creating VM's with multiple NIC's

Open StevePB61 opened this issue 9 years ago • 6 comments

I am having issues when creating VM's with multiple NIC's. The error messages are: 10.60.32.120 10.70.70.120 appears to already be in use. + CategoryInfo : NotSpecified: (:) [], CimException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,_CreateVM + PSComputerName : localhost

Could not resolve required VMware objects needed to create this VM + CategoryInfo : NotSpecified: (:) [], CimException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,_CreateVM + PSComputerName : localhost

There was a problem setting the resource + CategoryInfo : NotSpecified: (:) [], CimException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Set-TargetResource + PSComputerName : localhost

C:\Program Files\WindowsPowerShell\Modules\POSHOrigin_vSphere\POSHOrigin_vSphere-master\POSHOrigin_vSphere\DscResources\POSHOrigin_vSphere_VM\POSHOrigin_vSphere_VM.psm1(215):
$setNICResult = _SetVMNICs -vm $vm -NICSpec $Networks -CustomizationSpec $CustomizationSpec -IPAMFqdn $IPAMFqdn -IPAMCredentials $IPAMCredentials + CategoryInfo : NotSpecified: (:) [], CimException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Set-TargetResource + PSComputerName : localhost

Cannot validate argument on parameter 'vm'. The argument is null. Provide a valid value for the argument, and then try running the command again. + CategoryInfo : NotSpecified: (:) [], CimException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Set-TargetResource + PSComputerName : localhost

VERBOSE: [L-7MDCK32]: LCM: [ End Set ] [[VM]SST-TST-SPB-101] in 22.4480 seconds. The PowerShell DSC resource '[VM]SST-TST-SPB-101' with SourceInfo 'C:\Program Files\WindowsPowerShell\Modules\POSHOrigin_vSphere\POSHOrigin_vSphere-master\POSHOrigin_vSphere\DSCResources\POSHOrigin_vSphere_VM\Invoke.ps1::156::17::VM' threw one or more non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel called Microsoft-Windows-DSC/Operational. Refer to this channel for more details. + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : NonTerminatingErrorFromProvider + PSComputerName : localhost

VERBOSE: [L-7MDCK32]: LCM: [ End Set ] The SendConfigurationApply function did not succeed. + CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : MI RESULT 1 + PSComputerName : localhost

The config has the following array

networks = @( @{ portGroup = 'BOX_Direct_AD_Mgmt_10.60.32.0_VL71' ipAssignment = 'Static' ipAddress = '10.60.32.120' subnetMask = '255.255.255.0' defaultGateway = '10.60.32.1' dnsServers = @('10.60.32.10','10.60.32.11') } @{ portGroup = 'BOX_Direct_10.70.70.0_VL70' ipAssignment = 'Static' ipAddress = '10.6.70.120' subnetMask = '255.255.255.0' } )

StevePB61 avatar May 31 '16 08:05 StevePB61

There is probably a bug in the code below that attempts to ping the IP(s) prior to creating the VM. https://github.com/devblackops/POSHOrigin_vSphere/blob/master/POSHOrigin_vSphere/DSCResources/POSHOrigin_vSphere_VM/Helpers/_CreateVM.ps1#L94-L114

I'll try to reproduce the issue.

Thanks for finding this!

-Brandon

devblackops avatar Jun 01 '16 03:06 devblackops

Cheer Brandon.

StevePB61 avatar Jun 01 '16 07:06 StevePB61

Well, the bug with verifying the IP(s) before VM creation was easily fixed. The branch resource-pool has the fix (and also supports deploying VMs to resource pools, VM hosts, and vApps).

Now the problem is that it looks like VMware's cmdlet New-OSCustomizationNicMapping requires that when using static IP assignment, you need to specify DNS and DefaultGateway parameters.

Error

New-OSCustomizationNicMapping           When the IpMode parameter is set to UseStaticIp, you must specify the IPAddress, Subnetmask, Dns(on Windows specs only), and DefaultGateway parameters.

It's probably possible to use dummy values (to satisfy the cmdlet) when the user doesn't intend to have DNS or default gateway values set on a NIC and then come back around after the VM is deployed and remove those values. That seems like a kludge though.

I'll need to devote some more brain power on how to solve that problem.

-Brandon

devblackops avatar Jun 02 '16 06:06 devblackops

Hi Brandon, any progress on this. :-)

StevePB61 avatar Jul 01 '16 10:07 StevePB61

Sorry @StevePB61. I haven't done any work on this. How much of an issue is this for you?

devblackops avatar Jul 16 '16 16:07 devblackops

Hi Brandon, its not a 'show-stopper' but we have a number of environments which have a "management" network and hence the multiple NIC's; which I would like to be able to destroy and redeploy using your POSHOrigin_vSphere module.

Therefore, it is important but can wait for a bit. In the meantime I am having to use a 'workaround' which uses powershell remoting and PowerCli to add the NIC's and configure the IP's which is less than ideal.

Thanks,

Steve

StevePB61 avatar Jul 18 '16 07:07 StevePB61