module Fog::Kubevirt::Compute::VmAction

Public Instance Methods

start(options = {}) click to toggle source

Handles both legacy (spec.running) and modern (spec.runStrategy) formats

# File lib/fog/kubevirt/compute/models/vm_action.rb, line 7
def start(options = {})
  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 = {}) click to toggle source
# File lib/fog/kubevirt/compute/models/vm_action.rb, line 16
def stop(options = {})
  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