Class: Vcloud::Launcher::VmOrchestrator
- Inherits:
-
Object
- Object
- Vcloud::Launcher::VmOrchestrator
- Defined in:
- lib/vcloud/launcher/vm_orchestrator.rb
Instance Method Summary collapse
- #customize(vm_config) ⇒ Object
-
#initialize(vcloud_vm, vapp) ⇒ VmOrchestrator
constructor
A new instance of VmOrchestrator.
Constructor Details
#initialize(vcloud_vm, vapp) ⇒ VmOrchestrator
Returns a new instance of VmOrchestrator.
5 6 7 8 |
# File 'lib/vcloud/launcher/vm_orchestrator.rb', line 5 def initialize vcloud_vm, vapp vm_id = vcloud_vm[:href].split('/').last @vm = Core::Vm.new(vm_id, vapp) end |
Instance Method Details
#customize(vm_config) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vcloud/launcher/vm_orchestrator.rb', line 10 def customize(vm_config) @vm.update_name(@vm.vapp_name) @vm.configure_network_interfaces vm_config[:network_connections] @vm.update_storage_profile(vm_config[:storage_profile]) if vm_config[:storage_profile] if vm_config[:hardware_config] @vm.update_cpu_count(vm_config[:hardware_config][:cpu]) @vm.update_memory_size_in_mb(vm_config[:hardware_config][:memory]) end @vm.add_extra_disks(vm_config[:extra_disks]) @vm.(vm_config[:metadata]) if vm_config.key?(:independent_disks) Vcloud::Launcher::IndependentDiskOrchestrator.new(@vm).attach(vm_config.fetch(:independent_disks)) end preamble = vm_config[:bootstrap] ? generate_preamble(vm_config) : '' @vm.configure_guest_customization_section(preamble) unless preamble.nil? || preamble.empty? end |