oca.image

class oca.Image(xml, client)

Bases: oca.pool.PoolElement

DISABLED = 3
ELEMENT_NAME = 'IMAGE'
IMAGE_STATES = ['INIT', 'READY', 'USED', 'DISABLED']
IMAGE_TYPES = ['OS', 'CDROM', 'DATABLOCK']
INIT = 0
METHODS = {'info': 'image.info', 'chown': 'image.chown', 'enable': 'image.enable', 'allocate': 'image.allocate', 'persistent': 'image.persistent', 'update': 'image.update', 'publish': 'image.publish', 'delete': 'image.delete'}
READY = 1
SHORT_IMAGE_STATES = {'READY': 'rdy', 'DISABLED': 'disa', 'INIT': 'init', 'USED': 'used'}
SHORT_IMAGE_TYPES = {'CDROM': 'CD', 'DATABLOCK': 'DB', 'OS': 'OS'}
USED = 2
XML_TYPES = {'uid': <type 'int'>, 'regtime': <type 'int'>, 'uname': <type 'str'>, 'gname': <type 'str'>, 'id': <type 'int'>, 'name': <type 'str'>, 'persistent': <type 'int'>, 'source': <type 'str'>, 'state': <type 'int'>, 'gid': <type 'int'>, 'running_vms': <type 'int'>, 'template': ['TEMPLATE', <class 'oca.pool.Template'>], 'type': <type 'int'>, 'public': <type 'int'>}
static allocate(client, template)

Allocates a new image in OpenNebula

Arguments

client
oca.Client object
template
a string containing the template of the image
chown(uid, gid)

Changes the owner/group

Arguments

uid
New owner id. Set to -1 to leave current value
gid
New group id. Set to -1 to leave current value
delete()

Deletes current object from the pool

disable()

Disables an image

enable()

Enables an image

info(*args)
classmethod new_with_id(client, element_id)

Retrives object which id equals `id`.

Arguments

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

Publishes an image

set_nonpersistent()

Set Image as non persistent

set_persistent()

Set Image as persistent

short_state

Short string representation of image state. One of ‘init’, ‘rdy’, ‘used’, ‘disa’

short_type

Short string representation of image type. One of ‘OS’, ‘CD’, ‘DB’

str_state

String representation of image state. One of ‘INIT’, ‘READY’, ‘USED’, ‘DISABLED’

str_type

String representation of image type. One of ‘OS’, ‘CDROM’, ‘DATABLOCK’

unpublish()

Unpublishes an image

update(template)

Replaces the template contents

Arguments

template
New template contents
class oca.ImagePool(client)

Bases: oca.pool.Pool

METHODS = {'info': 'imagepool.info'}

Previous topic

oca.host

Next topic

oca.virtualnetwork

This Page