mirror of https://github.com/apache/cloudstack.git
Backport fixed for issues found by Findbugs
This commit is contained in:
parent
f18c5a1910
commit
60ac12780b
|
|
@ -960,7 +960,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
|||
}
|
||||
|
||||
if (disk == null) {
|
||||
throw new CloudRuntimeException("Failed to create " + disk.getPath() + " from template " + template.getName());
|
||||
throw new CloudRuntimeException("Failed to create disk from template " + template.getName());
|
||||
}
|
||||
|
||||
return disk;
|
||||
|
|
|
|||
|
|
@ -3508,7 +3508,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
public int compare(DiskTO arg0, DiskTO arg1) {
|
||||
if (arg0.getDiskSeq() < arg1.getDiskSeq()) {
|
||||
return -1;
|
||||
} else if (arg0.getDiskSeq() == arg1.getDiskSeq()) {
|
||||
} else if (arg0.getDiskSeq().equals(arg1.getDiskSeq())) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class VmwareStorageMotionStrategy implements DataMotionStrategy {
|
|||
try {
|
||||
VMInstanceVO instance = instanceDao.findById(vmTo.getId());
|
||||
if (instance != null) {
|
||||
if (srcHost.getClusterId() == destHost.getClusterId()) {
|
||||
if (srcHost.getClusterId().equals(destHost.getClusterId())) {
|
||||
answer = migrateVmWithVolumesWithinCluster(instance, vmTo, srcHost, destHost, volumeMap);
|
||||
} else {
|
||||
answer = migrateVmWithVolumesAcrossCluster(instance, vmTo, srcHost, destHost, volumeMap);
|
||||
|
|
|
|||
|
|
@ -846,7 +846,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
Set<VIF> dom0Vifs = dom0.getVIFs(conn);
|
||||
for (VIF vif:dom0Vifs) {
|
||||
vif.getRecord(conn);
|
||||
if (vif.getNetwork(conn).getUuid(conn) == nw.getUuid(conn)) {
|
||||
if (vif.getNetwork(conn).getUuid(conn).equals(nw.getUuid(conn))) {
|
||||
dom0vif = vif;
|
||||
s_logger.debug("A VIF for dom0 has already been found - No need to create one");
|
||||
}
|
||||
|
|
@ -3427,7 +3427,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
|||
Set<VBD> vbds = vm.getVBDs(conn);
|
||||
for( VBD vbd : vbds) {
|
||||
VBD.Record vbdRec = vbd.getRecord(conn);
|
||||
if( vbdRec.type.equals(Types.VbdType.CD.toString()) && !vbdRec.empty ) {
|
||||
if( vbdRec.type.equals(Types.VbdType.CD) && !vbdRec.empty ) {
|
||||
vbd.eject(conn);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public class XenServerStorageMotionStrategy implements DataMotionStrategy {
|
|||
try {
|
||||
VMInstanceVO instance = instanceDao.findById(vmTo.getId());
|
||||
if (instance != null) {
|
||||
if (srcHost.getClusterId() == destHost.getClusterId()) {
|
||||
if (srcHost.getClusterId().equals(destHost.getClusterId())) {
|
||||
answer = migrateVmWithVolumesWithinCluster(instance, vmTo, srcHost, destHost, volumeMap);
|
||||
} else {
|
||||
answer = migrateVmWithVolumesAcrossCluster(instance, vmTo, srcHost, destHost, volumeMap);
|
||||
|
|
|
|||
|
|
@ -840,7 +840,7 @@ public class NetUtils {
|
|||
//this implies cidrA is super set of cidrB
|
||||
return supersetOrSubset.isSuperset;
|
||||
}
|
||||
else if (cidrALong[1] == cidrBLong[1]) {
|
||||
else if (cidrALong[1].equals(cidrBLong[1])) {
|
||||
//this implies both the cidrs are equal
|
||||
return supersetOrSubset.sameSubnet;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import com.vmware.vim25.PropertySpec;
|
|||
import com.vmware.vim25.SelectionSpec;
|
||||
import com.vmware.vim25.TraversalSpec;
|
||||
|
||||
import com.cloud.exception.CloudException;
|
||||
import com.cloud.hypervisor.vmware.util.VmwareContext;
|
||||
import com.cloud.utils.Pair;
|
||||
|
||||
|
|
@ -349,7 +350,12 @@ public class DatastoreMO extends BaseMO {
|
|||
ArrayList<HostDatastoreBrowserSearchResults> results = browserMo.searchDatastoreSubFolders("[" + getName() + "]", fileName, caseInsensitive);
|
||||
if (results != null && results.size() > 1) {
|
||||
s_logger.warn("Multiple files with name " + fileName + " exists in datastore " + datastorePath + ". Trying to choose first file found in search attempt.");
|
||||
} else if (results == null) {
|
||||
String msg = "No file found with name " + fileName + " found in datastore " + datastorePath;
|
||||
s_logger.error(msg);
|
||||
throw new CloudException(msg);
|
||||
}
|
||||
|
||||
for (HostDatastoreBrowserSearchResults result : results) {
|
||||
List<FileInfo> info = result.getFile();
|
||||
if (info != null && info.size() > 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue