Module: Fog::Kubevirt::Compute::VmAction

Included in:
Server, Vm
Defined in:
lib/fog/kubevirt/compute/models/vm_action.rb

Instance Method Summary collapse

Instance Method Details

#start(options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/fog/kubevirt/compute/models/vm_action.rb', line 5

def start(options = {})
  # Change the `running` attribute to `true` so that the virtual machine controller will take it and
  # create the virtual machine instance.
  vm = service.get_raw_vm(name)
  vm = deep_merge!(vm,
    :spec => {
      :running => true
    }
  )
  service.update_vm(vm)
end

#stop(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/fog/kubevirt/compute/models/vm_action.rb', line 17

def stop(options = {})
  vm = service.get_raw_vm(name)
  vm = deep_merge!(vm,
    :spec => {
      :running => false
    }
  )
  service.update_vm(vm)
end