Method: HPE3PAR_API#change_snap_cpg

Defined in:
lib/puppet/util/hpe3par_api.rb

#change_snap_cpg(name, snap_cpg, wait_for_task_to_end, debug = false) ⇒ Object



527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
# File 'lib/puppet/util/hpe3par_api.rb', line 527

def change_snap_cpg(name, snap_cpg, wait_for_task_to_end, debug = false)
  cl = Hpe3parSdk::Client.new(@rest_url, debug: debug)
  begin
    cl.(@url.user, @url.password)
    task = cl.tune_volume(name, Hpe3parSdk::VolumeTuneOperation::SNP_CPG,
                          {:snapCPG => snap_cpg})
    if wait_for_task_to_end
      Puppet.info("Waiting for change snap CPG task of volume #{name} to complete")
      cl.wait_for_task_to_end(task.task_id)
    end
    Puppet.info("Snap CPG of Volume #{name} changed to #{snap_cpg} successfully")
  rescue Hpe3parSdk::HPE3PARException => ex
    Puppet.err(ex.message)
    raise ex
  ensure
    cl.logout
  end
end