Merge remote-tracking branch 'origin/4.14' into 4.15

This commit is contained in:
Rohit Yadav 2021-03-06 15:59:50 +05:30
commit 3a82392941
2 changed files with 14 additions and 0 deletions

View File

@ -487,6 +487,10 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
throw new InvalidParameterValueException("Please specify a valid template.");
}
if (template.getState() == VirtualMachineTemplate.State.NotUploaded || template.getState() == VirtualMachineTemplate.State.UploadInProgress) {
throw new InvalidParameterValueException("The template is either getting uploaded or it may be initiated shortly, please wait for it to be completed");
}
return new TemplateProfile(userId, template, zoneId);
}
@ -526,6 +530,10 @@ public abstract class TemplateAdapterBase extends AdapterBase implements Templat
throw new InvalidParameterValueException("Please specify a valid iso.");
}
if (template.getState() == VirtualMachineTemplate.State.NotUploaded || template.getState() == VirtualMachineTemplate.State.UploadInProgress) {
throw new InvalidParameterValueException("The iso is either getting uploaded or it may be initiated shortly, please wait for it to be completed");
}
return new TemplateProfile(userId, template, zoneId);
}

View File

@ -2348,6 +2348,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
File tmpltParent = null;
if (tmpltPath.exists() && tmpltPath.isDirectory()) {
tmpltParent = tmpltPath;
} else if (absoluteTemplatePath.endsWith(File.separator + obj.getId())) {
// the path ends with <account id>/<template id>, if upload fails
tmpltParent = tmpltPath;
} else {
tmpltParent = tmpltPath.getParentFile();
}
@ -2452,6 +2455,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
if (volPath.exists() && volPath.isDirectory()) {
// for vmware, absoluteVolumePath represents a directory where volume files are located.
tmpltParent = volPath;
} else if (absoluteVolumePath.endsWith(File.separator + obj.getId())) {
// the path ends with <account id>/<volume id>, if upload fails
tmpltParent = volPath;
} else {
// for other hypervisors, the volume .vhd or .qcow2 file path is passed
tmpltParent = new File(absoluteVolumePath).getParentFile();