cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [33/53] [abbrv] git commit: updated refs/heads/reporter to 5c99784
Date Wed, 15 Apr 2015 08:05:33 GMT
vmware-base: get vsessiontimeout from client class

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 4d9a94ce6956e61882b0fd7f15c1ec66d6419135)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


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

Branch: refs/heads/reporter
Commit: 04dccda3f0b2c8d9c5ec9afafba5d70edabaa87d
Parents: a70947f
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Mon Apr 13 15:37:13 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Mon Apr 13 15:48:11 2015 +0530

----------------------------------------------------------------------
 .../hypervisor/vmware/mo/VirtualMachineMO.java    | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/04dccda3/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
index 2798d54..ac5b414 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -458,6 +458,7 @@ public class VirtualMachineMO extends BaseMO {
 
     public boolean createSnapshot(String snapshotName, String snapshotDescription, boolean
dumpMemory, boolean quiesce) throws Exception {
 
+        long apiTimeout = _context.getVimClient().getVcenterSessionTimeout();
         ManagedObjectReference morTask = _context.getService().createSnapshotTask(_mor, snapshotName,
snapshotDescription, dumpMemory, quiesce);
 
         boolean result = _context.getVimClient().waitForTask(morTask);
@@ -467,7 +468,7 @@ public class VirtualMachineMO extends BaseMO {
             ManagedObjectReference morSnapshot = null;
             // We still need to wait until the object appear in vCenter
             long startTick = System.currentTimeMillis();
-            while (System.currentTimeMillis() - startTick < 10000) {
+            while (System.currentTimeMillis() - startTick < apiTimeout) {
                 morSnapshot = getSnapshotMor(snapshotName);
                 if (morSnapshot != null) {
                     break;
@@ -479,9 +480,11 @@ public class VirtualMachineMO extends BaseMO {
                 }
             }
 
-            if (morSnapshot == null)
-                s_logger.error("We've been waiting for over 10 seconds for snapshot MOR to
be appearing in vCenter after CreateSnapshot task is done, but it is still not there?!");
-
+            if (morSnapshot == null) {
+                s_logger.error("We've been waiting for over " + apiTimeout + " milli seconds
for snapshot MOR to be appearing in vCenter after CreateSnapshot task is done, but it is still
not there?!");
+                return false;
+            }
+            s_logger.debug("Waited for " + (System.currentTimeMillis() - startTick) + " seconds
for snapshot object [" + snapshotName + "] to appear in vCenter.");
             return true;
         } else {
             s_logger.error("VMware createSnapshot_Task failed due to " + TaskMO.getTaskFailureInfo(_context,
morTask));
@@ -1751,8 +1754,15 @@ public class VirtualMachineMO extends BaseMO {
         }
     }
 
+  public String getGuestId() throws Exception {
+    return (String)_context.getVimClient().getDynamicProperty(_mor, "config.guestId");
+  }
+
     public GuestOsDescriptor getGuestOsDescriptor(String guestOsId) throws Exception {
         GuestOsDescriptor guestOsDescriptor = null;
+        if (guestOsId == null) {
+            guestOsId = getGuestId();
+        }
         ManagedObjectReference vmEnvironmentBrowser = _context.getVimClient().getMoRefProp(_mor,
"environmentBrowser");
         VirtualMachineConfigOption vmConfigOption = _context.getService().queryConfigOption(vmEnvironmentBrowser,
null, null);
         List<GuestOsDescriptor> guestDescriptors = vmConfigOption.getGuestOSDescriptor();


Mime
View raw message