Created
May 19, 2015 22:09
-
-
Save echohack/5e2bc48b3815503cea0b to your computer and use it in GitHub Desktop.
why_rubocop.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def virtual_disk_for(vm, options) | |
if options[:datastore].to_s.empty? | |
raise ":datastore must be specified when adding a disk to a cloned vm" | |
end | |
idx = vm.disks.count | |
RbVmomi::VIM::VirtualDeviceConfigSpec( | |
:operation => :add, | |
:fileOperation => :create, | |
:device => RbVmomi::VIM.VirtualDisk( | |
:key => idx, | |
:backing => RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo( | |
:fileName => "[#{options[:datastore]}]", | |
:diskMode => 'persistent', | |
:thinProvisioned => true | |
), | |
:capacityInKB => options[:additional_disk_size_gb] * 1024 * 1024, | |
:controllerKey => 1000, | |
:unitNumber => idx | |
) | |
) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment