Skip to content

Commit

Permalink
Merge pull request ManageIQ#157 from jerryk55/snapshot_disknames_long…
Browse files Browse the repository at this point in the history
…er_than_60chars

Smart state Snapshot Managed Disk Name 80 Char Limit
  • Loading branch information
djberg96 authored Nov 3, 2017
2 parents 1a7fa32 + 9a1b8d3 commit e6d33b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module ManageIQ::Providers::Azure::CloudManager::VmOrTemplateShared
extend ActiveSupport::Concern
include_concern 'Scanning'
SSA_SNAPSHOT_SUFFIX = "__EVM__SSA__SNAPSHOT".freeze
SSA_SNAPSHOT_SUFFIX = "_SSA_SNAPSHOT".freeze
SSA_NAME_MAX = 80

def provider_service(connection = nil)
@connection ||= connection || ext_management_system.connect
Expand Down Expand Up @@ -76,7 +77,12 @@ def managed_image_disk_name
end

def ssa_snap_name
@ssa_snap_name ||= "#{os_disk.name}#{SSA_SNAPSHOT_SUFFIX}"
@ssa_snap_name ||= if "#{name}#{SSA_SNAPSHOT_SUFFIX}".size > SSA_NAME_MAX
name_end = SSA_NAME_MAX - SSA_SNAPSHOT_SUFFIX.size - 1
"#{name[0..name_end]}#{SSA_SNAPSHOT_SUFFIX}"
else
"#{name}#{SSA_SNAPSHOT_SUFFIX}"
end
end

def blob_uri
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def perform_metadata_scan(ost)
end
else
vm_args[:resource_group] = resource_group
vm_args[:snapshot] = ost.scanData["snapshot"]["name"] unless managed_disk?
vm_args[:snapshot] = ost.scanData["snapshot"]["name"]
end

ost.scanTime = Time.now.utc unless ost.scanTime
Expand Down

0 comments on commit e6d33b9

Please sign in to comment.