Revision 7d81bb8b lib/storage/extstorage.py
b/lib/storage/extstorage.py | ||
---|---|---|
248 | 248 |
" ExtStorage provider for the '%s' hypervisor" |
249 | 249 |
% (self.driver, hypervisor)) |
250 | 250 |
|
251 |
def Snapshot(self, snapshot_name): |
|
252 |
"""Take a snapshot of the block device. |
|
253 |
|
|
254 |
""" |
|
255 |
# Call the External Storage's setinfo script, |
|
256 |
# to set metadata for an existing Volume inside the External Storage |
|
257 |
_ExtStorageAction(constants.ES_ACTION_SNAPSHOT, self.unique_id, |
|
258 |
self.ext_params, snapshot_name=snapshot_name) |
|
259 |
|
|
251 | 260 |
|
252 | 261 |
def _ExtStorageAction(action, unique_id, ext_params, |
253 | 262 |
size=None, grow=None, metadata=None, |
254 |
name=None, uuid=None): |
|
263 |
name=None, uuid=None, snapshot_name=None):
|
|
255 | 264 |
"""Take an External Storage action. |
256 | 265 |
|
257 | 266 |
Take an External Storage action concerning or affecting |
... | ... | |
287 | 296 |
|
288 | 297 |
# Create the basic environment for the driver's scripts |
289 | 298 |
create_env = _ExtStorageEnvironment(unique_id, ext_params, size, |
290 |
grow, metadata, name, uuid) |
|
299 |
grow, metadata, name, uuid, |
|
300 |
snapshot_name) |
|
291 | 301 |
|
292 | 302 |
# Do not use log file for action `attach' as we need |
293 | 303 |
# to get the output from RunResult |
... | ... | |
399 | 409 |
detach_script=es_files[constants.ES_SCRIPT_DETACH], |
400 | 410 |
setinfo_script=es_files[constants.ES_SCRIPT_SETINFO], |
401 | 411 |
verify_script=es_files[constants.ES_SCRIPT_VERIFY], |
412 |
snapshot_script=es_files[constants.ES_SCRIPT_SNAPSHOT], |
|
402 | 413 |
supported_parameters=parameters) |
403 | 414 |
return True, es_obj |
404 | 415 |
|
405 | 416 |
|
406 | 417 |
def _ExtStorageEnvironment(unique_id, ext_params, |
407 | 418 |
size=None, grow=None, metadata=None, |
408 |
name=None, uuid=None): |
|
419 |
name=None, uuid=None, snapshot_name=None):
|
|
409 | 420 |
"""Calculate the environment for an External Storage script. |
410 | 421 |
|
411 | 422 |
@type unique_id: tuple (driver, vol_name) |
... | ... | |
450 | 461 |
if uuid is not None: |
451 | 462 |
result["VOL_UUID"] = uuid |
452 | 463 |
|
464 |
if snapshot_name is not None: |
|
465 |
result["VOL_SNAPSHOT_NAME"] = snapshot_name |
|
466 |
|
|
453 | 467 |
return result |
454 | 468 |
|
455 | 469 |
|
Also available in: Unified diff