DaanHoogland commented on a change in pull request #3976: Enable sending
hypervior host name via metadata - VR and Config Drive
URL: https://github.com/apache/cloudstack/pull/3976#discussion_r399320104
##########
File path:
server/src/main/java/com/cloud/network/element/ConfigDriveNetworkElement.java
##########
@@ -424,8 +476,25 @@ private Long findAgentId(VirtualMachineProfile profile,
DeployDestination dest,
return agentId;
}
- private boolean createConfigDriveIso(VirtualMachineProfile profile,
DeployDestination dest) throws ResourceUnavailableException {
- final DataStore dataStore = findDataStore(profile, dest);
+ private boolean createConfigDriveIso(VirtualMachineProfile profile,
DeployDestination dest, DiskTO disk) throws ResourceUnavailableException {
+ DataStore dataStore = null;
+ if (disk != null) {
+ String dId = disk.getData().getDataStore().getUuid();
+ if (VirtualMachineManager.VmConfigDriveOnPrimaryPool.value()) {
+ dataStore = _dataStoreMgr.getDataStore(dId,
DataStoreRole.Primary);
+ } else {
+ List<DataStore> dataStores = _dataStoreMgr.listImageStores();
+ String url = disk.getData().getDataStore().getUrl();
+ for(DataStore ds : dataStores) {
+ if (url.equals(ds.getUri()) &&
DataStoreRole.Image.equals(ds.getRole())) {
+ dataStore = ds;
+ break;
+ }
+ }
+ }
+ } else {
+ dataStore = findDataStore(profile, dest);
+ }
Review comment:
can you put in `getOrDecideOnWhichDataStoreToUseOrSomeNameLikeThat()`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services