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 4815b02
Date Fri, 08 Nov 2013 23:50:23 GMT
Updated Branches:
  refs/heads/master d9ebbaeb7 -> 4815b024b


Add quiesce vm for vmware during vm snapshot


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

Branch: refs/heads/master
Commit: 4815b024bf46104049d476a747168177dfb93fed
Parents: d9ebbae
Author: Edison Su <sudison@gmail.com>
Authored: Fri Nov 8 15:46:48 2013 -0800
Committer: Edison Su <sudison@gmail.com>
Committed: Fri Nov 8 15:47:11 2013 -0800

----------------------------------------------------------------------
 core/src/com/cloud/agent/api/VMSnapshotTO.java       | 15 +++++++++++++--
 .../vmsnapshot/DefaultVMSnapshotStrategy.java        | 11 ++++++++---
 .../storage/helper/HypervisorHelperImpl.java         |  2 +-
 .../storage/helper/VMSnapshotHelperImpl.java         |  2 +-
 .../vmware/manager/VmwareStorageManagerImpl.java     |  3 ++-
 5 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4815b024/core/src/com/cloud/agent/api/VMSnapshotTO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/VMSnapshotTO.java b/core/src/com/cloud/agent/api/VMSnapshotTO.java
index 473c39a..9bc8712 100644
--- a/core/src/com/cloud/agent/api/VMSnapshotTO.java
+++ b/core/src/com/cloud/agent/api/VMSnapshotTO.java
@@ -31,6 +31,7 @@ public class VMSnapshotTO {
     private String description;
     private VMSnapshotTO parent;
     private List<VolumeObjectTO> volumes;
+    private boolean quiescevm;
     
     public Long getId() {
 		return id;
@@ -40,7 +41,8 @@ public class VMSnapshotTO {
 	}
 	public VMSnapshotTO(Long id, String snapshotName, 
 	        VMSnapshot.Type type, Long createTime, 
-			String description, Boolean current, VMSnapshotTO parent) {
+			String description, Boolean current, VMSnapshotTO parent,
+            boolean quiescevm) {
 		super();
 		this.id = id;
 		this.snapshotName = snapshotName;
@@ -49,9 +51,10 @@ public class VMSnapshotTO {
 		this.current = current;
 		this.description = description;
 		this.parent = parent;
+        this.quiescevm = quiescevm;
 	}
 	public VMSnapshotTO() {
-	    
+	    this.quiescevm = true;
 	}
 	public String getDescription() {
 		return description;
@@ -99,4 +102,12 @@ public class VMSnapshotTO {
     public void setVolumes(List<VolumeObjectTO> volumes) {
         this.volumes = volumes;
     }
+
+    public boolean getQuiescevm() {
+        return this.quiescevm;
+    }
+
+    public void setQuiescevm(boolean quiescevm) {
+        this.quiescevm = quiescevm;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4815b024/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
index be3cce9..3f5e4f7 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/vmsnapshot/DefaultVMSnapshotStrategy.java
@@ -25,6 +25,7 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority;
+import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotOptions;
 import org.apache.cloudstack.engine.subsystem.api.storage.VMSnapshotStrategy;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 import org.apache.cloudstack.storage.to.VolumeObjectTO;
@@ -111,8 +112,12 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements
VMSnapshot
             VMSnapshotVO currentSnapshot = vmSnapshotDao.findCurrentSnapshotByVmId(userVm.getId());
             if (currentSnapshot != null)
                 current = vmSnapshotHelper.getSnapshotWithParents(currentSnapshot);
+            VMSnapshotOptions options = ((VMSnapshotVO) vmSnapshot).getOptions();
+            boolean quiescevm = true;
+            if (options != null)
+                quiescevm = options.needQuiesceVM();
             VMSnapshotTO target = new VMSnapshotTO(vmSnapshot.getId(),  vmSnapshot.getName(),
vmSnapshot.getType(), null, vmSnapshot.getDescription(), false,
-                    current);
+                    current, quiescevm);
             if (current == null)
                 vmSnapshotVO.setParent(null);
             else
@@ -174,7 +179,7 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements
VMSnapshot
             String vmInstanceName = userVm.getInstanceName();
             VMSnapshotTO parent = vmSnapshotHelper.getSnapshotWithParents(vmSnapshotVO).getParent();
             VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(vmSnapshot.getId(), vmSnapshot.getName(),
vmSnapshot.getType(),
-                    vmSnapshot.getCreated().getTime(), vmSnapshot.getDescription(), vmSnapshot.getCurrent(),
parent);
+                    vmSnapshot.getCreated().getTime(), vmSnapshot.getDescription(), vmSnapshot.getCurrent(),
parent, true);
             GuestOSVO guestOS = guestOSDao.findById(userVm.getGuestOSId());
             DeleteVMSnapshotCommand deleteSnapshotCommand = new DeleteVMSnapshotCommand(vmInstanceName,
vmSnapshotTO, volumeTOs,guestOS.getDisplayName());
 
@@ -330,7 +335,7 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements
VMSnapshot
             VMSnapshotTO parent = vmSnapshotHelper.getSnapshotWithParents(snapshot).getParent();
 
             VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(snapshot.getId(), snapshot.getName(),
snapshot.getType(),
-                    snapshot.getCreated().getTime(), snapshot.getDescription(), snapshot.getCurrent(),
parent);
+                    snapshot.getCreated().getTime(), snapshot.getDescription(), snapshot.getCurrent(),
parent, true);
             Long hostId = vmSnapshotHelper.pickRunningHost(vmSnapshot.getVmId());
             GuestOSVO guestOS = guestOSDao.findById(userVm.getGuestOSId());
             RevertToVMSnapshotCommand revertToSnapshotCommand = new RevertToVMSnapshotCommand(vmInstanceName,
vmSnapshotTO, volumeTOs, guestOS.getDisplayName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4815b024/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
b/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
index 7dbd35c..eb29aa4 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
@@ -111,7 +111,7 @@ public class HypervisorHelperImpl implements HypervisorHelper {
         int wait = NumbersUtil.parseInt(value, 1800);
         Long hostId = vmSnapshotHelper.pickRunningHost(virtualMachine.getId());
         VMSnapshotTO vmSnapshotTO = new VMSnapshotTO(1L,  UUID.randomUUID().toString(), VMSnapshot.Type.DiskAndMemory,
null, null, false,
-                null);
+                null, true);
         GuestOSVO guestOS = guestOSDao.findById(virtualMachine.getGuestOSId());
         List<VolumeObjectTO> volumeTOs = vmSnapshotHelper.getVolumeTOList(virtualMachine.getId());
         CreateVMSnapshotCommand ccmd = new CreateVMSnapshotCommand(virtualMachine.getInstanceName(),vmSnapshotTO
,volumeTOs, guestOS.getDisplayName(),virtualMachine.getState());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4815b024/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java
b/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java
index 1200be8..9693e91 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/helper/VMSnapshotHelperImpl.java
@@ -122,7 +122,7 @@ public class VMSnapshotHelperImpl implements VMSnapshotHelper {
 
     private VMSnapshotTO convert2VMSnapshotTO(VMSnapshotVO vo) {
         return new VMSnapshotTO(vo.getId(), vo.getName(),  vo.getType(), vo.getCreated().getTime(),
vo.getDescription(),
-                vo.getCurrent(), null);
+                vo.getCurrent(), null, true);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4815b024/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 4c34ebc..3519ca1 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
@@ -1275,6 +1275,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
         String vmSnapshotName = cmd.getTarget().getSnapshotName();
         String vmSnapshotDesc = cmd.getTarget().getDescription();
         boolean snapshotMemory = cmd.getTarget().getType() == VMSnapshot.Type.DiskAndMemory;
+        boolean quiescevm = cmd.getTarget().getQuiescevm();
         VirtualMachineMO vmMo = null;
         VmwareContext context = hostService.getServiceContext(cmd);
         Map<String, String> mapNewDisk = new HashMap<String, String>();
@@ -1303,7 +1304,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
             } else {
                 if (vmMo.getSnapshotMor(vmSnapshotName) != null){
                     s_logger.debug("VM snapshot " + vmSnapshotName + " already exists");
-                }else if (!vmMo.createSnapshot(vmSnapshotName, vmSnapshotDesc, snapshotMemory,
true)) {
+                }else if (!vmMo.createSnapshot(vmSnapshotName, vmSnapshotDesc, snapshotMemory,
quiescevm)) {
                     return new CreateVMSnapshotAnswer(cmd, false,
                             "Unable to create snapshot due to esxi internal failed");
                 }


Mime
View raw message