@@ -110,7 +110,7 @@ func (ss *ScaleSet) AttachDisk(ctx context.Context, nodeName types.NodeName, dis
110110 result , rerr := ss .ComputeClientFactory .GetVirtualMachineScaleSetVMClient ().Update (ctx , nodeResourceGroup , vm .VMSSName , vm .InstanceID , * newVM )
111111 if rerr != nil {
112112 klog .Errorf ("azureDisk - attach disk list(%+v) on rg(%s) vm(%s) failed, err: %v" , diskMap , nodeResourceGroup , nodeName , rerr )
113- if exists , err := errutils .CheckResourceExistsFromAzcoreError (rerr ); exists && err == nil {
113+ if exists , err := errutils .CheckResourceExistsFromAzcoreError (rerr ); ! exists && ! strings . Contains ( rerr . Error (), consts . ParentResourceNotFoundMessageCode ) && err == nil {
114114 klog .Errorf ("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)" , diskMap , nodeResourceGroup , nodeName )
115115 disks := FilterNonExistingDisks (ctx , ss .ComputeClientFactory , newVM .Properties .StorageProfile .DataDisks )
116116 newVM .Properties .StorageProfile .DataDisks = disks
@@ -223,7 +223,7 @@ func (ss *ScaleSet) DetachDisk(ctx context.Context, nodeName types.NodeName, dis
223223 result , rerr = ss .ComputeClientFactory .GetVirtualMachineScaleSetVMClient ().Update (ctx , nodeResourceGroup , vm .VMSSName , vm .InstanceID , * newVM )
224224 if rerr != nil {
225225 klog .Errorf ("azureDisk - detach disk list(%s) on rg(%s) vm(%s) failed, err: %v" , diskMap , nodeResourceGroup , nodeName , rerr )
226- if exists , err := errutils .CheckResourceExistsFromAzcoreError (rerr ); exists && err == nil {
226+ if exists , err := errutils .CheckResourceExistsFromAzcoreError (rerr ); ! exists && ! strings . Contains ( rerr . Error (), consts . ParentResourceNotFoundMessageCode ) && err == nil {
227227 klog .Errorf ("azureDisk - begin to filterNonExistingDisks(%v) on rg(%s) vm(%s)" , diskMap , nodeResourceGroup , nodeName )
228228 disks := FilterNonExistingDisks (ctx , ss .ComputeClientFactory , newVM .Properties .StorageProfile .DataDisks )
229229 newVM .Properties .StorageProfile .DataDisks = disks
0 commit comments