Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions oca/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ class Image(PoolElement):
READY = 1
USED = 2
DISABLED = 3
IMAGE_STATES = ['INIT', 'READY', 'USED', 'DISABLED']
IMAGE_STATES = ['INIT', 'READY', 'USED', 'DISABLED', 'LOCKED', 'ERROR', 'CLONE', 'DELETE', 'USED_PERS']

SHORT_IMAGE_STATES = {
"INIT": "init",
"READY": "rdy",
"USED": "used",
"DISABLED": "disa"
"DISABLED": "disa",
"LOCKED": "lock",
"ERROR": "err",
"CLONE": "clon",
"DELETE": "dele",
"USED_PERS": "used"
}

IMAGE_TYPES = ['OS', 'CDROM', 'DATABLOCK']
Expand Down Expand Up @@ -161,15 +166,15 @@ def clone(self, name='', datastore_id=-1):
def str_state(self):
"""
String representation of image state.
One of 'INIT', 'READY', 'USED', 'DISABLED'
One of 'INIT', 'READY', 'USED', 'DISABLED', 'LOCKED', 'ERROR', 'CLONE', 'DELETE', 'USED_PERS'
"""
return self.IMAGE_STATES[int(self.state)]

@property
def short_state(self):
"""
Short string representation of image state.
One of 'init', 'rdy', 'used', 'disa'
One of 'init', 'rdy', 'used', 'disa', 'lock', 'err', 'clon', 'dele', 'used'
"""
return self.SHORT_IMAGE_STATES[self.str_state]

Expand Down