ananace / foreman_hyperv

Microsoft Hyper-V compute resource for Foreman
GNU General Public License v3.0
15 stars 2 forks source link

Handle volumes and network interfaces in a more sane way #1

Closed ananace closed 7 years ago

ananace commented 7 years ago

This would probably require splitting up the VM creation, instead of having them created by the New-VM cmdlet.

Without this it's impossible to support MAC assignment or multiple disks/network adapters

$VM = New-VM -Name mister-virtual.example.com -BootDevice NetworkAdapter -MemoryStartup 2147483648
$VM | Set-VM -ProcessorCount 4
$VM | Add-VMNetworkAdapter -StaticMacAddress "00:1f:2a:34:53:12" -Name "Example network adapter" -SwitchName net_switch
$VM | Add-VMNetworkAdapter -StaticMacAddress "00:1f:2a:34:53:13" -Name "Example network adapter 2" -SwitchName internal_switch
New-VHD -Path C:\VMs\Disk01.vhdx -SizeBytes 68719476736 -Dynamic
New-VHD -Path C:\VMs\Disk02.vhdx -SizeBytes 68719476736 -Dynamic
$VM | Add-VMHardDiskDrive -Path C:\VMs\Disk01.vhdx ... 
$VM | Add-VMHardDiskDrive -Path C:\VMs\Disk02.vhdx ...