oca.virtualmachine

class oca.VirtualMachine(xml, client)

Bases: oca.pool.PoolElement

static allocate(client, template)

allocates a virtual machine description from the given template string

Arguments

template
a string containing the template of the vm
cancel()

Cancels a running VM

delete()

Deletes current object from the pool

deploy(host_id)

initiates the instance of the given vmid on the target host

Arguments

host_id
the host id (hid) of the target host where the VM will be instantiated.
finalize()

Deletes a VM from the pool and DB

hold()

Sets a VM to hold state, scheduler will not deploy it

info(*args)
live_migrate(dest_host)

live migrates virtual machine to the target host

Arguments

dest_host
the target host id
migrate(dest_host)

migrates virtual machine to the target host

Arguments

dest_host
the target host id
classmethod new_with_id(client, element_id)

Retrives object which id equals `id`.

Arguments

`client`
oca.Client object.
`element_id
object id.
release()

Releases a VM from hold state

restart()

Resubmits the VM after failure

resubmit()

Redeploy the VM.

resume()

Resumes the execution of a saved VM

save_disk(disk_id, dest_disk)

Sets the disk to be saved in the given image

Arguments

disk_id
disk id of the disk we want to save
dest_disk
image id where the disk will be saved.
short_lcm_state

Short string representation of virtual machine LCM state. One of: init, prol, boot, runn, migr, save, save, save, migr, prol, epil, shut, shut, fail, dele, unkn

short_state

Short string representation of virtual machine state. One of: init, pend, hold, actv, stop, susp, done, fail

shutdown()

Shutdowns an already deployed VM

stop()

Stops a running VM

str_lcm_state

String representation of virtual machine LCM state. One of: LCM_INIT, PROLOG, BOOT, RUNNING, MIGRATE, SAVE_STOP, SAVE_SUSPEND, SAVE_MIGRATE, PROLOG_MIGRATE, PROLOG_RESUME, EPILOG_STOP, EPILOG, SHUTDOWN, CANCEL, FAILURE, DELETE, UNKNOWN

str_state

String representation of virtual machine state. One of: INIT, PENDING, HOLD, ACTIVE, STOPPED, SUSPENDED, DONE, FAILED

suspend()

Saves a running VM

class oca.VirtualMachinePool(client)

Bases: oca.pool.Pool

info(filter=-3, range_start=-1, range_end=-1, vm_state=-1)

Retrives/Refreshes virtual machine pool information

filter
Filter flag. By defaults retrives only connected user reources.
range_start
Range start ID. -1 for all
range_end
Range end ID. -1 for all

vm_state

VM state to filter by.

  • -2 Any state, including DONE
  • -1 Any state, except DONE (Defualt)
  • 0 INIT
  • 1 PENDING
  • 2 HOLD
  • 3 ACTIVE
  • 4 STOPPED
  • 5 SUSPENDED
  • 6 DONE
  • 7 FAILED

Previous topic

oca.template

This Page