Module: Fog::Kubevirt::Compute::VmAction
Instance Method Summary collapse
-
#start(options = {}) ⇒ Object
Handles both legacy (spec.running) and modern (spec.runStrategy) formats.
- #stop(options = {}) ⇒ Object
Instance Method Details
#start(options = {}) ⇒ Object
Handles both legacy (spec.running) and modern (spec.runStrategy) formats
7 8 9 10 11 12 13 14 |
# File 'lib/fog/kubevirt/compute/models/vm_action.rb', line 7 def start( = {}) vm = service.get_raw_vm(name) spec = vm.dig(:spec, :running).nil? ? { runStrategy: "Always" } : { running: true } vm = deep_merge!(vm, :spec => spec) service.update_vm(vm) end |
#stop(options = {}) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/fog/kubevirt/compute/models/vm_action.rb', line 16 def stop( = {}) vm = service.get_raw_vm(name) spec = vm.dig(:spec, :running).nil? ? { runStrategy: "Halted" } : { running: false } vm = deep_merge!(vm, :spec => spec) service.update_vm(vm) end |