cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/master to d0123f9
Date Thu, 07 Nov 2013 22:24:33 GMT
Updated Branches:
  refs/heads/master 99acb9785 -> d0123f959


Added option to reload VM during in RevertToVMSnapshotCommand (only in VMWare as I don't believe
that XenServer supports anything similar)

Signed-off-by: Edison Su <sudison@gmail.com>


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

Branch: refs/heads/master
Commit: d0123f9594b1a3604fc7acf50dc71e56d906aaa0
Parents: 99acb97
Author: Chris Suich <chris.suich@netapp.com>
Authored: Thu Nov 7 15:55:11 2013 -0500
Committer: Edison Su <sudison@gmail.com>
Committed: Thu Nov 7 14:23:36 2013 -0800

----------------------------------------------------------------------
 .../agent/api/RevertToVMSnapshotCommand.java    | 15 +++++++-
 .../manager/VmwareStorageManagerImpl.java       | 40 +++++++++++---------
 2 files changed, 36 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d0123f95/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java b/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
index 1e5fd6c..b744ced 100644
--- a/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
+++ b/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
@@ -18,7 +18,6 @@ package com.cloud.agent.api;
 
 import java.util.List;
 
-import com.cloud.agent.api.to.VolumeTO;
 import org.apache.cloudstack.storage.to.VolumeObjectTO;
 
 public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
@@ -27,4 +26,18 @@ public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
         super(vmName, snapshot, volumeTOs, guestOSType);
     }
 
+    public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeObjectTO>
volumeTOs, String guestOSType, boolean reloadVm) {
+        this(vmName, snapshot, volumeTOs, guestOSType);
+        setReloadVm(reloadVm);
+    }
+
+    private boolean reloadVm = false;
+
+    public boolean isReloadVm() {
+        return reloadVm;
+    }
+
+    public void setReloadVm(boolean reloadVm) {
+        this.reloadVm = reloadVm;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d0123f95/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
index 0e2423e..b2be930 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
@@ -16,6 +16,23 @@
 // under the License.
 package com.cloud.hypervisor.vmware.manager;
 
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.UUID;
+
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
+import org.apache.log4j.Logger;
+
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.BackupSnapshotAnswer;
 import com.cloud.agent.api.BackupSnapshotCommand;
@@ -70,22 +87,6 @@ import com.vmware.vim25.HostDatastoreBrowserSearchSpec;
 import com.vmware.vim25.ManagedObjectReference;
 import com.vmware.vim25.TaskInfo;
 import com.vmware.vim25.VirtualDisk;
-import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.cloudstack.storage.to.VolumeObjectTO;
-import org.apache.log4j.Logger;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.UUID;
 
 public class VmwareStorageManagerImpl implements VmwareStorageManager {
     @Override
@@ -332,7 +333,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
 
                         workerVMName = hostService.getWorkerName(context, cmd, 0);
                         vmMo = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, workerVMName);
-                        
+
                         if (vmMo == null) {
                             throw new Exception("Failed to find the newly create or relocated
VM. vmName: " + workerVMName);
                         }
@@ -1056,7 +1057,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
                 // create a dummy worker vm for attaching the volume
                 DatastoreMO dsMo = new DatastoreMO(hyperHost.getContext(), morDs);
                 workerVm = HypervisorHostHelper.createWorkerVM(hyperHost, dsMo, workerVmName);
-                
+
                 if (workerVm == null) {
                     String msg = "Unable to create worker VM to execute CopyVolumeCommand";
                     s_logger.error(msg);
@@ -1449,6 +1450,9 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
                 s_logger.debug(msg);
                 return new RevertToVMSnapshotAnswer(cmd, false, msg);
             } else {
+                if (cmd.isReloadVm()) {
+                    vmMo.reload();
+                }
                 boolean result = false;
                 if (snapshotName != null) {
                     ManagedObjectReference morSnapshot = vmMo.getSnapshotMor(snapshotName);


Mime
View raw message