B OpenNebula/one#7402: Fix NetApp provisioning (#4661)

on SnapMirror-protected SVMs

Signed-off-by: Neal Hansen <nhansen@opennebula.io>
This commit is contained in:
Neal authored and GitHub committed 2026-10-28 18:15:01 +01:00
1 parent a4d4ca0c10
commit 44b3d83cbe
9 files changed
+886 -163

No files matched your search

+10 -11
View File
@@ -67,6 +67,10 @@ begin
else
TransferManager::NetApp::Volume::DEFAULT_GROW_RATIO
end
always_copy = ds_hash.key?('NETAPP_ALWAYS_COPY') &&
ds_hash['NETAPP_ALWAYS_COPY'].upcase == 'YES'
mode = always_copy ? :copy : :independent
raise 'Missing required datastore attributes' unless ds_id && base_path && src_path
rescue StandardError => e
@@ -104,13 +108,7 @@ begin
end
adjusted_size = (source_volume['size'].to_i * (1 + netapp_reserve / 100.0)).ceil
new_volume_data= {
'name' => new_volume_name,
'clone' => {
'parent_volume' => { 'uuid' => source_volume.uuid },
'parent_snapshot' => { 'uuid' => source_vol_goldensnap.uuid },
'is_flexclone' => true
},
extra_payload = {
'autosize' => {
'grow_threshold' => grow_threshold,
'maximum' => "#{adjusted_size * grow_ratio}MB",
@@ -119,8 +117,10 @@ begin
}
}
new_volume = svm.clone_volume(new_volume_data).tap(&:fetch_data)
new_volume.split_flexclone
new_volume = svm.provision_disk_volume(
source_vol_goldensnap, new_volume_name, new_lun_name,
:mode => mode, :extra_payload => extra_payload
)
new_lun = new_volume.lun
OpenNebula::DriverLogger.log_info "Cloned volume #{source_volume.name} to #{new_volume.name}"
@@ -130,8 +130,7 @@ begin
exit 1
end
new_lun.rename(new_lun_name)
OpenNebula::DriverLogger.log_info "Renamed LUN to #{new_lun.name}"
OpenNebula::DriverLogger.log_info "LUN ready at #{new_lun.name}"
puts new_lun.name
rescue StandardError => e
+107 -17
View File
@@ -29,6 +29,36 @@ def get_image_format(src_path)
rc.code != 0 ? nil : JSON.parse(rc.stdout)['format']
end
# Types downloader.sh would decompress or unarchive on the way to the temporary
# file. Anything else is written out with a plain cat.
DOWNLOADER_TYPES = [
'application/x-gzip',
'application/gzip',
'application/x-bzip2',
'application/x-xz',
'application/x-tar',
'application/zip'
].freeze
# True when the image is a local file qemu-img can read as it is, so the copy
# into the temporary directory buys nothing. Transport schemes (http, ssh, s3,
# netapp, ...) and anything the downloader would decompress still need it.
def local_image?(action, path)
return false if path.nil? || path.empty?
return false if path =~ %r{\A[a-zA-Z][a-zA-Z0-9+.-]*://}
return false unless File.file?(path) && File.readable?(path)
rc = action.ssh({
:cmds => "file -b --mime-type #{path}",
:host => false,
:nostdout => false,
:silent => true
})
return false if rc.code != 0
!DOWNLOADER_TYPES.include?(rc.stdout.strip)
end
# Fetch arguments
daction64 = STDIN.read
request_id = ARGV[0]
@@ -137,10 +167,17 @@ begin
OpenNebula::DriverLogger.log_info "Discovered device: #{device_path}"
rescue StandardError => e
lun.lun_map.remove_connection(false, :force => true) if lun.lun_map
OpenNebula::DriverLogger.log_error "Failed to setup LUN and map for #{lun_name}: #{e.message}"
begin
lun.lun_map.remove_connection(false, :force => true) if lun.lun_map
rescue StandardError => ce
OpenNebula::DriverLogger.log_error \
"Failed to remove connection for #{lun_name}: #{ce.message}"
end
lun.delete_with_map
volume.delete
OpenNebula::DriverLogger.log_error "Failed to setup LUN and map for #{lun_name}: #{e.message}"
raise
end
@@ -158,25 +195,63 @@ begin
real_device_path = rc.stdout.strip
temp_file = File.join(tmp_dir, "temp_image_#{volume.name}.qcow2")
if local_image?(cp, src_path)
image_file = src_path
download_command = "#{downloader_command} #{src_path} #{temp_file}"
rc = cp.ssh({
:cmds => "DRV_ACTION='#{daction64}' #{download_command}",
:host => false,
:err_msg => "Failed to download #{src_path} to #{temp_file}",
:nostderr => false
})
if rc.code != 0
OpenNebula::DriverLogger.log_error "Downloader STDERR: #{rc.stderr}"
exit(rc.code)
OpenNebula::DriverLogger.log_info \
"Converting local image #{src_path} in place"
else
temp_file = File.join(tmp_dir, "temp_image_#{volume.name}.qcow2")
image_file = temp_file
download_command = "#{downloader_command} #{src_path} #{temp_file}"
rc = cp.ssh({
:cmds => "DRV_ACTION='#{daction64}' #{download_command}",
:host => false,
:err_msg => "Failed to download #{src_path} to #{temp_file}",
:nostderr => false
})
if rc.code != 0
OpenNebula::DriverLogger.log_error "Downloader STDERR: #{rc.stderr}"
exit(rc.code)
end
end
convert_command = "qemu-img convert -O raw #{temp_file} #{real_device_path}"
# qemu-img only reports "Cannot grow device files" when the device is
# smaller than the image it has to hold. That can be a stale capacity
# for a LUN id the kernel has seen before, so refresh it before giving
# up, and report the actual numbers when it is still too small.
info_command = "qemu-img info --output=json #{image_file}"
rc = cp.ssh({
:cmds => info_command,
:host => false,
:err_msg => "Failed to get image info for #{image_file}",
:nostdout => false
})
exit(rc.code) if rc.code != 0
img_size = JSON.parse(rc.stdout)['virtual-size'].to_i
dev_size = lun.lun_map.device_size_b(false, real_device_path)
if dev_size < img_size
OpenNebula::DriverLogger.log_info \
"Device #{device_path} reports #{dev_size}B for a #{img_size}B " \
'image, refreshing its capacity'
dev_size = lun.lun_map.refresh_size(false, device_path)
end
if dev_size < img_size
raise "Device #{device_path} is too small for #{src_path}: " \
"#{dev_size} bytes on the device, #{img_size} bytes of image " \
"(LUN #{lun_name} was created with #{src_size}M from IMAGE/SIZE)"
end
convert_command = "qemu-img convert -O raw #{image_file} #{real_device_path}"
rc = cp.ssh({
:cmds => convert_command,
:host => false,
:err_msg => "Failed to convert #{temp_file} to #{device_path}",
:err_msg => "Failed to convert #{image_file} to #{device_path}",
:nostderr => false
})
if rc.code != 0
@@ -192,7 +267,14 @@ begin
puts "#{lun_name} raw"
rescue StandardError => e
OpenNebula::DriverLogger.log_error "Failed to setup data for LUN #{lun_name}: #{e.message}"
lun.lun_map.remove_connection(false, :force => true)
begin
lun.lun_map.remove_connection(false, :force => true)
rescue StandardError => ce
OpenNebula::DriverLogger.log_error \
"Failed to remove connection for #{lun_name}: #{ce.message}"
end
lun.delete_with_map
lun_cleaned = true
volume.delete
@@ -200,7 +282,15 @@ rescue StandardError => e
raise
ensure
unless lun_cleaned
lun.lun_map.remove_connection(false, :force => true)
# A failed detach must not skip the unmap: leaving the LUN mapped
# leaks the volume and burns a LUN ID in the igroup
begin
lun.lun_map.remove_connection(false, :force => true)
rescue StandardError => e
OpenNebula::DriverLogger.log_error \
"Failed to remove connection for #{lun_name}: #{e.message}"
end
lun.lun_map.delete
end
FileUtils.rm_rf(temp_file) if temp_file
+11 -1
View File
@@ -49,7 +49,17 @@ begin
auth = Base64.strict_encode64("#{netapp_user}:#{netapp_pass}")
netapp = TransferManager::NetApp.new(auth, netapp_host, netapp_target, :action => rm)
img_vol = TransferManager::NetApp::Volume.new({ 'name' => vol_name }, netapp)
begin
img_vol = TransferManager::NetApp::Volume.new({ 'name' => vol_name }, netapp)
rescue TransferManager::NetApp::Volume::VolumeMissing
# A persistent image whose VM never handed it back still carries that
# VM's disk name; ln records the image's own name in the comment
img_vol = TransferManager::NetApp::Volume.find_by_comment(netapp, vol_name)
raise unless img_vol
OpenNebula::DriverLogger.log_info \
"Volume #{vol_name} for image ID #{image_id} found as #{img_vol.name}"
end
begin
img_lun = img_vol.lun
+249 -13
View File
@@ -70,6 +70,12 @@ end
# for taking backups or other actions.
module Iscsi
# A NetApp-style WWN ends with the LUN serial number in hex, which is how a
# discovered device can be tied back to the LUN that should be behind it.
def self.serial_to_wwn_tail(serial)
serial.to_s.each_byte.map {|b| format('%02x', b) }.join
end
WWN_TYPES = { 't10.' => '1', 'eui.' => '2', 'naa.' => '3' }
SCSI_SCAN_COMMAND = "echo '%s %s %s' | sudo tee " \
@@ -91,8 +97,20 @@ module Iscsi
sessions_data = portal_sessions(host, @provider.target)
sessions_data.each do |session|
current_path = format(path_base, session[:portal], @provider.target, id)
current_device = sd_from_path(host, current_path)
current_path = format(path_base, session[:portal], @provider.target, id)
# A session with no path to this LUN is legitimate (selective LUN
# map, a down/half-open session). Skip it instead of handing the
# by-path string downstream as if it were a device.
begin
current_device = sd_from_path(host, current_path, :retries => 0)
rescue StandardError => e
OpenNebula::DriverLogger.log_warning \
"No device for LUN #{id} on portal #{session[:portal]}, " \
"skipping path: #{e.message}"
next
end
@by_path_devices << current_device if current_device
end
@@ -111,15 +129,17 @@ module Iscsi
raise "Failed to access the device #{path} on host #{host}"
end
def sd_from_path(host, path)
def sd_from_path(host, path, retries: 60)
@__sd_cache ||= {}
key = [host, path].join('|')
return @__sd_cache[key] if @__sd_cache.key?(key)
dev = nil
with_retry(:retries => 60, :delay => 0.50) do
with_retry(:retries => retries, :delay => 0.50) do
# -e (not -f) so a path whose target does not exist fails here
# instead of echoing the path back as if it were a device
rc = @provider.action.ssh(
:cmds => "readlink -f #{path}",
:cmds => "readlink -e #{path}",
:host => host,
:nostdout => false,
:silent => true
@@ -137,7 +157,10 @@ module Iscsi
def remove_scsi_device(host, device, flush: true)
device = sd_from_path(host, device) unless device.start_with?('/dev/sd')
path = format('/sys/block/%s/device/delete', device.gsub('/dev/', ''))
return unless device.start_with?('/dev/sd')
name = device.delete_prefix('/dev/')
path = "/sys/block/#{name}/device/delete"
begin
flush_device_io(host, device) if flush
@@ -146,16 +169,32 @@ module Iscsi
end
with_retry do
break unless scsi_device_present?(host, name)
rc = @provider.action.ssh(
:cmds => "echo 1 | sudo tee #{path} >/dev/null",
:host => host,
:nostderr => false,
:silent => true
)
raise "Could not remove SCSI device #{device}" if rc.code != 0
break if rc.code == 0 && !scsi_device_present?(host, name)
raise "Could not remove SCSI device #{device} " \
"(rc=#{rc.code}): #{rc.stderr.strip}"
end
end
def scsi_device_present?(host, name)
rc = @provider.action.ssh(
:cmds => "test -e /sys/block/#{name}",
:host => host,
:nostderr => true,
:silent => true
)
rc.code == 0
end
def wait_for_device_removal(host, devices)
list = devices.map {|d| "/dev/#{d}" }.join(' ')
script = <<~BASH
@@ -656,9 +695,11 @@ module Iscsi
:nostdout => false,
:silent => true
)
return if rc.code != 0
paths = rc.stdout.to_s.split("\n").compact
# A session that vanished between listing and lookup has no
# entry; fall through to the raise rather than returning nil,
# which callers would index
paths = rc.code == 0 ? rc.stdout.to_s.split("\n").compact : []
end
if paths.empty?
@@ -733,7 +774,7 @@ module Iscsi
return unless mdev_exists
devices = lines[3..-1].each_with_object([]) do |line, arr|
devices = Array(lines[3..-1]).each_with_object([]) do |line, arr|
next if line.include?('policy') || line.strip.empty?
# Skip lines with tree characters (like "|-", "`-", etc.)
@@ -789,6 +830,34 @@ module Iscsi
rc.stdout
end
def refresh_size(host, device_path)
by_path_devices(host).each do |sd_path|
device = device_info(host, sd_path)
device_id = "#{device[:host]}:#{device[:channel]}:#{device[:id]}:#{id}"
@provider.action.ssh(
:cmds => "echo '1' | sudo tee " \
"/sys/bus/scsi/drivers/sd/#{device_id}/rescan >/dev/null",
:host => host,
:nostderr => false
)
end
if multipath_running?(host)
map = device_path
map = File.basename(map) if map.start_with?('/dev/mapper/')
begin
multipath_resize_map(host, map)
rescue StandardError => e
OpenNebula::DriverLogger.log_warning \
"Could not resize multipath map #{map}: #{e.message}"
end
end
device_size_b(host, device_path)
end
def update_size(host, original_size, multipath: true)
device_paths = by_path_devices(host)
@@ -837,6 +906,123 @@ module Iscsi
new_size
end
# Removes devices that sit at this LUN id on the target's sessions but
# report another LUN, left behind when that LUN was unmapped or deleted
# without the host being cleaned up. The kernel does not re-probe an id
# that still has a device, so until it is gone the LUN just mapped never
# shows up there.
#
# Only devices that are provably dead are removed: not held by any
# device-mapper map, and the provider confirms (stale_lun_released?) that
# the LUN they report is gone from the array or mapped nowhere. Anything
# else is left in place for foreign_device? to report. Runs before the
# scan, so a by-path link shared by several sessions to one portal cannot
# keep resolving to a stale device on one of them.
def clear_stale_devices(host, sessions, lun_id)
return unless respond_to?(:expected_wwn) && respond_to?(:stale_lun_released?)
expected = expected_wwn
return if expected.nil? || expected.empty?
globs = sessions.map do |s|
"/sys/class/iscsi_session/session#{s[:session]}/device/target*/*:#{lun_id}/block/*"
end
script = <<~BASH
for b in #{globs.join(' ')}; do
[ -e "$b" ] || continue
n=$(basename "$b")
h=$(ls "/sys/block/$n/holders" 2>/dev/null | wc -l)
w=$(cat "/sys/block/$n/device/wwid" 2>/dev/null)
echo "$n $h $w"
done
BASH
rc = @provider.action.ssh(
:cmds => script,
:host => host,
:nostdout => false,
:silent => true
)
return if rc.code != 0
released = Hash.new {|h, wwid| h[wwid] = stale_lun_released?(wwid) }
stale = []
rc.stdout.to_s.split("\n").each do |line|
name, holders, wwid = line.split(' ', 3)
next if wwid.nil? || wwid.empty?
next if wwid.downcase.end_with?(expected.downcase)
if holders.to_i > 0
OpenNebula::DriverLogger.log_warning \
"Stale device /dev/#{name} at LUN #{lun_id} reports #{wwid} but is " \
'held by a device-mapper map; leaving it in place'
next
end
stale << name if released[wwid]
end
return if stale.empty?
cmd = stale.map do |name|
"echo 1 | sudo tee /sys/block/#{name}/device/delete >/dev/null"
end.join(' ; ')
@provider.action.ssh(
:cmds => cmd,
:host => host,
:err_msg => "Could not remove stale devices #{stale.join(', ')}"
)
wait_for_device_removal(host, stale)
@__sd_cache&.delete_if {|_, dev| stale.include?(File.basename(dev.to_s)) }
OpenNebula::DriverLogger.log_warning \
"Removed stale devices #{stale.join(', ')} at LUN #{lun_id}: the LUN " \
'they reported is no longer mapped on the array'
rescue StandardError => e
OpenNebula::DriverLogger.log_warning \
"Could not clear stale devices at LUN #{lun_id}: #{e.message}"
end
# True when the device at our by-path is not the LUN we mapped, because a
# LUN that held this id earlier was unmapped without the host being cleaned
# up. Reports and skips the path. Devices that are provably dead have
# already been removed by clear_stale_devices; one that is still here could
# not be shown dead (it is held by a map, or its LUN still has a mapping,
# possibly through an id that is not ours), so it is left alone.
def foreign_device?(host, dev)
return false unless respond_to?(:expected_wwn)
expected = expected_wwn
return false if expected.nil? || expected.empty?
actual = sysfs_wwid(host, [dev]).to_s
return false if actual.empty?
return false if actual.downcase.end_with?(expected.downcase)
OpenNebula::DriverLogger.log_warning \
"Device #{dev} at LUN #{id} reports #{actual}, which is not the LUN " \
'just mapped. Skipping it as stale; the host needs a SCSI rescan ' \
'to clear it.'
true
end
def verify_wwn(wwn, devices)
return unless respond_to?(:expected_wwn)
expected = expected_wwn
return if expected.nil? || expected.empty?
return if wwn.to_s.downcase.end_with?(expected.downcase)
raise "Device #{devices} for LUN #{id} reports WWN #{wwn}, which does " \
"not match the expected serial (#{expected}). Likely " \
'a stale device from a LUN that previously held this id.'
end
def multipath_add_wwid(host, wwid)
rc = @provider.action.ssh(
:cmds => "sudo multipath -a #{wwid}",
@@ -955,6 +1141,7 @@ module Iscsi
def setup_disk(host: false)
device_path = '/dev/disk/by-path/ip-%s-iscsi-%s-lun-%s'
warned = {}
with_retry(RuntimeError, :retries => 3, :delay => 1) do
sessions_data = portal_sessions(host, @provider.target)
@@ -965,6 +1152,8 @@ module Iscsi
mutex = Mutex.new
lun_id = id
clear_stale_devices(host, sessions_data, lun_id)
threads = sessions_data.map do |session|
Thread.new do
begin
@@ -975,22 +1164,67 @@ module Iscsi
wait_for_path(host, path)
dev = sd_from_path(host, path)
if foreign_device?(host, dev)
raise "#{path} holds a stale device for another LUN"
end
mutex.synchronize { devices << dev }
rescue StandardError => e
mutex.synchronize { errors << e }
mutex.synchronize do
errors << "portal #{session[:portal]}: #{e.message}"
end
end
end
end
threads.each(&:join)
# Surface paths that never showed up even when others did: the
# copy will succeed on the remaining paths and the failure would
# otherwise only appear at teardown.
errors.each do |error|
next if warned[error]
warned[error] = true
OpenNebula::DriverLogger.log_warning \
"No path to LUN #{lun_id} via #{error}"
end
if devices.empty?
raise(errors.last || \
"No devices discovered for #{sessions_data.map {|s| s[:portal] }.join(', ')}")
mapping = respond_to?(:describe) ? describe : "LUN #{lun_id}"
portals = sessions_data.map {|s| s[:portal] }.join(', ')
reason = errors.empty? ? '' : ": #{errors.last}"
raise "No device for #{mapping} on any portal (#{portals})#{reason}"
end
devices.each {|dev| multipath_add_path(host, dev) }
mpath = find_multipath_device(host, devices.first)
if mpath.nil? && devices.size == 1
# With find_multipaths enabled multipathd will not build a map
# for a device with a single path unless its WWID is already
# known, and a LUN that only some of the portals report
# legitimately has one path. Register it rather than failing the
# deployment over a working, if degraded, device.
wwid = scsi_wwn(host, devices.first)
if wwid && !wwid.empty?
OpenNebula::DriverLogger.log_warning \
"LUN #{lun_id} was found on a single path " \
"(#{devices.first}): registering WWID #{wwid} so " \
'multipath can map it'
multipath_add_wwid(host, wwid)
multipath_reconfigure(host)
multipath_add_path(host, devices.first)
mpath = find_multipath_device(host, devices.first)
end
end
raise "Could not find multipath device for #{devices}" if mpath.nil?
wait_for_mpath_device(host, mpath)
@@ -998,6 +1232,8 @@ module Iscsi
wwn = sysfs_wwn(host, devices, mpath)
raise "Could not get WWN for multipath device #{mpath}" if wwn.nil?
verify_wwn(wwn, devices)
wwn_path = "/dev/mapper/#{wwn}"
wait_for_rw(host, wwn, wwn_path)
return "/dev/mapper/#{wwn}"
+423 -44
View File
@@ -83,23 +83,29 @@ module TransferManager
attr_reader :message, :code, :body
# Error codes
ENTRY_MISSING = 4
DUPLICATE_VOLUME = 917526
VOLUME_BUSY_CREATING = 524409
SNAPSHOT_EXISTS = 525059
VOLUME_OFFLINE = 1245265
LUN_UNAVAILABLE = 5374898
def initialize(message, response = nil)
super(message)
@message = message
return unless response
response = JSON.parse(response) if response.is_a?(String)
@code = response.dig('error', 'code').to_s
@message = response.dig('error', 'message')
@body = response
api_message = response.dig('error', 'message')
@message = api_message if api_message
@message = "#{@message} (NetApp error code: #{@code})" \
unless @code.nil? || @code.empty?
rescue JSON::ParserError
@code = nil
@body = response
@message = nil
end
end
@@ -113,6 +119,32 @@ module TransferManager
return true, { 'uuid' => uuid }
end
# ONTAP reports failures as a JSON body carrying a numeric code,
# but only a job failure surfaces as API::Error: check_response
# raises Net::HTTPError for any non-2xx, with that body in the
# response. The code has to be dug out of either shape.
def self.error_code(exception)
case exception
when NetApp::API::Error
exception.code.to_i
when Net::HTTPError
JSON.parse(exception.response.body.to_s).dig('error', 'code').to_i
else
0
end
rescue StandardError
0
end
# True when the failure means "that object is not there", which
# ONTAP reports as a 404 carrying error code 4.
def self.not_found?(exception)
return true if error_code(exception) == NetApp::API::Error::ENTRY_MISSING
exception.is_a?(Net::HTTPError) &&
exception.response.code.to_s == '404'
end
def self.get(auth, url, parameters = nil, unpack: true)
headers = build_headers(auth, 'GET')
url = URI.parse(url + build_query_string(parameters))
@@ -193,12 +225,16 @@ module TransferManager
end
def self.check_response(response)
if response.key?('error')
return if response.is_a?(Net::HTTPSuccess)
# ONTAP describes the failure in the response body.
error = parse_error(response)
if error
raise NetApp::API::Error.new(
"API Returned #{response['error']['code']}", response
"API Returned #{error['code']}", { 'error' => error }
)
end
return if response.is_a?(Net::HTTPSuccess)
raise Net::HTTPError.new(
"HTTP Error #{response.code}: #{response.message} ; #{response.body}",
@@ -206,6 +242,20 @@ module TransferManager
)
end
# The 'error' object of a response body, or nil when the body is
# empty or is not the JSON error ONTAP documents.
def self.parse_error(response)
body = response.body
return if body.nil? || body.empty?
parsed = JSON.parse(body)
return unless parsed.is_a?(Hash) && parsed['error'].is_a?(Hash)
parsed['error']
rescue JSON::ParserError
nil
end
end
# Represents a NetApp resource, providing access to its attributes and behavior.
@@ -312,13 +362,79 @@ module TransferManager
def create_volume(data, parameters = nil)
vol_data = build_volume_payload(data)
job, response = create_or_replace(vol_data, parameters)
build_volume_from(job, response)
build_volume_from(job, response, vol_data['name'])
end
def clone_volume(data, parameters = nil)
vol_data = build_clone_payload(data)
job, response = create_or_replace(vol_data, parameters)
build_volume_from(job, response)
build_volume_from(job, response, vol_data['name'])
end
# Provision a new disk volume from a source volume + snapshot and
# return the new Volume, with its LUN already renamed to
# +new_lun_name+.
#
# +mode+ selects how the volume is produced:
# :independent (default) - the new volume must not depend on the
# source snapshot. Normally that means splitting the FlexClone,
# but when the SVM is protected by SVM-level SnapMirror (SVM-DR)
# the split is not allowed, so we fall back to a full LUN copy
# into a freshly created volume. The fallback is triggered either
# up front (the source reports SnapMirror protection) or
# reactively (the split job fails with the SnapMirror error).
# :copy - always take the full-copy path (driven by the
# NETAPP_ALWAYS_COPY datastore attribute), even when the SVM is
# not SnapMirror-protected.
# :thin - return the FlexClone as-is (still depends on the snapshot).
def provision_disk_volume(source_snapshot, new_volume_name, new_lun_name,
mode: :independent, extra_payload: {})
source_volume = source_snapshot.volume
independent = mode != :thin
full_copy = mode == :copy
if independent && (full_copy || source_volume.snapmirror_protected?)
reason = full_copy ? 'NETAPP_ALWAYS_COPY is set' : 'SnapMirror-protected'
OpenNebula::DriverLogger.log_info \
"Provisioning #{new_volume_name} as a full copy (#{reason})"
return full_copy_volume(source_volume, source_snapshot,
new_volume_name, new_lun_name,
extra_payload)
end
payload = {
'name' => new_volume_name,
'clone' => {
'parent_volume' => { 'uuid' => source_volume.uuid },
'parent_snapshot' => { 'uuid' => source_snapshot.uuid },
'is_flexclone' => true
}
}
payload.merge!(extra_payload)
new_volume = clone_volume(payload).tap(&:fetch_data)
new_lun = new_volume.lun
raise "No LUN found for cloned volume #{new_volume.uuid}" unless new_lun
new_lun.rename(new_lun_name)
return new_volume unless independent
begin
new_volume.split_flexclone
unless new_volume.watch_flexclone_split
raise "Timed out splitting FlexClone volume #{new_volume_name}"
end
new_volume
rescue API::Error => e
OpenNebula::DriverLogger.log_info \
"FlexClone error (#{e.message}); " \
"provisioning #{new_volume_name} as a full copy instead"
new_volume.delete rescue nil
full_copy_volume(source_volume, source_snapshot,
new_volume_name, new_lun_name, extra_payload)
end
end
def get_volume_delete_job(uuid)
@@ -372,11 +488,9 @@ module TransferManager
busy_job = Job.new({ 'uuid' => error_job.parse_resource_uuid }, @netapp)
begin
busy_job.watch_until_complete
rescue Net::HTTPError => e
rescue API::Error, Net::HTTPError => e
# Job finished/deleted while we were checking it
raise e unless e.response.code == '404'
rescue API::Error => e
raise e unless e.code == '4' # entry doesn't exist
raise e unless API.not_found?(e)
end
begin
existing = Volume.new({ 'name' => data['name'] }, @netapp)
@@ -391,6 +505,75 @@ module TransferManager
end
end
# Create an independent copy of +source_volume+ (as of
# +source_snapshot+) by creating a fresh volume and doing a
# server-side LUN copy into it. Unlike a FlexClone split this is a
# plain data copy, so it is not blocked by SVM-level SnapMirror.
def full_copy_volume(source_volume, source_snapshot,
new_volume_name, new_lun_name, extra_payload = {})
source_volume.fetch_data(
{ 'fields' => 'size,name,autosize,space.snapshot.reserve_percent' }
)
source_lun = source_volume.lun
source_lun.fetch_data({ 'fields' => 'name,space.size' })
# A FlexClone inherits the parent's geometry, but a freshly
# created volume does not, so carry over the source volume's
# size, snapshot reserve and autosize.
size_mb = (source_volume['size'].to_i / (1024.0 * 1024)).ceil
create_payload = { 'name' => new_volume_name, 'size' => "#{size_mb}M" }
source_autosize = source_volume['autosize']
if source_autosize
create_payload['autosize'] = {
'mode' => source_autosize['mode'],
'minimum' => source_autosize['minimum'],
'maximum' => source_autosize['maximum'],
'grow_threshold' => source_autosize['grow_threshold']
}.compact
end
source_space = source_volume['space']
reserve = source_space && source_space.dig('snapshot', 'reserve_percent')
if reserve
create_payload['space'] =
{ 'snapshot' => { 'reserve_percent' => reserve } }
end
create_payload.merge!(extra_payload)
minimum = create_payload.dig('autosize', 'minimum')
if minimum
minimum = parse_size(minimum.to_s) unless minimum.is_a?(Numeric)
minimum_mb = (minimum / (1024.0 * 1024)).ceil
if minimum_mb > size_mb
size_mb = minimum_mb
create_payload['size'] = "#{size_mb}M"
end
end
new_volume = create_volume(create_payload).tap(&:fetch_data)
begin
# Copy the LUN as it exists in the source snapshot so the copy
# is crash-consistent.
src_lun_leaf = source_lun['name'].split('/').last
source_path = "/vol/#{source_volume.name}" \
"/.snapshot/#{source_snapshot.name}/#{src_lun_leaf}"
dest_path = "/vol/#{new_volume_name}/#{new_lun_name}"
new_lun = new_volume.create_lun_copy(
dest_path, source_path
)
new_lun.watch_copy
new_volume
rescue StandardError
new_volume.delete rescue nil
raise
end
end
def build_volume_payload(data)
base = {
'svm' => { 'uuid' => @uuid },
@@ -417,15 +600,18 @@ module TransferManager
base
end
def build_volume_from(job, response)
def build_volume_from(job, response, name = nil)
return response if response.is_a?(Volume)
if job
# A job response carries only the uuid, so without this the
# volume has no name and every log line about it is blank.
Volume.new({
'uuid' => response['uuid'],
'name' => name,
'svm' => { 'uuid' => @uuid },
'aggregates' => @aggregates
}, @netapp)
}.compact, @netapp)
else
Volume.new(response, @netapp)
end
@@ -472,12 +658,10 @@ module TransferManager
response['uuid'] = @uuid
response['name'] = @name if @name && !response.key?('name')
assign_attributes(response)
rescue Net::HTTPError => e
if e.response.code == '404'
raise VolumeMissing, "No volume found with UUID #{@uuid}"
else
raise e
end
rescue API::Error, Net::HTTPError => e
raise e unless API.not_found?(e)
raise VolumeMissing, "No volume found with UUID #{@uuid}"
end
def find_by_name
@@ -490,12 +674,26 @@ module TransferManager
end
response
rescue Net::HTTPError => e
if e.response.code == '404'
raise VolumeMissing, "No volume found with name #{@name}"
else
raise e
end
rescue API::Error, Net::HTTPError => e
raise e unless API.not_found?(e)
raise VolumeMissing, "No volume found with name #{@name}"
end
# The volume whose comment is exactly +comment+, or nil. ln records
# an image's own volume name there before renaming the volume for a
# VM, so the image can still be found while it carries that name.
def self.find_by_comment(netapp, comment)
url = "#{netapp.base_url}/storage/volumes"
params = { 'comment' => comment, 'fields' => 'comment' }
response = API.get(netapp.auth, url, params, :unpack => false)
records = response.is_a?(Hash) ? Array(response['records']) : []
records = records.select {|r| r['comment'] == comment }
raise "Multiple volumes found with comment #{comment}" if records.size > 1
return if records.empty?
new({ 'uuid' => records.first['uuid'] }, netapp)
end
def monitor
@@ -640,11 +838,74 @@ module TransferManager
return false
end
# True when this volume's SVM is the source of an SVM-level
# SnapMirror relationship (SVM-DR), which is what stops a FlexClone
# of it from being split.
def snapmirror_protected?
fetch_data({ 'fields' => 'svm.name' })
svm_name = case (svm = @data['svm'])
when Hash then svm['name']
else svm.respond_to?(:name) ? svm.name : nil
end
return false if svm_name.nil? || svm_name.empty?
url = "#{@base_url}/snapmirror/relationships"
params = {
'list_destinations_only' => true,
'fields' => 'source.path'
}
response = API.get(@netapp.auth, url, params, :unpack => false)
records = response.is_a?(Hash) ? response['records'] : nil
Array(records).any? do |record|
record.dig('source', 'path').to_s == "#{svm_name}:"
end
rescue StandardError => e
OpenNebula::DriverLogger.log_info \
"Could not read SnapMirror protection for #{@name}: #{e.message}"
false
end
# Create a LUN in this volume as a full, independent copy of another
# LUN identified by its ONTAP path (e.g. a LUN inside a snapshot:
# /vol/<vol>/.snapshot/<snap>/<lun>).
#
# A copy inherits the source LUN's geometry, and ONTAP rejects the
# create-time properties that describe it - os_type among them - on
# this POST.
def create_lun_copy(dest_path, source_path, extra = {})
data = {
'name' => dest_path,
'location' => { 'volume' => { 'uuid' => @uuid } },
'svm' => { 'uuid' => @svm.uuid },
'copy' => { 'source' => { 'name' => source_path } }
}.merge(extra)
url = "#{@base_url}/storage/luns"
job, response = API.with_job_handling(@netapp) do
API.post(@netapp.auth, url, nil, data)
end
lun = if job
LUN.new({ 'uuid' => response['uuid'] }, @netapp, self)
else
LUN.new(response, @netapp, self)
end
# The LUN exists as soon as the job returns, but ONTAP can
# briefly refuse to report its properties while the copy runs.
with_retry { lun.fetch_data }
lun
end
end
# Represents a snapshot of a NetApp volume
class Snapshot < Resource
attr_reader :volume
def initialize(data, netapp, volume = nil)
super(data, netapp)
if volume.is_a?(Volume)
@@ -771,24 +1032,57 @@ module TransferManager
fetch_data
end
def watch_copy(timeout = 600, delay = 3)
params = {
'fields' => ['copy']
}
url = "#{@base_url}/storage/luns/#{@uuid}"
copy_status = API.get(@netapp.auth, url, params)['copy']['source']['progress']
start_time = Time.now
until copy_status['percent_complete'] == 100 || Time.now - start_time > timeout
if copy_status.key?('failure') && copy_status['failure'].key?('message')
raise copy_status['failure']['message']
def watch_copy(timeout = 3600, delay = 5)
url = "#{@base_url}/storage/luns/#{@uuid}"
start_time = Time.now
seen_copy = false
absent = 0
unavailable = 0
loop do
response =
begin
API.get(@netapp.auth, url, { 'fields' => ['copy'] })
rescue API::Error, Net::HTTPError => e
# Sometimes don't get info of a copying LUN
raise e unless API.error_code(e) == API::Error::LUN_UNAVAILABLE
# Counted, not logged: this repeats on every poll of
# a long copy and says nothing on its own.
unavailable += 1
nil
end
progress = response&.dig('copy', 'source', 'progress')
if progress
seen_copy = true
absent = 0
if progress.dig('failure', 'message')
raise progress['failure']['message']
end
break if progress['percent_complete'].to_i >= 100
elsif response
# ONTAP drops the copy object when the copy finishes
absent += 1
break if seen_copy || absent > 1
end
if Time.now - start_time > timeout
raise "Copy of LUN #{@uuid} to volume #{@volume&.uuid} timed " \
"out after #{unavailable} polls with no properties"
end
sleep delay
copy_status = API.get(@netapp.auth, url)['copy']['source']['progress']
end
if copy_status['percent_complete'] < 100 && Time.now - start_time > timeout
raise "Copy of LUN #{@uuid} to volume #{@volume.uuid} timed out"
end
return if unavailable.zero?
OpenNebula::DriverLogger.log_info \
"ONTAP withheld the properties of LUN #{@uuid} on #{unavailable} " \
'polls while the copy ran'
end
def delete(parameters = nil, wait: true)
@@ -866,11 +1160,35 @@ module TransferManager
mkfs_command
end
def id
unless @data.key?('lun_maps') && @data['lun_maps'].first.key?('logical_unit_number')
fetch_data({ 'fields' => 'lun_maps.logical_unit_number' })
# ONTAP assigns the logical unit number per mapping, so the same
# LUN has different ids in different igroups. Callers that know
# which igroup they are attaching through must say so; without one
# the first mapping is used, which is only the right id while the
# LUN has exactly one.
def id(igroup_uuid = nil)
maps = Array(@data['lun_maps'])
if maps.empty? ||
!maps.first.key?('logical_unit_number') ||
(igroup_uuid && !maps.first.key?('igroup'))
fetch_data(
{ 'fields' => 'lun_maps.logical_unit_number,lun_maps.igroup.uuid' }
)
maps = Array(@data['lun_maps'])
end
@data['lun_maps'].first['logical_unit_number']
raise "LUN #{@uuid} is not mapped to any igroup" if maps.empty?
if igroup_uuid
match = maps.find {|m| m.dig('igroup', 'uuid') == igroup_uuid }
return match['logical_unit_number'] if match
OpenNebula::DriverLogger.log_warning \
"LUN #{@uuid} has no mapping for igroup #{igroup_uuid}, " \
'falling back to its first mapping'
end
maps.first['logical_unit_number']
end
end
@@ -909,11 +1227,72 @@ module TransferManager
end
def id
@lun.id
@lun.id(@igroup && @igroup['uuid'])
end
# Names the mapping in log messages, so a discovery failure records
# which LUN the id was read for and which igroup it came from -
# everything needed to check it against the array afterwards.
def describe
"LUN #{@lun.name || @lun.uuid} (id #{id}) " \
"mapped to igroup #{@igroup && @igroup['uuid']}"
rescue StandardError
"LUN #{@lun.uuid}"
end
# The WWN of the device behind this LUN ends with the LUN's serial
# number in hex, so it identifies which LUN actually answered at a
# given LUN id. Used by setup_disk to reject a device left behind by
# a previous LUN that held the same id.
def expected_wwn
@lun.fetch_data({ 'fields' => 'serial_number' })
serial = @lun['serial_number']
return if serial.nil? || serial.empty?
Iscsi.serial_to_wwn_tail(serial)
rescue StandardError => e
OpenNebula::DriverLogger.log_info \
"Could not read the serial number of LUN #{@lun.uuid}: #{e.message}"
nil
end
# True when the LUN a stale device reports can no longer be reached
# through any mapping: it is gone from the array, or it exists but
# is mapped nowhere. Only then is the device provably dead and safe
# for clear_stale_devices to remove. Any doubt answers false: a WWID
# that is not NetApp's, a serial ONTAP's query syntax would read as
# an operator (and so not match exactly), or a failed request.
def stale_lun_released?(wwid)
serial = serial_from_wwn(wwid)
return false if serial.nil? || serial.match?(/[*|!<>{}?]|\.\./)
url = "#{@base_url}/storage/luns"
params = { 'serial_number' => serial, 'fields' => 'serial_number,lun_maps' }
response = API.get(@netapp.auth, url, params, :unpack => false)
records = response.is_a?(Hash) ? Array(response['records']) : []
records.none? do |record|
record['serial_number'] == serial && !Array(record['lun_maps']).empty?
end
rescue StandardError => e
OpenNebula::DriverLogger.log_info \
"Could not look up the LUN behind #{wwid}: #{e.message}"
false
end
private
# A NetApp WWN is NAA type 6 with OUI 00a098, and its last 12 bytes
# are the LUN serial number (the inverse of
# Iscsi.serial_to_wwn_tail). Accepts the sysfs (naa.6...) and udev
# (36...) spellings; nil for anything else.
def serial_from_wwn(wwn)
m = wwn.to_s.strip.downcase.match(/600a098\h(\h{24})\z/)
return unless m
[m[1]].pack('H*')
end
def assign_attributes(data)
return if data.nil?
+20 -30
View File
@@ -66,6 +66,17 @@ grow_ratio = if ds_hash.key?('NETAPP_GROW_RATIO')
else
TransferManager::NetApp::Volume::DEFAULT_GROW_RATIO
end
disk_save = clone.disk_attribute(dst.disk_id, 'SAVE').upcase == 'YES'
standalone = ds_hash.key?('NETAPP_STANDALONE') && ds_hash['NETAPP_STANDALONE'].upcase == 'YES'
always_copy = ds_hash.key?('NETAPP_ALWAYS_COPY') &&
ds_hash['NETAPP_ALWAYS_COPY'].upcase == 'YES'
independent = disk_save || standalone
mode = if independent
always_copy ? :copy : :independent
else
:thin
end
auth = Base64.strict_encode64("#{user}:#{password}")
netapp = TransferManager::NetApp.new(auth, host, target, :action => clone)
@@ -134,40 +145,19 @@ begin
end
end
new_volume_data= {
'name' => new_volume_name,
'clone' => {
'parent_volume' => { 'uuid' => source_volume.uuid },
'parent_snapshot' => { 'uuid' => source_vol_goldensnap.uuid },
'is_flexclone' => true
}
}
new_volume = svm.provision_disk_volume(
source_vol_goldensnap, new_volume_name, new_lun_name, :mode => mode
)
new_lun = new_volume.lun
new_volume = svm.clone_volume(new_volume_data).tap(&:fetch_data)
new_lun = new_volume.lun
OpenNebula::DriverLogger.log_info "FlexCloned volume #{source_volume.name} " \
OpenNebula::DriverLogger.log_info "Provisioned volume #{source_volume.name} " \
"to #{new_volume.name}"
OpenNebula::DriverLogger.log_info "LUN ready at #{new_lun.name}"
unless new_lun
raise "No LUN found for cloned volume #{new_volume.uuid}"
end
new_lun.rename(new_lun_name)
OpenNebula::DriverLogger.log_info "Renamed LUN to #{new_lun.name}"
disk_save = clone.disk_attribute(dst.disk_id, 'SAVE').upcase == 'YES'
standalone = ds_hash.key?('NETAPP_STANDALONE') && ds_hash['NETAPP_STANDALONE'].upcase == 'YES'
if disk_save || standalone
new_volume.split_flexclone
unless new_volume.watch_flexclone_split
OpenNebula::DriverLogger.log_error "Unable to split flexclone volume #{new_volume.name}"
exit 1
end
if independent
source_vol_goldensnap.delete
OpenNebula::DriverLogger.log_info \
"Split flexclone volume #{new_volume.name} and delted golden snapshot"
"Provisioned independent volume #{new_volume.name} and deleted golden snapshot"
end
rescue StandardError => e
OpenNebula::DriverLogger.log_error "Error cloning #{src.path} to #{dst.path}: #{e.message}"
@@ -264,7 +254,7 @@ begin
rescue StandardError => e
OpenNebula::DriverLogger.log_error "Error cloning #{src.path} to #{dst.path}: #{e.message}"
if lun_mapped
new_lun.remove_connection(dst.host)
new_lun.lun_map.remove_connection(dst.host, :force => true) rescue nil
end
if new_volume
new_volume.delete
+10 -26
View File
@@ -51,6 +51,9 @@ aggregates = ds_hash['NETAPP_AGGREGATES']
netapp_suffix = ds_hash.key?('NETAPP_SUFFIX') ? "_#{ds_hash['NETAPP_SUFFIX']}" : ''
always_copy = ds_hash.key?('NETAPP_ALWAYS_COPY') &&
ds_hash['NETAPP_ALWAYS_COPY'].upcase == 'YES'
mode = always_copy ? :copy : :independent
auth = Base64.strict_encode64("#{user}:#{password}")
netapp = TransferManager::NetApp.new(auth, host, target, :action => cpds)
@@ -80,7 +83,7 @@ begin
snap_name = "one_snap_#{arg_snapid}"
source_snap = source_volume.get_snapshots.find {|s| s['name'] == snap_name }
else
check_snap = source_volume.get_snapshots.find {|s| s['name'] == snap_name }
check_snap = source_volume.get_snapshots.find {|s| s['name'] == snap_name }
if check_snap
check_snap.delete
OpenNebula::DriverLogger.log_info 'Deleted existing temporary snapshot for ' \
@@ -93,32 +96,13 @@ begin
end
raise 'Unable to find or create source snapshot' unless source_snap
new_volume_data= {
'name' => dst_volume,
'clone' => {
'parent_volume' => { 'uuid' => source_volume.uuid },
'parent_snapshot' => { 'uuid' => source_snap.uuid },
'is_flexclone' => true
}
}
new_volume = svm.clone_volume(new_volume_data).tap(&:fetch_data)
new_lun = new_volume.lun
OpenNebula::DriverLogger.log_info "Cloned volume #{source_volume.name} " \
new_volume = svm.provision_disk_volume(
source_snap, dst_volume, dst_lun, :mode => mode
)
new_lun = new_volume.lun
OpenNebula::DriverLogger.log_info "Provisioned volume #{source_volume.name} " \
"to #{new_volume.name}"
unless new_lun
OpenNebula::DriverLogger.log_error "No LUN found for cloned volume #{new_volume.uuid}"
exit 1
end
new_lun.rename(dst_lun)
OpenNebula::DriverLogger.log_info "Renamed LUN to #{new_lun.name}"
new_volume.split_flexclone
unless new_volume.watch_flexclone_split
OpenNebula::DriverLogger.log_error "Unable to split flexclone volume #{new_volume.name}"
exit 1
end
OpenNebula::DriverLogger.log_info "LUN ready at #{new_lun.name}"
if snap_name == 'one_tmp_copy_snap'
source_snap.delete
+55 -20
View File
@@ -21,6 +21,14 @@ require_relative '../lib/tm_action'
require_relative '../lib/datastore'
require_relative '../lib/netapp'
# Runs one step of the failure cleanup, logging instead of raising so that the
# steps after it (renaming a persistent image back) still run
def cleanup_step(step)
yield
rescue StandardError => e
OpenNebula::DriverLogger.log_error "Cleanup failed #{step}: #{e.message}"
end
arg_src = ARGV[0]
arg_dst = ARGV[1]
arg_vmid = ARGV[2]
@@ -80,7 +88,12 @@ begin
save = ln.disk_attribute(dst.disk_id, 'SAVE').upcase == 'YES'
clone = ln.disk_attribute(dst.disk_id, 'CLONE').upcase == 'YES'
readonly = ln.disk_attribute(dst.disk_id, 'READONLY').upcase == 'YES'
if !save && !clone && readonly
# A read-only, non-persistent disk gets a volume of its own; any other
# disk is the image's volume itself, renamed for the VM
cloned = !save && !clone && readonly
if cloned
# clone the volume instead
source_golden = source_volume.get_snapshots.find {|s| s['name'] == TransferManager::NetApp::GOLDENSNAP_NAME }
goldsnap_data = {
@@ -90,19 +103,28 @@ begin
source_golden.delete if source_golden
source_golden = source_volume.create_snapshot(goldsnap_data)
new_volume = svm.clone_volume({
'name' => new_volume_name,
'clone' => {
'parent_volume' => { 'uuid' => source_volume.uuid },
'parent_snapshot' => { 'uuid' => source_golden.uuid },
'is_flexclone' => true
}
}).tap(&:fetch_data)
new_volume.split_flexclone
always_copy = ds_hash.key?('NETAPP_ALWAYS_COPY') &&
ds_hash['NETAPP_ALWAYS_COPY'].upcase == 'YES'
mode = always_copy ? :copy : :independent
new_volume = svm.provision_disk_volume(
source_golden, new_volume_name, new_lun_name, :mode => mode
)
source_golden.delete
OpenNebula::DriverLogger.log_info "Cloned volume #{source_volume.name} " \
"to #{new_volume_name}"
else
# While the VM has it the volume carries the VM's disk name; keep the
# image's own name in its comment so the datastore rm can still find
# it if the VM never hands it back
begin
unless source_volume['comment'] == source_vol_name
source_volume.update({ 'comment' => source_vol_name })
end
rescue StandardError => e
OpenNebula::DriverLogger.log_warning \
"Could not record image name #{source_vol_name} on its volume: #{e.message}"
end
source_volume.rename(new_volume_name)
new_volume = TransferManager::NetApp::Volume.new({ 'uuid' => source_volume.uuid }, netapp)
@@ -121,7 +143,7 @@ begin
end
rescue StandardError => e
if !save && !clone && readonly
if cloned
OpenNebula::DriverLogger.log_error "Error cloning from #{source_vol_name} to " \
"#{new_volume_name}: #{e.message}"
else
@@ -201,19 +223,32 @@ begin
rescue StandardError => e
OpenNebula::DriverLogger.log_error "Error moving #{src.path} to #{dst.path}: #{e.message}"
OpenNebula::DriverLogger.log_error e.backtrace.to_s
if !new_lun.nil?
if new_lun.lun_map
if lun_mapped
new_lun.lun_map.remove_connection(dst.host, :force => true) rescue nil
if new_lun
cleanup_step('unmapping LUN') do
if new_lun.lun_map
if lun_mapped
new_lun.lun_map.remove_connection(dst.host, :force => true) rescue nil
end
new_lun.delete_lun_map
end
new_lun.delete_lun_map
end
new_lun.delete
end
if new_volume
new_volume.rename(source_vol_name)
if cloned
# The volume was provisioned for this disk alone
cleanup_step("deleting volume #{new_volume_name}") { new_volume.delete }
else
# The volume is the persistent image itself: give it its name back and
# keep its data
cleanup_step("renaming volume back to #{source_vol_name}") do
new_volume.rename(source_vol_name)
end
if new_lun
new_lun.rename(source_lun_name)
cleanup_step("renaming LUN back to #{source_lun_name}") do
new_lun.rename(source_lun_name)
end
end
end
exit 1
+1 -1
View File
@@ -40,7 +40,7 @@ end
monitor = TransferManager::Action.new(:action_name => 'monitor')
netapp_auth = Base64.strict_encode64("#{netapp_user}:#{netapp_pass}")
netapp = TransferManager::NetApp.new(netapp_auth, netapp_host, false, :action => monitor)
svm = TransferManager::NetApp::SVM.new({ 'uuid' => netapp_svm }, netapp, nil)
svm = TransferManager::NetApp::SVM.new({"uuid" => netapp_svm}, netapp, nil)
svm.fetch_data({ 'fields' => ['storage'] })