cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From likit...@apache.org
Subject [2/2] git commit: updated refs/heads/master to 7dbff9b
Date Wed, 20 Aug 2014 05:32:35 GMT
CLOUDSTACK-4587. System VMs fail to start when the primary storage that has the System VMs
is put into maintenance.
During VM start while configuring its disk devices, obtain the matching disk for a volume
in storage
using both the volume's path and volume's datastore information.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8bb4022f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8bb4022f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8bb4022f

Branch: refs/heads/master
Commit: 8bb4022f3729154f85036c4a7f55e2de783e4909
Parents: 4e5dc59
Author: Likitha Shetty <likitha.shetty@citrix.com>
Authored: Fri Aug 8 14:20:03 2014 +0530
Committer: Likitha Shetty <likitha.shetty@citrix.com>
Committed: Wed Aug 20 10:51:18 2014 +0530

----------------------------------------------------------------------
 .../cloud/hypervisor/vmware/resource/VmwareResource.java  |  5 +++--
 .../vmware/mo/VirtualMachineDiskInfoBuilder.java          | 10 +++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bb4022f/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 60007e3..7474d5c 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
@@ -1999,12 +1999,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
     private VirtualMachineDiskInfo getMatchingExistingDisk(VirtualMachineDiskInfoBuilder
diskInfoBuilder, DiskTO vol) {
         if (diskInfoBuilder != null) {
             VolumeObjectTO volume = (VolumeObjectTO)vol.getData();
+            String dsName = volume.getDataStore().getUuid().replace("-", "");
 
             Map<String, String> details = vol.getDetails();
             boolean isManaged = details != null && Boolean.parseBoolean(details.get(DiskTO.MANAGED));
 
             VirtualMachineDiskInfo diskInfo =
-                    diskInfoBuilder.getDiskInfoByBackingFileBaseName(isManaged ? new DatastoreFile(volume.getPath()).getFileBaseName()
: volume.getPath());
+                    diskInfoBuilder.getDiskInfoByBackingFileBaseName(isManaged ? new DatastoreFile(volume.getPath()).getFileBaseName()
: volume.getPath(), dsName);
             if (diskInfo != null) {
                 s_logger.info("Found existing disk info from volume path: " + volume.getPath());
                 return diskInfo;
@@ -2017,7 +2018,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                         if (disks.length > 0) {
                             for (String diskPath : disks) {
                                 DatastoreFile file = new DatastoreFile(diskPath);
-                                diskInfo = diskInfoBuilder.getDiskInfoByBackingFileBaseName(file.getFileBaseName());
+                                diskInfo = diskInfoBuilder.getDiskInfoByBackingFileBaseName(file.getFileBaseName(),
dsName);
                                 if (diskInfo != null) {
                                     s_logger.info("Found existing disk from chain info: "
+ diskPath);
                                     return diskInfo;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bb4022f/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineDiskInfoBuilder.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineDiskInfoBuilder.java
b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineDiskInfoBuilder.java
index 9e9fa89..ba0a3ea 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineDiskInfoBuilder.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineDiskInfoBuilder.java
@@ -61,9 +61,9 @@ public class VirtualMachineDiskInfoBuilder {
         return null;
     }
 
-    public VirtualMachineDiskInfo getDiskInfoByBackingFileBaseName(String diskBackingFileBaseName)
{
+    public VirtualMachineDiskInfo getDiskInfoByBackingFileBaseName(String diskBackingFileBaseName,
String dataStoreName) {
         for (Map.Entry<String, List<String>> entry : disks.entrySet()) {
-            if (chainContains(entry.getValue(), diskBackingFileBaseName)) {
+            if (chainContains(entry.getValue(), diskBackingFileBaseName, dataStoreName))
{
                 VirtualMachineDiskInfo diskInfo = new VirtualMachineDiskInfo();
                 diskInfo.setDiskDeviceBusName(entry.getKey());
                 diskInfo.setDiskChain(entry.getValue().toArray(new String[1]));
@@ -84,11 +84,11 @@ public class VirtualMachineDiskInfoBuilder {
         return chain;
     }
 
-    private static boolean chainContains(List<String> chain, String diskBackingFileBaseName)
{
+    private static boolean chainContains(List<String> chain, String diskBackingFileBaseName,
String dataStoreName) {
         for (String backing : chain) {
             DatastoreFile file = new DatastoreFile(backing);
-
-            if (file.getFileBaseName().equals(diskBackingFileBaseName))
+            // Ensure matching disk exists in the right datastore
+            if (file.getFileBaseName().equals(diskBackingFileBaseName) && backing.contains(dataStoreName))
                 return true;
         }
 


Mime
View raw message