Skip to content

Commit

Permalink
Merge pull request #884 from jaywcarman/rescue_vm_volume_attachments_…
Browse files Browse the repository at this point in the history
…not_found

Rescue VM volume attachments NotFound

(cherry picked from commit 630f676)
  • Loading branch information
agrare authored and Fryguy committed Jun 26, 2024
1 parent ab7e9fe commit 2a3306b
Showing 1 changed file with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,21 +411,25 @@ def parse_vm(vm, hosts)
# Don't worry about filling in the volume, since the volume service refresh
# will take care of that.
if !vm.attributes.fetch("os-extended-volumes:volumes_attached", []).empty?
vm.volume_attachments.each do |attachment|
# Skip Volume mounts without mount point
next if attachment['device'].blank?

dev = File.basename(attachment['device'])
persister.disks.find_or_build_by(
:hardware => hardware,
# reuse the device names from above in the event that this is an
# instance that was booted from a volume
:device_name => attachment_names.fetch(dev, dev)
).assign_attributes(
:location => dev,
:device_type => "disk",
:controller_type => "openstack"
)
begin
vm.volume_attachments.each do |attachment|
# Skip Volume mounts without mount point
next if attachment['device'].blank?

dev = File.basename(attachment['device'])
persister.disks.find_or_build_by(
:hardware => hardware,
# reuse the device names from above in the event that this is an
# instance that was booted from a volume
:device_name => attachment_names.fetch(dev, dev)
).assign_attributes(
:location => dev,
:device_type => "disk",
:controller_type => "openstack"
)
end
rescue Fog::OpenStack::Compute::NotFound => err
_log.warn("Unable to retrieve VM volume attachments name=#{vm.name} id=#{vm.id} state=#{vm.state} err=#{err}")
end
end
vm_and_template_labels(server, vm.metadata || [])
Expand Down

0 comments on commit 2a3306b

Please sign in to comment.