lib/kitchen/driver/powershell.rb in kitchen-hyperv-0.3.0 vs lib/kitchen/driver/powershell.rb in kitchen-hyperv-0.4.0
- old
+ new
@@ -89,10 +89,17 @@
New-DifferencingDisk -Path "#{differencing_disk_path}" -ParentPath "#{parent_vhd_path}"
DIFF
end
+ def new_additional_disk_ps(disk_path, disk_size)
+ <<-ADDDISK
+
+ New-VHD -Path "#{disk_path}" -SizeBytes #{disk_size}GB | Out-Null
+ ADDDISK
+ end
+
def ensure_vm_running_ps
<<-RUNNING
Assert-VmRunning -ID "#{@state[:id]}" | ConvertTo-Json
RUNNING
@@ -101,21 +108,24 @@
def new_vm_ps
<<-NEWVM
$NewVMParams = @{
Generation = #{config[:vm_generation]}
+ DisableSecureBoot = "#{config[:disable_secureboot]}"
MemoryStartupBytes = #{config[:memory_startup_bytes]}
Name = "#{instance.name}"
Path = "#{kitchen_vm_path}"
VHDPath = "#{differencing_disk_path}"
SwitchName = "#{config[:vm_switch]}"
+ VlanId = #{config[:vm_vlan_id] || '$null'}
ProcessorCount = #{config[:processor_count]}
UseDynamicMemory = "#{config[:dynamic_memory]}"
DynamicMemoryMinBytes = #{config[:dynamic_memory_min_bytes]}
DynamicMemoryMaxBytes = #{config[:dynamic_memory_max_bytes]}
boot_iso_path = "#{boot_iso_path}"
EnableGuestServices = "#{config[:enable_guest_services]}"
+ AdditionalDisks = @("#{@additional_disk_objects.join('","') || ''}")
}
New-KitchenVM @NewVMParams | ConvertTo-Json
NEWVM
end
@@ -155,9 +165,15 @@
def mount_vm_iso
<<-MOUNTISO
mount-vmiso -id "#{@state[:id]}" -Path #{config[:iso_path]}
MOUNTISO
+ end
+
+ def resize_vhd
+ <<-VMNOTE
+ Resize-VHD -Path "#{parent_vhd_path}" -Size #{config[:resize_vhd]}
+ VMNOTE
end
def set_vm_note
<<-VMNOTE
Set-VM -Name (Get-VM | Where-Object{ $_.ID -eq "#{@state[:id]}"}).Name -Note "#{config[:vm_note]}"