Created
June 1, 2011 08:27
-
-
Save jedi4ever/1001978 to your computer and use it in GitHub Desktop.
vsphere -ruby testing notes
This file contains 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
To setup a test environment | |
- install vmware Fusion (trial) | |
- install A machine (windows 2003 / 64 Bit /trial available) | |
- install B machine (ESX) (trial download) | |
- install on A, vsphere server (trial download/requires Win2003/Win2008) | |
- install on A, vsphere client | |
- import ESX host B into vsphere via vsphere client | |
- create a user vmware (Local User) | |
- put it in Administrator group | |
Libraries we use | |
- https://github.com/vmware/rbvmomi | |
Cloning example (cfr. https://github.com/vmware/rbvmomi/blob/master/examples/clone_vm.rb) | |
require 'rbvmomi' | |
vim = RbVmomi::VIM.connect host: '172.16.44.133',user: 'vmware', password: 'password', insecure: true | |
vm=vim.serviceInstance.find_datacenter.find_vm("New Virtual Machine 1") | |
VIM = RbVmomi::VIM | |
relocateSpec = RbVmomi::VIM.VirtualMachineRelocateSpec | |
spec = VIM.VirtualMachineCloneSpec(:location => relocateSpec, :powerOn => false, :template => false) | |
vm.CloneVM_Task(:folder => vm.parent, :name => "bla", :spec => spec).wait_for_completion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment