565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
|
# File 'lib/puppet/util/hpe3par_api.rb', line 565
def convert_volume_type(name, user_cpg, type,
keep_vv = nil, compression = false, wait_for_task_to_end = false, debug = false)
cl = Hpe3parSdk::Client.new(@rest_url, debug: debug)
begin
cl.login(@url.user, @url.password)
new_vol_type = get_volume_type(type)
task = cl.tune_volume(name, Hpe3parSdk::VolumeTuneOperation::USR_CPG,
{:userCPG => user_cpg,
:conversionOperation => Hpe3parSdk::VolumeConversionOperation.const_get(new_vol_type),
:keepVV => keep_vv,
:compression => compression
})
if wait_for_task_to_end
Puppet.info("Waiting for type conversion task of volume #{name} to complete")
cl.wait_for_task_to_end(task.task_id)
end
Puppet.info("Volume #{name} type changed to #{type} successfully")
rescue Hpe3parSdk::HTTPConflict => ex
Puppet.err(ex.message)
Puppet.err('An error occured. This maybe due to the existence of a back-up volume (using the keepvv option) created during a previous run.')
raise ex
rescue Hpe3parSdk::HPE3PARException => ex
Puppet.err(ex.message)
raise ex
ensure
cl.logout
end
end
|