Revision d05e5324 snf-cyclades-app/synnefo/logic/utils.py
b/snf-cyclades-app/synnefo/logic/utils.py | ||
---|---|---|
101 | 101 |
return int(ns) |
102 | 102 |
|
103 | 103 |
|
104 |
def id_to_disk_name(id): |
|
105 |
return "%svol-%s" % (settings.BACKEND_PREFIX_ID, str(id)) |
|
106 |
|
|
107 |
|
|
104 | 108 |
def get_rsapi_state(vm): |
105 | 109 |
"""Returns the API state for a virtual machine |
106 | 110 |
|
... | ... | |
175 | 179 |
def get_action_from_opcode(opcode, job_fields): |
176 | 180 |
if opcode == "OP_INSTANCE_SET_PARAMS": |
177 | 181 |
nics = job_fields.get("nics") |
182 |
disks = job_fields.get("disks") |
|
178 | 183 |
beparams = job_fields.get("beparams") |
179 | 184 |
if nics: |
180 | 185 |
try: |
... | ... | |
187 | 192 |
return None |
188 | 193 |
except: |
189 | 194 |
return None |
195 |
if disks: |
|
196 |
try: |
|
197 |
disk_action = disks[0][0] |
|
198 |
if disk_action == "add": |
|
199 |
return "ATTACH_VOLUME" |
|
200 |
elif disk_action == "remove": |
|
201 |
return "DETACH_VOLUME" |
|
202 |
else: |
|
203 |
return None |
|
204 |
except: |
|
205 |
return None |
|
190 | 206 |
elif beparams: |
191 | 207 |
return "RESIZE" |
192 | 208 |
else: |
Also available in: Unified diff