Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member

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.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

}
else {
VolumeObjectTO newVolume = new VolumeObjectTO();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the constant "HypervisorHostHelper.VSPHERE_DATASTORE_BASE_FOLDER" for "fcd"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use the constant "HypervisorHostHelper.VSPHERE_DATASTORE_BASE_FOLDER" for "fcd"

@skattoju4 any update on the changes suggested.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() != ""){
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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;
}
}
}

Expand Down Expand Up @@ -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();
Expand Down