should check the return value of os.DiskIsAttached

This commit is contained in:
wenlxie 2017-11-29 13:02:27 +08:00
parent 1e67feac75
commit e80dcba297

View File

@ -419,7 +419,11 @@ func (os *OpenStack) DiskIsAttached(instanceID, volumeID string) (bool, error) {
func (os *OpenStack) DisksAreAttached(instanceID string, volumeIDs []string) (map[string]bool, error) { func (os *OpenStack) DisksAreAttached(instanceID string, volumeIDs []string) (map[string]bool, error) {
attached := make(map[string]bool) attached := make(map[string]bool)
for _, volumeID := range volumeIDs { for _, volumeID := range volumeIDs {
isAttached, _ := os.DiskIsAttached(instanceID, volumeID) isAttached, err := os.DiskIsAttached(instanceID, volumeID)
if err != nil && err != ErrNotFound {
attached[volumeID] = true
continue
}
attached[volumeID] = isAttached attached[volumeID] = isAttached
} }
return attached, nil return attached, nil