|
57 | 57 | import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd; |
58 | 58 | import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd; |
59 | 59 | import org.apache.cloudstack.api.command.admin.storage.SyncStoragePoolCmd; |
| 60 | +import org.apache.cloudstack.api.command.admin.storage.UpdateImageStoreCmd; |
60 | 61 | import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd; |
61 | 62 | import org.apache.cloudstack.context.CallContext; |
62 | 63 | import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; |
|
116 | 117 | import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity; |
117 | 118 | import org.apache.cloudstack.storage.to.VolumeObjectTO; |
118 | 119 | import org.apache.commons.collections.CollectionUtils; |
119 | | -import org.apache.commons.lang3.StringUtils; |
120 | 120 | import org.apache.log4j.Logger; |
121 | 121 | import org.springframework.stereotype.Component; |
122 | 122 |
|
|
212 | 212 | import com.cloud.utils.NumbersUtil; |
213 | 213 | import com.cloud.utils.Pair; |
214 | 214 | import com.cloud.utils.UriUtils; |
| 215 | +import com.cloud.utils.StringUtils; |
215 | 216 | import com.cloud.utils.component.ComponentContext; |
216 | 217 | import com.cloud.utils.component.ManagerBase; |
217 | 218 | import com.cloud.utils.concurrency.NamedThreadFactory; |
@@ -2998,17 +2999,35 @@ public ImageStore migrateToObjectStore(String name, String url, String providerN |
2998 | 2999 | } |
2999 | 3000 |
|
3000 | 3001 | @Override |
3001 | | - public ImageStore updateImageStoreStatus(Long id, Boolean readonly) { |
| 3002 | + public ImageStore updateImageStore(UpdateImageStoreCmd cmd) { |
| 3003 | + return updateImageStoreStatus(cmd.getId(), cmd.getName(), cmd.getReadonly(), cmd.getCapacityBytes()); |
| 3004 | + } |
| 3005 | + |
| 3006 | + @Override |
| 3007 | + public ImageStore updateImageStoreStatus(Long id, String name, Boolean readonly, Long capacityBytes) { |
3002 | 3008 | // Input validation |
3003 | 3009 | ImageStoreVO imageStoreVO = _imageStoreDao.findById(id); |
3004 | 3010 | if (imageStoreVO == null) { |
3005 | 3011 | throw new IllegalArgumentException("Unable to find image store with ID: " + id); |
3006 | 3012 | } |
3007 | | - imageStoreVO.setReadonly(readonly); |
| 3013 | + if (com.cloud.utils.StringUtils.isNotBlank(name)) { |
| 3014 | + imageStoreVO.setName(name); |
| 3015 | + } |
| 3016 | + if (capacityBytes != null) { |
| 3017 | + imageStoreVO.setTotalSize(capacityBytes); |
| 3018 | + } |
| 3019 | + if (readonly != null) { |
| 3020 | + imageStoreVO.setReadonly(readonly); |
| 3021 | + } |
3008 | 3022 | _imageStoreDao.update(id, imageStoreVO); |
3009 | 3023 | return imageStoreVO; |
3010 | 3024 | } |
3011 | 3025 |
|
| 3026 | + @Override |
| 3027 | + public ImageStore updateImageStoreStatus(Long id, Boolean readonly) { |
| 3028 | + return updateImageStoreStatus(id, null, readonly, null); |
| 3029 | + } |
| 3030 | + |
3012 | 3031 | /** |
3013 | 3032 | * @param poolId - Storage pool id for pool to update. |
3014 | 3033 | * @param failOnChecks - If true, throw an error if pool type and state checks fail. |
|
0 commit comments