Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Duplicate vm with id controller

  • Loading branch information...
commit c2b1d46e33ba149b7dc0f16204863812beaa3da5 1 parent de2293e
Bertrand Paquet authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 modules/duplicate.rb
View
4 modules/duplicate.rb
@@ -20,7 +20,9 @@ def vm src, dest, opts
opts[:memory] = src.summary.config.memorySizeMB
opts[:guestid] = src.config.guestId
opts[:network] = src.config.hardware.device.grep(VIM::VirtualEthernetCard)[0].backing.network.name if local
- opts[:controller] = src.config.hardware.device.grep(VIM::VirtualSCSIController)[0].class.to_s
+ if src.config.hardware.device.grep(VIM::VirtualSCSIController).size > 0
+ opts[:controller] = src.config.hardware.device.grep(VIM::VirtualSCSIController)[0].class.to_s
+ end
vm = RVC::MODULES['vm'].create(dest, opts)
err "Unable to create vm" unless vm
vm.config.hardware.device.grep(VIM::VirtualDisk).each do |disk|
Please sign in to comment.
Something went wrong with that request. Please try again.