-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Enable creation of vms with solidfire root volumes on vmware67 #4977
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -1390,10 +1390,12 @@ else if (volumeInfo.getFormat() == ImageFormat.OVA) { | |
|
|
||
| verifyCopyCmdAnswer(copyCmdAnswer, templateInfo); | ||
|
|
||
| // Seems like vmware 6.5 and above does not automatically remount the datastore after rescanning the storage. | ||
| // Not sure if this is needed. | ||
| // If using VMware, have the host rescan its software HBA if dynamic discovery is in use. | ||
| if (HypervisorType.VMware.equals(templateInfo.getHypervisorType())) { | ||
| disconnectHostFromVolume(hostVO, volumeInfo.getPoolId(), volumeInfo.get_iScsiName()); | ||
| } | ||
| //if (HypervisorType.VMware.equals(templateInfo.getHypervisorType())) { | ||
| // disconnectHostFromVolume(hostVO, volumeInfo.getPoolId(), volumeInfo.get_iScsiName()); | ||
| //} | ||
|
Comment on lines
+1396
to
+1398
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As git will keep the history, we can remove the code and move the comment from code to commit message.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
| } | ||
| else { | ||
| VolumeObjectTO newVolume = new VolumeObjectTO(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,12 +168,17 @@ public static String syncVolumeToVmDefaultFolder(DatacenterMO dcMo, String vmNam | |
| public static String syncVolumeToVmDefaultFolder(DatacenterMO dcMo, String vmName, DatastoreMO ds, String vmdkName, String excludeFolders) throws Exception { | ||
|
|
||
| assert (ds != null); | ||
|
|
||
| if (!ds.folderExists(String.format("[%s]", ds.getName()), vmName)) { | ||
| s_logger.info("VM folder does not exist on target datastore, we will create one. vm: " + vmName + ", datastore: " + ds.getName()); | ||
|
|
||
| ds.makeDirectory(String.format("[%s] %s", ds.getName(), vmName), dcMo.getMor()); | ||
| } | ||
|
|
||
| if (!ds.folderExists(String.format("[%s]", ds.getName()), "fcd")) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use the constant "HypervisorHostHelper.VSPHERE_DATASTORE_BASE_FOLDER" for "fcd"
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@skattoju4 any update on the changes suggested.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry for the delay.. will update later this evening. |
||
| s_logger.info("fcd folder does not exist on target datastore, we will create one. vm: " + vmName + ", datastore: " + ds.getName()); | ||
| ds.makeDirectory(String.format("[%s] %s", ds.getName(), "fcd"), dcMo.getMor()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "fcd" => HypervisorHostHelper.VSPHERE_DATASTORE_BASE_FOLDER |
||
| } | ||
|
|
||
| String[] vmdkLinkedCloneModeLegacyPair = getVmdkFilePairDatastorePath(ds, vmName, vmdkName, VmwareStorageLayoutType.CLOUDSTACK_LEGACY, true); | ||
| String[] vmdkFullCloneModeLegacyPair = getVmdkFilePairDatastorePath(ds, vmName, vmdkName, VmwareStorageLayoutType.CLOUDSTACK_LEGACY, false); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -280,7 +280,8 @@ public ResignatureAnswer resignature(ResignatureCommand cmd) { | |
| } | ||
| } | ||
|
|
||
| removeVmfsDatastore(cmd, hyperHost, datastoreName, storageHost, storagePortNumber, trimIqn(iScsiName), lstHosts); | ||
| //vmware 6.7 does not automatically mount datastores after rescanning once removed | ||
| //removeVmfsDatastore(cmd, hyperHost, datastoreName, storageHost, storagePortNumber, trimIqn(iScsiName), lstHosts); | ||
|
Comment on lines
+283
to
+284
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As git will keep the history, we can remove the code and move the comment from code to commit message. |
||
|
|
||
| if (!foundExtent) { | ||
| throw new CloudRuntimeException("Unable to locate the applicable extent"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -309,16 +309,20 @@ public String[] listDirContent(String path) throws Exception { | |
| public boolean fileExists(String fileFullPath) throws Exception { | ||
| DatastoreFile file = new DatastoreFile(fileFullPath); | ||
| DatastoreFile dirFile = new DatastoreFile(file.getDatastoreName(), file.getDir()); | ||
|
|
||
| HostDatastoreBrowserMO browserMo = getHostDatastoreBrowserMO(); | ||
|
|
||
| s_logger.info("Search file " + file.getFileName() + " on " + dirFile.getPath()); | ||
| HostDatastoreBrowserSearchResults results = browserMo.searchDatastore(dirFile.getPath(), file.getFileName(), true); | ||
| if (results != null) { | ||
| List<FileInfo> info = results.getFile(); | ||
| if (info != null && info.size() > 0) { | ||
| s_logger.info("File " + fileFullPath + " exists on datastore"); | ||
| return true; | ||
| Boolean folderExists = true; | ||
| if(file.getDir() != ""){ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. import org.apache.commons.lang3.StringUtils; if (StringUtils.isNotEmpty(file.getDir())){ |
||
| folderExists = folderExists(String.format("[%s]", file.getDatastoreName()), file.getDir()); | ||
| } | ||
| if (folderExists){ | ||
| HostDatastoreBrowserMO browserMo = getHostDatastoreBrowserMO(); | ||
| s_logger.info("Search file " + file.getFileName() + " on " + dirFile.getPath()); | ||
| HostDatastoreBrowserSearchResults results = browserMo.searchDatastore(dirFile.getPath(), file.getFileName(), true); | ||
| if (results != null) { | ||
| List<FileInfo> info = results.getFile(); | ||
| if (info != null && info.size() > 0) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. import org.apache.commons.collections.CollectionUtils; if (CollectionUtils.isNotEmpty(info)) { |
||
| s_logger.info("File " + fileFullPath + " exists on datastore"); | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -359,7 +363,7 @@ public long fileDiskSize(String fileFullPath) throws Exception { | |
|
|
||
| public boolean folderExists(String folderParentDatastorePath, String folderName) throws Exception { | ||
| HostDatastoreBrowserMO browserMo = getHostDatastoreBrowserMO(); | ||
|
|
||
| s_logger.info("Search folder " + folderName + " on " + folderParentDatastorePath); | ||
| HostDatastoreBrowserSearchResults results = browserMo.searchDatastore(folderParentDatastorePath, folderName, true); | ||
| if (results != null) { | ||
| List<FileInfo> info = results.getFile(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @harikrishna-patnala @nvazquez could this cause any regression?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skattoju4 There are two more methods in which disconnectHostFromVolume() method is being called. Any specific reason why you want to remove this method call only here. Can you check the other two methods as well handleCreateManagedVolumeFromManagedSnapshot() and handleCopyAsyncToSecondaryStorage(). These two are also related to managed storage.