|
19 | 19 |
|
20 | 20 | package org.apache.cloudstack.storage.service; |
21 | 21 |
|
22 | | -import com.cloud.agent.api.Answer; |
23 | | -import com.cloud.host.HostVO; |
24 | | -import com.cloud.storage.Storage; |
25 | | -import com.cloud.storage.VolumeVO; |
26 | | -import com.cloud.storage.dao.VolumeDao; |
27 | | -import com.cloud.utils.exception.CloudRuntimeException; |
28 | | -import feign.FeignException; |
| 22 | +import java.util.ArrayList; |
| 23 | +import java.util.List; |
| 24 | +import java.util.Map; |
| 25 | + |
| 26 | +import javax.inject.Inject; |
| 27 | + |
29 | 28 | import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; |
30 | 29 | import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; |
31 | 30 | import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector; |
32 | 31 | import org.apache.cloudstack.storage.command.CreateObjectCommand; |
33 | 32 | import org.apache.cloudstack.storage.command.DeleteCommand; |
34 | 33 | import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; |
| 34 | +import org.apache.cloudstack.storage.feign.model.CliSnapshotRestoreRequest; |
35 | 35 | import org.apache.cloudstack.storage.feign.model.ExportPolicy; |
36 | 36 | import org.apache.cloudstack.storage.feign.model.ExportRule; |
37 | 37 | import org.apache.cloudstack.storage.feign.model.FileInfo; |
|
42 | 42 | import org.apache.cloudstack.storage.feign.model.Volume; |
43 | 43 | import org.apache.cloudstack.storage.feign.model.response.JobResponse; |
44 | 44 | import org.apache.cloudstack.storage.feign.model.response.OntapResponse; |
45 | | -import org.apache.cloudstack.storage.feign.model.CliSnapshotRestoreRequest; |
46 | 45 | import org.apache.cloudstack.storage.service.model.AccessGroup; |
47 | 46 | import org.apache.cloudstack.storage.service.model.CloudStackVolume; |
48 | | -import org.apache.cloudstack.storage.volume.VolumeObject; |
49 | 47 | import org.apache.cloudstack.storage.utils.OntapStorageConstants; |
50 | 48 | import org.apache.cloudstack.storage.utils.OntapStorageUtils; |
| 49 | +import org.apache.cloudstack.storage.volume.VolumeObject; |
51 | 50 | import org.apache.logging.log4j.LogManager; |
52 | 51 | import org.apache.logging.log4j.Logger; |
53 | 52 |
|
54 | | -import javax.inject.Inject; |
55 | | -import java.util.ArrayList; |
56 | | -import java.util.List; |
57 | | -import java.util.Map; |
| 53 | +import com.cloud.agent.api.Answer; |
| 54 | +import com.cloud.host.HostVO; |
| 55 | +import com.cloud.storage.Storage; |
| 56 | +import com.cloud.storage.VolumeVO; |
| 57 | +import com.cloud.storage.dao.VolumeDao; |
| 58 | +import com.cloud.utils.exception.CloudRuntimeException; |
| 59 | + |
| 60 | +import feign.FeignException; |
58 | 61 |
|
59 | 62 | public class UnifiedNASStrategy extends NASStrategy { |
60 | 63 | private static final Logger logger = LogManager.getLogger(UnifiedNASStrategy.class); |
@@ -176,12 +179,15 @@ public void deleteAccessGroup(AccessGroup accessGroup) { |
176 | 179 | String exportPolicyId = details.get(OntapStorageConstants.EXPORT_POLICY_ID); |
177 | 180 |
|
178 | 181 | try { |
179 | | - nasFeignClient.deleteExportPolicyById(authHeader,exportPolicyId); |
| 182 | + nasFeignClient.deleteExportPolicyById(authHeader, exportPolicyId); |
180 | 183 | logger.info("deleteAccessGroup: Successfully deleted export policy '{}'", exportPolicyName); |
181 | | - } catch (Exception e) { |
| 184 | + } catch (FeignException e) { |
| 185 | + if (e.status() == 404) { |
| 186 | + logger.warn("deleteAccessGroup: Export policy '{}' not found in ONTAP, treating as no-op", exportPolicyName); |
| 187 | + return; |
| 188 | + } |
182 | 189 | logger.error("deleteAccessGroup: Failed to delete export policy. Exception: {}", e.getMessage(), e); |
183 | 190 | throw new CloudRuntimeException("Failed to delete export policy: " + e.getMessage(), e); |
184 | | - |
185 | 191 | } |
186 | 192 | } catch (Exception e) { |
187 | 193 | logger.error("deleteAccessGroup: Failed to delete export policy. Exception: {}", e.getMessage(), e); |
|
0 commit comments