Skip to content

Commit

Permalink
Fix working with orphaned devices
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Shirinkin committed Mar 19, 2020
1 parent 443552c commit 1647f77
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ func DiskRefreshOperation(d *schema.ResourceData, c *govmomi.Client, l object.Vi
// Skip any of these keys as we won't be matching any of those anyway here
continue
}

if !diskUUIDMatch(device, m["uuid"].(string)) {
// Skip any device that doesn't match UUID
continue
Expand All @@ -472,6 +473,12 @@ func DiskRefreshOperation(d *schema.ResourceData, c *govmomi.Client, l object.Vi
if err := r.Read(l); err != nil {
return fmt.Errorf("%s: %s", r.Addr(), err)
}

if strings.HasPrefix(r.Get("label").(string), diskOrphanedPrefix) {
// Skip if it's previously discovered orphaned device
continue
}

// Done reading, push this onto our new set and remove the device from
// the list
newSet = append(newSet, r.Data())
Expand Down

0 comments on commit 1647f77

Please sign in to comment.