You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2014/01/28 23:22:39 UTC
[2/2] git commit: updated refs/heads/4.3 to 220a2a1
Backport fixed for issues found by Findbugs
(cherry picked from commit 60ac12780bfa1604902a89d5dc7937a8b9334e0d)
Signed-off-by: Animesh Chaturvedi <an...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/220a2a1a
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/220a2a1a
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/220a2a1a
Branch: refs/heads/4.3
Commit: 220a2a1a0e69b66b709302e7045447d553c27369
Parents: 1be40d6
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Fri Jan 24 13:01:08 2014 +0000
Committer: Animesh Chaturvedi <an...@apache.org>
Committed: Tue Jan 28 14:14:44 2014 -0800
----------------------------------------------------------------------
.../cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java | 2 +-
.../com/cloud/hypervisor/vmware/resource/VmwareResource.java | 2 +-
.../cloudstack/storage/motion/VmwareStorageMotionStrategy.java | 2 +-
.../com/cloud/hypervisor/xen/resource/CitrixResourceBase.java | 4 ++--
.../storage/motion/XenServerStorageMotionStrategy.java | 2 +-
utils/src/com/cloud/utils/net/NetUtils.java | 2 +-
.../src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java | 6 ++++++
7 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220a2a1a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index 012c8a5..bdccc10 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -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;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220a2a1a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 41191f9..7439f12 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -3512,7 +3512,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;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220a2a1a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java b/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
index 4668f67..446093f 100644
--- a/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
+++ b/plugins/hypervisors/vmware/src/org/apache/cloudstack/storage/motion/VmwareStorageMotionStrategy.java
@@ -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);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220a2a1a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index 548223f..bf9b068 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -857,7 +857,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");
}
@@ -3438,7 +3438,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;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220a2a1a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java b/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
index 3dc7dd8..8d11940 100644
--- a/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
+++ b/plugins/hypervisors/xen/src/org/apache/cloudstack/storage/motion/XenServerStorageMotionStrategy.java
@@ -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);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220a2a1a/utils/src/com/cloud/utils/net/NetUtils.java
----------------------------------------------------------------------
diff --git a/utils/src/com/cloud/utils/net/NetUtils.java b/utils/src/com/cloud/utils/net/NetUtils.java
index a72aded..792d606 100755
--- a/utils/src/com/cloud/utils/net/NetUtils.java
+++ b/utils/src/com/cloud/utils/net/NetUtils.java
@@ -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;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/220a2a1a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
index 4b2ce08..716bc20 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/DatastoreMO.java
@@ -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) {