-
Notifications
You must be signed in to change notification settings - Fork 1.3k
storage: validate NFS secondary storage mount using SSVM during image store discovery #12678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.22
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -276,6 +276,7 @@ | |
| import com.cloud.vm.VirtualMachine; | ||
| import com.cloud.vm.VirtualMachine.State; | ||
| import com.cloud.vm.dao.VMInstanceDao; | ||
| import com.cloud.storage.secondary.SecondaryStorageVmManager; | ||
| import com.google.common.collect.Sets; | ||
|
|
||
|
|
||
|
|
@@ -344,6 +345,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C | |
| @Inject | ||
| protected VolumeDao volumeDao; | ||
| @Inject | ||
| protected SecondaryStorageVmManager _ssVmMgr; | ||
| @Inject | ||
| ConfigurationDao _configDao; | ||
| @Inject | ||
| ManagementServer _msServer; | ||
|
|
@@ -3990,6 +3993,37 @@ public ImageStore discoverImageStore(String name, String url, String providerNam | |
| throw new CloudRuntimeException("Failed to add data store: " + e.getMessage(), e); | ||
| } | ||
|
|
||
| // Validate secondary storage mount immediately using SSVM | ||
| if (zoneId != null) { | ||
| List<HostVO> ssvmHosts = _hostDao.listByType(Host.Type.SecondaryStorageVM); | ||
| boolean mountSuccess = false; | ||
| String failureReason = "No Secondary Storage VM available to validate the NFS mount."; | ||
|
|
||
| for (HostVO ssvm : ssvmHosts) { | ||
| if (ssvm.getDataCenterId() != zoneId.longValue()) { | ||
| continue; | ||
| } | ||
|
|
||
| try { | ||
| boolean result = _ssVmMgr.generateSetupCommand(ssvm.getId()); | ||
| if (result) { | ||
| mountSuccess = true; | ||
| break; | ||
| } else { | ||
| failureReason = "Secondary Storage VM failed to mount the NFS secondary storage."; | ||
| } | ||
| } catch (Exception e) { | ||
| failureReason = e.getMessage(); | ||
| } | ||
| } | ||
|
|
||
| if (!mountSuccess) { | ||
| // cleanup created store | ||
| _imageStoreDao.remove(store.getId()); | ||
|
DaanHoogland marked this conversation as resolved.
Outdated
|
||
| throw new CloudRuntimeException("Invalid secondary storage mount: " + failureReason); | ||
| } | ||
| } | ||
|
DaanHoogland marked this conversation as resolved.
Outdated
|
||
|
|
||
|
DaanHoogland marked this conversation as resolved.
Outdated
DaanHoogland marked this conversation as resolved.
Outdated
DaanHoogland marked this conversation as resolved.
Outdated
Comment on lines
3998
to
4000
|
||
| if (((ImageStoreProvider)storeProvider).needDownloadSysTemplate()) { | ||
| // trigger system vm template download | ||
| _imageSrv.downloadBootstrapSysTemplate(store); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.