cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject [1/2] git commit: updated refs/heads/4.5 to c0a801a
Date Wed, 19 Aug 2015 17:07:09 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 74f697a2d -> c0a801a98


CLOUDSTACK-8748: VM UUID accessible in CreateVMSnapshotCommand and RevertToVMSnapshotCommand

This patch makes it possible to expose VM UUID to subsystems, this can be
useful for implementing VM Snapshots for KVM in future.

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/0062ff26
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0062ff26
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0062ff26

Branch: refs/heads/4.5
Commit: 0062ff2672e257f2a4290e054e23ef4333a34983
Parents: 1a106ec
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Wed Aug 19 15:31:37 2015 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Aug 19 15:31:37 2015 +0530

----------------------------------------------------------------------
 .../com/cloud/agent/api/CreateVMSnapshotCommand.java    |  8 +++++++-
 .../com/cloud/agent/api/RevertToVMSnapshotCommand.java  | 12 +++++++++---
 .../storage/vmsnapshot/DefaultVMSnapshotStrategy.java   |  4 ++--
 .../cloudstack/storage/helper/HypervisorHelperImpl.java |  2 +-
 4 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0062ff26/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java b/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
index ab4edaf..1455145 100644
--- a/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
+++ b/core/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
@@ -25,8 +25,14 @@ import org.apache.cloudstack.storage.to.VolumeObjectTO;
 
 
 public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand {
+    private String vmUuid;
 
-    public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeObjectTO>
volumeTOs, String guestOSType) {
+    public CreateVMSnapshotCommand(String vmName, String vmUuid, VMSnapshotTO snapshot, List<VolumeObjectTO>
volumeTOs, String guestOSType) {
         super(vmName, snapshot, volumeTOs, guestOSType);
+        this.vmUuid = vmUuid;
+    }
+
+    public String getVmUuid() {
+        return vmUuid;
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0062ff26/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 7a7d3d4..fc8ba08 100644
--- a/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
+++ b/core/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
@@ -25,16 +25,18 @@ import org.apache.cloudstack.storage.to.VolumeObjectTO;
 
 public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
 
-    public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeObjectTO>
volumeTOs, String guestOSType) {
+    public RevertToVMSnapshotCommand(String vmName, String vmUuid, VMSnapshotTO snapshot,
List<VolumeObjectTO> volumeTOs, String guestOSType) {
         super(vmName, snapshot, volumeTOs, guestOSType);
+        this.vmUuid = vmUuid;
     }
 
-    public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeObjectTO>
volumeTOs, String guestOSType, boolean reloadVm) {
-        this(vmName, snapshot, volumeTOs, guestOSType);
+    public RevertToVMSnapshotCommand(String vmName, String vmUuid, VMSnapshotTO snapshot,
List<VolumeObjectTO> volumeTOs, String guestOSType, boolean reloadVm) {
+        this(vmName, vmUuid, snapshot, volumeTOs, guestOSType);
         setReloadVm(reloadVm);
     }
 
     private boolean reloadVm = false;
+    private String vmUuid;
 
     public boolean isReloadVm() {
         return reloadVm;
@@ -43,4 +45,8 @@ public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
     public void setReloadVm(boolean reloadVm) {
         this.reloadVm = reloadVm;
     }
+
+    public String getVmUuid() {
+        return vmUuid;
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0062ff26/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 c204d29..13fd54c 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
@@ -137,7 +137,7 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements
VMSnapshot
             HostVO host = hostDao.findById(hostId);
             GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(),
host.getHypervisorType().toString(), host.getHypervisorVersion());
 
-            CreateVMSnapshotCommand ccmd = new CreateVMSnapshotCommand(userVm.getInstanceName(),
target, volumeTOs, guestOS.getDisplayName());
+            CreateVMSnapshotCommand ccmd = new CreateVMSnapshotCommand(userVm.getInstanceName(),
userVm.getUuid(), target, volumeTOs, guestOS.getDisplayName());
             if (guestOsMapping == null) {
                 ccmd.setPlatformEmulator(null);
             } else {
@@ -350,7 +350,7 @@ public class DefaultVMSnapshotStrategy extends ManagerBase implements
VMSnapshot
                     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());
+            RevertToVMSnapshotCommand revertToSnapshotCommand = new RevertToVMSnapshotCommand(vmInstanceName,
userVm.getUuid(), vmSnapshotTO, volumeTOs, guestOS.getDisplayName());
             HostVO host = hostDao.findById(hostId);
             GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(),
host.getHypervisorType().toString(), host.getHypervisorVersion());
             if (guestOsMapping == null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0062ff26/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 e90770e..9b7007d 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/helper/HypervisorHelperImpl.java
@@ -124,7 +124,7 @@ public class HypervisorHelperImpl implements HypervisorHelper {
         GuestOSVO guestOS = guestOSDao.findById(virtualMachine.getGuestOSId());
         List<VolumeObjectTO> volumeTOs = vmSnapshotHelper.getVolumeTOList(virtualMachine.getId());
         CreateVMSnapshotCommand ccmd =
-            new CreateVMSnapshotCommand(virtualMachine.getInstanceName(), vmSnapshotTO, volumeTOs,
guestOS.getDisplayName());
+            new CreateVMSnapshotCommand(virtualMachine.getInstanceName(), virtualMachine.getUuid(),
vmSnapshotTO, volumeTOs, guestOS.getDisplayName());
         HostVO host = hostDao.findById(hostId);
         GuestOSHypervisorVO guestOsMapping = guestOsHypervisorDao.findByOsIdAndHypervisor(guestOS.getId(),
host.getHypervisorType().toString(), host.getHypervisorVersion());
         ccmd.setPlatformEmulator(guestOsMapping.getGuestOsName());


Mime
View raw message