Revision 06c2fb4a lib/bdev.py

b/lib/bdev.py
3149 3149
    _ExtStorageAction(constants.ES_ACTION_SETINFO, self.unique_id,
3150 3150
                      self.ext_params, metadata=text)
3151 3151

  
3152
  def Snapshot(self, snapshot_name):
3153
    """Take a snapshot of the block device.
3154

  
3155
    """
3156
    # Call the External Storage's setinfo script,
3157
    # to set metadata for an existing Volume inside the External Storage
3158
    _ExtStorageAction(constants.ES_ACTION_SNAPSHOT, self.unique_id,
3159
                      self.ext_params, snapshot_name=snapshot_name)
3160

  
3152 3161

  
3153 3162
def _ExtStorageAction(action, unique_id, ext_params,
3154
                      size=None, grow=None, metadata=None):
3163
                      size=None, grow=None, metadata=None,
3164
                      snapshot_name=None):
3155 3165
  """Take an External Storage action.
3156 3166

  
3157 3167
  Take an External Storage action concerning or affecting
......
3183 3193

  
3184 3194
  # Create the basic environment for the driver's scripts
3185 3195
  create_env = _ExtStorageEnvironment(unique_id, ext_params, size,
3186
                                      grow, metadata)
3196
                                      grow, metadata, snapshot_name)
3187 3197

  
3188 3198
  # Do not use log file for action `attach' as we need
3189 3199
  # to get the output from RunResult
......
3295 3305
                       detach_script=es_files[constants.ES_SCRIPT_DETACH],
3296 3306
                       setinfo_script=es_files[constants.ES_SCRIPT_SETINFO],
3297 3307
                       verify_script=es_files[constants.ES_SCRIPT_VERIFY],
3308
                       snapshot_script=es_files[constants.ES_SCRIPT_SNAPSHOT],
3298 3309
                       supported_parameters=parameters)
3299 3310
  return True, es_obj
3300 3311

  
3301 3312

  
3302 3313
def _ExtStorageEnvironment(unique_id, ext_params,
3303
                           size=None, grow=None, metadata=None):
3314
                           size=None, grow=None, metadata=None,
3315
                           snapshot_name=None):
3304 3316
  """Calculate the environment for an External Storage script.
3305 3317

  
3306 3318
  @type unique_id: tuple (driver, vol_name)
......
3335 3347
  if metadata is not None:
3336 3348
    result["VOL_METADATA"] = metadata
3337 3349

  
3350
  if snapshot_name is not None:
3351
    result["VOL_SNAPSHOT_NAME"] = snapshot_name
3352

  
3338 3353
  return result
3339 3354

  
3340 3355

  

Also available in: Unified diff