You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mi...@apache.org on 2012/11/18 11:45:36 UTC

[1/3] git commit: submit vm snapshots related codes based on 4.0 branch

Updated Branches:
  refs/heads/vm-snapshot [created] 600fb9048


submit vm snapshots related codes based on 4.0 branch


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

Branch: refs/heads/vm-snapshot
Commit: 600fb9048a234c18c34528f2f21914b36d88729a
Parents: 464c9b7
Author: Mice Xia <mi...@tcloudcomputing.com>
Authored: Sun Nov 18 18:38:28 2012 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Sun Nov 18 18:47:34 2012 +0800

----------------------------------------------------------------------
 .../cloud/agent/api/CreateVMSnapshotAnswer.java    |   62 +
 .../cloud/agent/api/CreateVMSnapshotCommand.java   |   42 +
 .../api/CreateVolumeFromVMSnapshotAnswer.java      |   54 +
 .../api/CreateVolumeFromVMSnapshotCommand.java     |   88 ++
 .../cloud/agent/api/DeleteVMSnapshotAnswer.java    |   49 +
 .../cloud/agent/api/DeleteVMSnapshotCommand.java   |   28 +
 .../cloud/agent/api/RevertToVMSnapshotAnswer.java  |   63 +
 .../cloud/agent/api/RevertToVMSnapshotCommand.java |   29 +
 .../com/cloud/agent/api/VMSnapshotBaseCommand.java |   74 ++
 api/src/com/cloud/agent/api/VMSnapshotTO.java      |   90 ++
 api/src/com/cloud/agent/api/to/VolumeTO.java       |    4 +
 api/src/com/cloud/api/ApiConstants.java            |    6 +
 api/src/com/cloud/api/BaseCmd.java                 |    3 +
 api/src/com/cloud/api/ResponseGenerator.java       |    5 +
 .../cloud/api/commands/CreateVMSnapshotCmd.java    |  133 +++
 .../cloud/api/commands/DeleteVMSnapshotCmd.java    |  119 ++
 .../com/cloud/api/commands/ListVmSnapshotCmd.java  |  131 ++
 .../cloud/api/commands/RevertToSnapshotCmd.java    |  123 ++
 .../com/cloud/api/response/VMSnapshotResponse.java |  170 +++
 api/src/com/cloud/event/EventTypes.java            |    5 +
 api/src/com/cloud/server/ResourceTag.java          |    3 +-
 api/src/com/cloud/vm/VirtualMachine.java           |   28 +-
 api/src/com/cloud/vm/snapshot/VMSnapshot.java      |  104 ++
 .../com/cloud/vm/snapshot/VMSnapshotService.java   |   50 +
 .../WEB-INF/classes/resources/messages.properties  |   14 +
 client/tomcatconf/commands.properties.in           |    6 +
 core/src/com/cloud/vm/snapshot/VMSnapshotVO.java   |  225 ++++
 .../kvm/resource/LibvirtComputingResource.java     |  263 ++++-
 .../vmware/manager/VmwareStorageManager.java       |   16 +-
 .../vmware/manager/VmwareStorageManagerImpl.java   |  332 +++++-
 .../hypervisor/vmware/resource/VmwareResource.java |   55 +-
 .../xen/resource/CitrixResourceBase.java           |  302 +++++
 scripts/vm/hypervisor/xenserver/vmopsSnapshot      |   29 +-
 server/src/com/cloud/api/ApiDBUtils.java           |   18 +-
 server/src/com/cloud/api/ApiResponseHelper.java    |   25 +-
 server/src/com/cloud/configuration/Config.java     |    9 +-
 .../configuration/DefaultComponentLibrary.java     |    5 +-
 .../com/cloud/resource/ResourceManagerImpl.java    |    2 +-
 .../storage/snapshot/SnapshotManagerImpl.java      |   13 +-
 .../com/cloud/tags/TaggedResourceManagerImpl.java  |    4 +
 server/src/com/cloud/vm/UserVmManagerImpl.java     |   28 +-
 .../com/cloud/vm/VirtualMachineManagerImpl.java    |   73 ++-
 .../com/cloud/vm/snapshot/VMSnapshotManager.java   |   45 +
 .../cloud/vm/snapshot/VMSnapshotManagerImpl.java   |  917 +++++++++++++++
 .../com/cloud/vm/snapshot/dao/VMSnapshotDao.java   |   39 +
 .../cloud/vm/snapshot/dao/VMSnapshotDaoImpl.java   |  160 +++
 setup/db/create-schema.sql                         |   31 +
 ui/dictionary.jsp                                  |   12 +-
 ui/index.jsp                                       |    1 +
 ui/scripts/instances.js                            |   80 ++-
 ui/scripts/ui/widgets/detailView.js                |   13 +-
 ui/scripts/vm_snapshots.js                         |  196 +++
 .../src/com/cloud/hypervisor/vmware/mo/HostMO.java |   18 +
 .../hypervisor/vmware/mo/VirtualMachineMO.java     |   20 +
 54 files changed, 4322 insertions(+), 92 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
new file mode 100755
index 0000000..f9fb164
--- /dev/null
+++ b/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java
@@ -0,0 +1,62 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateVMSnapshotAnswer extends Answer {
+
+    private List<VolumeTO> volumeTOs;
+    private VMSnapshotTO vmSnapshotTo;
+    
+ 
+	public List<VolumeTO> getVolumeTOs() {
+        return volumeTOs;
+    }
+
+    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+        this.volumeTOs = volumeTOs;
+    }
+
+    public VMSnapshotTO getVmSnapshotTo() {
+        return vmSnapshotTo;
+    }
+
+    public void setVmSnapshotTo(VMSnapshotTO vmSnapshotTo) {
+        this.vmSnapshotTo = vmSnapshotTo;
+    }
+
+    public CreateVMSnapshotAnswer() {
+
+    }
+
+    public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd, boolean success,
+            String result) {
+        super(cmd, success, result);
+    }
+
+    public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd,
+    		VMSnapshotTO vmSnapshotTo, List<VolumeTO> volumeTOs) {
+        super(cmd, true, "");
+        this.vmSnapshotTo = vmSnapshotTo;
+        this.volumeTOs = volumeTOs;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
new file mode 100755
index 0000000..478987d
--- /dev/null
+++ b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.vm.VirtualMachine;
+
+public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand {
+
+    public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType, VirtualMachine.State vmState) {
+        super(vmName, snapshot, volumeTOs, guestOSType);
+        this.vmState  = vmState;
+    }
+
+    private VirtualMachine.State vmState;
+   
+
+    public VirtualMachine.State getVmState() {
+        return vmState;
+    }
+
+    public void setVmState(VirtualMachine.State vmState) {
+        this.vmState = vmState;
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
new file mode 100644
index 0000000..ed3bc62
--- /dev/null
+++ b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java
@@ -0,0 +1,54 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class CreateVolumeFromVMSnapshotAnswer extends Answer {
+    private String path;
+    private VolumeTO volumeTo;
+
+    public VolumeTO getVolumeTo() {
+        return volumeTo;
+    }
+
+    public CreateVolumeFromVMSnapshotAnswer(
+            CreateVolumeFromVMSnapshotCommand cmd, VolumeTO volumeTo) {
+        super(cmd, true, "");
+        this.volumeTo = volumeTo;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    protected CreateVolumeFromVMSnapshotAnswer() {
+
+    }
+
+    public CreateVolumeFromVMSnapshotAnswer(
+            CreateVolumeFromVMSnapshotCommand cmd, String path) {
+        super(cmd, true, "");
+        this.path = path;
+    }
+
+    public CreateVolumeFromVMSnapshotAnswer(
+            CreateVolumeFromVMSnapshotCommand cmd, boolean result, String string) {
+        super(cmd, result, string);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
new file mode 100644
index 0000000..634e15c
--- /dev/null
+++ b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java
@@ -0,0 +1,88 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.vm.DiskProfile;
+
+public class CreateVolumeFromVMSnapshotCommand extends Command {
+
+    protected String path;
+    protected String name;
+    protected Boolean fullClone;
+    protected String storagePoolUuid;
+    private StorageFilerTO pool;
+    private DiskProfile diskProfile;
+    private Long volumeId;
+
+    public DiskProfile getDskch() {
+        return diskProfile;
+    }
+
+    public String getPath() {
+        return path;
+    }
+
+    public Long getVolumeId() {
+        return volumeId;
+    }
+
+    protected CreateVolumeFromVMSnapshotCommand() {
+
+    }
+
+    public CreateVolumeFromVMSnapshotCommand(String path, String name,
+            Boolean fullClone, String storagePoolUuid) {
+        this.path = path;
+        this.name = name;
+        this.fullClone = fullClone;
+        this.storagePoolUuid = storagePoolUuid;
+    }
+
+    public CreateVolumeFromVMSnapshotCommand(String path, String name,
+            Boolean fullClone, String storagePoolUuid, StorageFilerTO pool,
+            DiskProfile diskProfile, Long volumeId) {
+        this.path = path;
+        this.name = name;
+        this.fullClone = fullClone;
+        this.storagePoolUuid = storagePoolUuid;
+        this.pool = pool;
+        this.diskProfile = diskProfile;
+        this.volumeId = volumeId;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public Boolean getFullClone() {
+        return fullClone;
+    }
+
+    public String getStoragePoolUuid() {
+        return storagePoolUuid;
+    }
+
+    public StorageFilerTO getPool() {
+        return pool;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
new file mode 100755
index 0000000..8f4ecad
--- /dev/null
+++ b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
@@ -0,0 +1,49 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class DeleteVMSnapshotAnswer extends Answer {
+    private List<VolumeTO> volumeTOs;
+
+    public DeleteVMSnapshotAnswer() {
+    }
+
+    public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, boolean result,
+            String message) {
+        super(cmd, result, message);
+    }
+
+    public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd,
+            List<VolumeTO> volumeTOs) {
+        super(cmd, true, "");
+        this.volumeTOs = volumeTOs;
+    }
+
+    public List<VolumeTO> getVolumeTOs() {
+        return volumeTOs;
+    }
+
+    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+        this.volumeTOs = volumeTOs;
+    }
+
+ 
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
new file mode 100755
index 0000000..c213448
--- /dev/null
+++ b/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+
+public class DeleteVMSnapshotCommand extends VMSnapshotBaseCommand {
+    public DeleteVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
+        super( vmName,  snapshot, volumeTOs, guestOSType);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
new file mode 100755
index 0000000..848ffc0
--- /dev/null
+++ b/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.vm.VirtualMachine;
+
+public class RevertToVMSnapshotAnswer extends Answer {
+
+    private List<VolumeTO> volumeTOs;
+    private VirtualMachine.State vmState;
+
+    public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd, boolean result,
+            String message) {
+        super(cmd, result, message);
+    }
+
+    public RevertToVMSnapshotAnswer() {
+        super();
+    }
+
+    public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd,
+            List<VolumeTO> volumeTOs,
+            VirtualMachine.State vmState) {
+        super(cmd, true, "");
+        this.volumeTOs = volumeTOs;
+        this.vmState = vmState;
+    }
+
+    public VirtualMachine.State getVmState() {
+        return vmState;
+    }
+
+    public List<VolumeTO> getVolumeTOs() {
+        return volumeTOs;
+    }
+
+    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+        this.volumeTOs = volumeTOs;
+    }
+
+    public void setVmState(VirtualMachine.State vmState) {
+        this.vmState = vmState;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java b/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
new file mode 100755
index 0000000..429a186
--- /dev/null
+++ b/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java
@@ -0,0 +1,29 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand {
+
+    public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
+        super(vmName, snapshot, volumeTOs, guestOSType);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java b/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
new file mode 100755
index 0000000..d609beb
--- /dev/null
+++ b/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java
@@ -0,0 +1,74 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the 
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.agent.api;
+
+import java.util.List;
+
+import com.cloud.agent.api.to.VolumeTO;
+
+public class VMSnapshotBaseCommand extends Command{
+    protected List<VolumeTO> volumeTOs;
+    protected VMSnapshotTO target;
+    protected String vmName;
+    protected String guestOSType;
+    
+    
+    public VMSnapshotBaseCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
+        this.vmName = vmName;
+        this.target = snapshot;
+        this.volumeTOs = volumeTOs;
+        this.guestOSType = guestOSType;
+    }
+    
+    public List<VolumeTO> getVolumeTOs() {
+        return volumeTOs;
+    }
+
+    public void setVolumeTOs(List<VolumeTO> volumeTOs) {
+        this.volumeTOs = volumeTOs;
+    }
+
+    public VMSnapshotTO getTarget() {
+        return target;
+    }
+
+    public void setTarget(VMSnapshotTO target) {
+        this.target = target;
+    }
+
+    public String getVmName() {
+        return vmName;
+    }
+
+    public void setVmName(String vmName) {
+        this.vmName = vmName;
+    }
+
+    @Override
+    public boolean executeInSequence() {
+        return false;
+    }
+
+    public String getGuestOSType() {
+        return guestOSType;
+    }
+
+    public void setGuestOSType(String guestOSType) {
+        this.guestOSType = guestOSType;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/VMSnapshotTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/VMSnapshotTO.java b/api/src/com/cloud/agent/api/VMSnapshotTO.java
new file mode 100755
index 0000000..d8b9545
--- /dev/null
+++ b/api/src/com/cloud/agent/api/VMSnapshotTO.java
@@ -0,0 +1,90 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the 
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.agent.api;
+
+import com.cloud.vm.snapshot.VMSnapshot;
+
+public class VMSnapshotTO {
+	private Long id;
+    private String snapshotName;
+    private VMSnapshot.Type type;
+    private Long createTime;
+    private Boolean current;
+    private String description;
+    private VMSnapshotTO parent;
+    
+    public Long getId() {
+		return id;
+	}
+	public void setId(Long id) {
+		this.id = id;
+	}
+	public VMSnapshotTO(Long id, String snapshotName, 
+	        VMSnapshot.Type type, Long createTime, 
+			String description, Boolean current, VMSnapshotTO parent) {
+		super();
+		this.id = id;
+		this.snapshotName = snapshotName;
+		this.type = type;
+		this.createTime = createTime;
+		this.current = current;
+		this.description = description;
+		this.parent = parent;
+	}
+	public VMSnapshotTO() {
+	    
+	}
+	public String getDescription() {
+		return description;
+	}
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	public Boolean getCurrent() {
+        return current;
+    }
+    public void setCurrent(Boolean current) {
+        this.current = current;
+    }
+    public Long getCreateTime() {
+        return createTime;
+    }
+    public void setCreateTime(Long createTime) {
+        this.createTime = createTime;
+    }
+ 
+    public VMSnapshot.Type getType() {
+        return type;
+    }
+    public void setType(VMSnapshot.Type type) {
+        this.type = type;
+    }
+
+    public String getSnapshotName() {
+        return snapshotName;
+    }
+    public void setSnapshotName(String snapshotName) {
+        this.snapshotName = snapshotName;
+    }
+    public VMSnapshotTO getParent() {
+        return parent;
+    }
+    public void setParent(VMSnapshotTO parent) {
+        this.parent = parent;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/agent/api/to/VolumeTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/VolumeTO.java b/api/src/com/cloud/agent/api/to/VolumeTO.java
index ca0acb5..ef651b9 100644
--- a/api/src/com/cloud/agent/api/to/VolumeTO.java
+++ b/api/src/com/cloud/agent/api/to/VolumeTO.java
@@ -122,6 +122,10 @@ public class VolumeTO {
     public String getOsType() {
         return guestOsType;
     }
+    
+    public void setPath(String path){
+        this.path = path;
+    }
 
     @Override
     public String toString() {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/api/ApiConstants.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/ApiConstants.java b/api/src/com/cloud/api/ApiConstants.java
index 067ddf7..ca34e95 100755
--- a/api/src/com/cloud/api/ApiConstants.java
+++ b/api/src/com/cloud/api/ApiConstants.java
@@ -205,6 +205,7 @@ public class ApiConstants {
     public static final String VM_AVAILABLE = "vmavailable";
     public static final String VM_LIMIT = "vmlimit";
     public static final String VM_TOTAL = "vmtotal";
+    public static final String VM_ID = "vmid";
     public static final String VNET = "vnet";
     public static final String VOLUME_ID = "volumeid";
     public static final String ZONE_ID = "zoneid";
@@ -382,6 +383,11 @@ public class ApiConstants {
     public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid";
     public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid";
     public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename";
+    public static final String VM_SNAPSHOT_DESCRIPTION = "description";
+    public static final String VM_SNAPSHOT_DISPLAYNAME = "name";
+    public static final String VM_SNAPSHOT_ID = "vmsnapshotid";
+    public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids";
+    public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory";
     
 
     public enum HostDetails {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/api/BaseCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/BaseCmd.java b/api/src/com/cloud/api/BaseCmd.java
index 91c2035..b4acebf 100755
--- a/api/src/com/cloud/api/BaseCmd.java
+++ b/api/src/com/cloud/api/BaseCmd.java
@@ -67,6 +67,7 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.component.ComponentLocator;
 import com.cloud.vm.BareMetalVmService;
 import com.cloud.vm.UserVmService;
+import com.cloud.vm.snapshot.VMSnapshotService;
 
 public abstract class BaseCmd {
     private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName());
@@ -138,6 +139,7 @@ public abstract class BaseCmd {
     public static VpcService _vpcService;
     public static NetworkACLService _networkACLService;
     public static Site2SiteVpnService _s2sVpnService;
+    public static VMSnapshotService _vmSnapshotService;
 
     static void setComponents(ResponseGenerator generator) {
         ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
@@ -168,6 +170,7 @@ public abstract class BaseCmd {
         _taggedResourceService = locator.getManager(TaggedResourceService.class);
         _vpcService = locator.getManager(VpcService.class);
         _networkACLService = locator.getManager(NetworkACLService.class);
+        _vmSnapshotService = locator.getManager(VMSnapshotService.class);
         _s2sVpnService = locator.getManager(Site2SiteVpnService.class);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/api/ResponseGenerator.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/ResponseGenerator.java b/api/src/com/cloud/api/ResponseGenerator.java
index 996a5fc..ccfd352 100755
--- a/api/src/com/cloud/api/ResponseGenerator.java
+++ b/api/src/com/cloud/api/ResponseGenerator.java
@@ -78,6 +78,7 @@ import com.cloud.api.response.TemplateResponse;
 import com.cloud.api.response.TrafficTypeResponse;
 import com.cloud.api.response.UserResponse;
 import com.cloud.api.response.UserVmResponse;
+import com.cloud.api.response.VMSnapshotResponse;
 import com.cloud.api.response.VirtualRouterProviderResponse;
 import com.cloud.api.response.VlanIpRangeResponse;
 import com.cloud.api.response.VolumeResponse;
@@ -143,6 +144,7 @@ import com.cloud.user.UserAccount;
 import com.cloud.uservm.UserVm;
 import com.cloud.vm.InstanceGroup;
 import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.snapshot.VMSnapshot;
 
 public interface ResponseGenerator {
     UserResponse createUserResponse(UserAccount user);
@@ -162,6 +164,7 @@ public interface ResponseGenerator {
     ConfigurationResponse createConfigurationResponse(Configuration cfg);
 
     SnapshotResponse createSnapshotResponse(Snapshot snapshot);
+    VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot);
 
     SnapshotPolicyResponse createSnapshotPolicyResponse(SnapshotPolicy policy);
 
@@ -298,6 +301,8 @@ public interface ResponseGenerator {
      */
     Long getIdentiyId(String tableName, String token);
 
+    VMSnapshot getVMSnapshotById(Long vmSnapshotId);
+
     /**
      * @param resourceTag
      * @param keyValueOnly TODO

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/api/commands/CreateVMSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/CreateVMSnapshotCmd.java b/api/src/com/cloud/api/commands/CreateVMSnapshotCmd.java
new file mode 100644
index 0000000..c10a059
--- /dev/null
+++ b/api/src/com/cloud/api/commands/CreateVMSnapshotCmd.java
@@ -0,0 +1,133 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.api.commands;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseAsyncCreateCmd;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.VMSnapshotResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@Implementation(description = "Creates an instant snapshot of a vm.", responseObject = VMSnapshotResponse.class)
+public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
+
+    public static final Logger s_logger = Logger
+            .getLogger(CreateVMSnapshotCmd.class.getName());
+    private static final String s_name = "createvmsnapshotresponse";
+
+    @IdentityMapper(entityTableName = "vm_instance")
+    @Parameter(name = ApiConstants.VM_ID, type = CommandType.LONG, required = true, description = "The ID of the vm")
+    private Long vmId;
+
+    @IdentityMapper(entityTableName = "vm_snapshots")
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The discription of the snapshot")
+    private String description;
+
+    @IdentityMapper(entityTableName = "vm_snapshots")
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_DISPLAYNAME, type = CommandType.STRING, required = false, description = "The display name of the snapshot")
+    private String displayName;
+
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_MEMORY, type = CommandType.BOOLEAN, required = false, description = "snapshot memory if true")
+    private Boolean snapshotMemory;
+
+    public Boolean snapshotMemory() {
+        if (snapshotMemory == null) {
+            return false;
+        } else {
+            return snapshotMemory;
+        }
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    @Override
+    public void create() throws ResourceAllocationException {
+        VMSnapshot vmsnapshot = _vmSnapshotService.allocVMSnapshot(this);
+        if (vmsnapshot != null) {
+            this.setEntityId(vmsnapshot.getId());
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR,
+                    "Failed to create vm snapshot");
+        }
+    }
+
+    @Override
+    public String getEntityTable() {
+        return "vm_snapshots";
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "creating snapshot for vm: " + getVmId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_SNAPSHOT_CREATE;
+    }
+
+    @Override
+    public void execute() {
+        UserContext.current().setEventDetails("VM Id: " + getVmId());
+        VMSnapshot result = _vmSnapshotService.creatVMSnapshot(this);
+        if (result != null) {
+            VMSnapshotResponse response = _responseGenerator
+                    .createVMSnapshotResponse(result);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(
+                    BaseCmd.INTERNAL_ERROR,
+                    "Failed to create vm snapshot due to an internal error creating snapshot for vm "
+                            + getVmId());
+        }
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        UserVm userVM = _userVmService.getUserVm(vmId);
+
+        return userVM.getAccountId();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/api/commands/DeleteVMSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/DeleteVMSnapshotCmd.java b/api/src/com/cloud/api/commands/DeleteVMSnapshotCmd.java
new file mode 100755
index 0000000..b6a96db
--- /dev/null
+++ b/api/src/com/cloud/api/commands/DeleteVMSnapshotCmd.java
@@ -0,0 +1,119 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.api.commands;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseAsyncCmd;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@Implementation(description = "Deletes a vmsnapshot.", responseObject = SuccessResponse.class)
+public class DeleteVMSnapshotCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger
+            .getLogger(DeleteVMSnapshotCmd.class.getName());
+    private static final String s_name = "deletevmsnapshotresponse";
+
+    @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING)
+    private String accountName;
+
+    @IdentityMapper(entityTableName = "domain")
+    @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG)
+    private Long domainId;
+
+    @IdentityMapper(entityTableName = "vm_snapshots")
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.LONG, required = true)
+    private Long vmSnapShotId;
+
+    private Long vmId;
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Long getVmSnapShotId() {
+        return vmSnapShotId;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "vm_snapshots";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VMSnapshot vmSnapshot = _vmSnapshotService
+                .getVMSnapshotById(getVmSnapShotId());
+        if (vmSnapshot == null) {
+            throw new InvalidParameterValueException(
+                    "Unable to find the snapshot by id=" + getVmSnapShotId());
+        }
+        UserVm userVM = _userVmService.getUserVm(vmSnapshot.getVmId());
+        this.vmId = vmSnapshot.getVmId();
+        return userVM.getAccountId();
+    }
+
+    @Override
+    public void execute() {
+
+        UserContext.current().setEventDetails(
+                "vmsnapshot id: " + getVmSnapShotId());
+        boolean result = _vmSnapshotService.deleteVMSnapshot(this);
+        if (result) {
+            SuccessResponse response = new SuccessResponse(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR,
+                    "Failed to delete vm snapshot");
+        }
+
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Delete VM snapshot: " + getVmSnapShotId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_SNAPSHOT_DELETE;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/api/commands/ListVmSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/ListVmSnapshotCmd.java b/api/src/com/cloud/api/commands/ListVmSnapshotCmd.java
new file mode 100644
index 0000000..e6961ad
--- /dev/null
+++ b/api/src/com/cloud/api/commands/ListVmSnapshotCmd.java
@@ -0,0 +1,131 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.api.commands;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseListProjectAndAccountResourcesCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.response.ListResponse;
+import com.cloud.api.response.VMSnapshotResponse;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@Implementation(description = "List vm snapshot command", responseObject = VMSnapshotResponse.class, since = "5.0.0")
+public class ListVmSnapshotCmd extends BaseListProjectAndAccountResourcesCmd {
+    public static final Logger s_logger = Logger.getLogger(ListHostsCmd.class
+            .getName());
+
+    private static final String s_name = "listvmsnapshotresponse";
+
+    // ///////////////////////////////////////////////////
+    // ////////////// API parameters /////////////////////
+    // ///////////////////////////////////////////////////
+
+    @IdentityMapper(entityTableName = "vm_snapshots")
+    @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "lists snapshot by snapshot ID")
+    private Long id;
+
+    @IdentityMapper(entityTableName = "cluster")
+    @Parameter(name = ApiConstants.CLUSTER_ID, type = CommandType.LONG, description = "lists snapshot by cluster ID")
+    private Long clusterId;
+
+    @IdentityMapper(entityTableName = "domain")
+    @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG, description = "lists snapshot by domain ID")
+    private Long domainId;
+
+    @IdentityMapper(entityTableName = "vm_snapshots")
+    @Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "lists snapshot by state")
+    private String state;
+
+    @IdentityMapper(entityTableName = "user")
+    @Parameter(name = ApiConstants.USER_ID, type = CommandType.LONG, description = "lists snapshot by user ID")
+    private Long userId;
+
+    @IdentityMapper(entityTableName = "vm_instance")
+    @Parameter(name = ApiConstants.VM_ID, type = CommandType.LONG, description = "the ID of the vm")
+    private Long vmId;
+
+    @IdentityMapper(entityTableName = "vm_snapshots")
+    @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists snapshot by snapshot name or display name")
+    private String vmSnapshotName;
+
+    // ///////////////////////////////////////////////////
+    // ///////////////// Accessors ///////////////////////
+    // ///////////////////////////////////////////////////
+
+    public String getState() {
+        return state;
+    }
+
+    public String getVmSnapshotName() {
+        return vmSnapshotName;
+    }
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getClusterId() {
+        return clusterId;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Long userId() {
+        return userId;
+    }
+
+    // ///////////////////////////////////////////////////
+    // ///////////// API Implementation///////////////////
+    // ///////////////////////////////////////////////////
+
+    @Override
+    public void execute() {
+        List<? extends VMSnapshot> result = _vmSnapshotService
+                .listVMSnapshots(this);
+        ListResponse<VMSnapshotResponse> response = new ListResponse<VMSnapshotResponse>();
+        List<VMSnapshotResponse> snapshotResponses = new ArrayList<VMSnapshotResponse>();
+        for (VMSnapshot r : result) {
+            VMSnapshotResponse vmSnapshotResponse = _responseGenerator
+                    .createVMSnapshotResponse(r);
+            vmSnapshotResponse.setObjectName("vmSnapshot");
+            snapshotResponses.add(vmSnapshotResponse);
+        }
+        response.setResponses(snapshotResponses);
+        response.setResponseName(getCommandName());
+        this.setResponseObject(response);
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/api/commands/RevertToSnapshotCmd.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/commands/RevertToSnapshotCmd.java b/api/src/com/cloud/api/commands/RevertToSnapshotCmd.java
new file mode 100755
index 0000000..21ad62d
--- /dev/null
+++ b/api/src/com/cloud/api/commands/RevertToSnapshotCmd.java
@@ -0,0 +1,123 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package com.cloud.api.commands;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.api.BaseAsyncCmd;
+import com.cloud.api.BaseCmd;
+import com.cloud.api.IdentityMapper;
+import com.cloud.api.Implementation;
+import com.cloud.api.Parameter;
+import com.cloud.api.ServerApiException;
+import com.cloud.api.response.SuccessResponse;
+import com.cloud.api.response.UserVmResponse;
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@Implementation(description = "Revert from vmsnapshot.", responseObject = SuccessResponse.class)
+public class RevertToSnapshotCmd extends BaseAsyncCmd {
+    public static final Logger s_logger = Logger
+            .getLogger(RevertToSnapshotCmd.class.getName());
+    private static final String s_name = "reverttosnapshotresponse";
+
+    @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING)
+    private String accountName;
+
+    @IdentityMapper(entityTableName = "domain")
+    @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.LONG)
+    private Long domainId;
+
+    @IdentityMapper(entityTableName = "vm_snapshots")
+    @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.LONG, required = true)
+    private Long vmSnapShotId;
+
+    private Long vmId;
+
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public String getAccountName() {
+        return accountName;
+    }
+
+    public Long getDomainId() {
+        return domainId;
+    }
+
+    public Long getVmSnapShotId() {
+        return vmSnapShotId;
+    }
+
+    @Override
+    public String getCommandName() {
+        return s_name;
+    }
+
+    public static String getResultObjectName() {
+        return "vm_snapshots";
+    }
+
+    @Override
+    public long getEntityOwnerId() {
+        VMSnapshot vmSnapshot = _vmSnapshotService
+                .getVMSnapshotById(getVmSnapShotId());
+        if (vmSnapshot == null) {
+            throw new InvalidParameterValueException(
+                    "Unable to find the snapshot by id=" + getVmSnapShotId());
+        }
+        UserVm userVM = _userVmService.getUserVm(vmSnapshot.getVmId());
+        this.vmId = vmSnapshot.getVmId();
+        return userVM.getAccountId();
+    }
+
+    @Override
+    public void execute() throws  ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
+        UserContext.current().setEventDetails(
+                "vmsnapshot id: " + getVmSnapShotId());
+        UserVm result = _vmSnapshotService.revertToSnapshot(this);
+        if (result != null) {
+            UserVmResponse response = _responseGenerator.createUserVmResponse(
+                    "virtualmachine", result).get(0);
+            response.setResponseName(getCommandName());
+            this.setResponseObject(response);
+        } else {
+            throw new ServerApiException(BaseCmd.INTERNAL_ERROR,
+                    "Failed to revert vm snapshot");
+        }
+    }
+
+    @Override
+    public String getEventDescription() {
+        return "Revert from VM snapshot: " + getVmSnapShotId();
+    }
+
+    @Override
+    public String getEventType() {
+        return EventTypes.EVENT_VM_SNAPSHOT_REVERT;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/api/response/VMSnapshotResponse.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/api/response/VMSnapshotResponse.java b/api/src/com/cloud/api/response/VMSnapshotResponse.java
new file mode 100755
index 0000000..7a3ca18
--- /dev/null
+++ b/api/src/com/cloud/api/response/VMSnapshotResponse.java
@@ -0,0 +1,170 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.api.response;
+
+import java.util.Date;
+
+import com.cloud.api.ApiConstants;
+import com.cloud.serializer.Param;
+import com.cloud.utils.IdentityProxy;
+import com.cloud.vm.snapshot.VMSnapshot;
+import com.google.gson.annotations.SerializedName;
+
+public class VMSnapshotResponse extends BaseResponse {
+
+    @SerializedName(ApiConstants.ID)
+    @Param(description = "the ID of the vm snapshot")
+    private IdentityProxy id = new IdentityProxy("vm_snapshots");
+
+    @SerializedName(ApiConstants.NAME)
+    @Param(description = "the name of the vm snapshot")
+    private String name;
+
+    @SerializedName(ApiConstants.STATE)
+    @Param(description = "the state of the vm snapshot")
+    private VMSnapshot.State state;
+
+    @SerializedName(ApiConstants.DESCRIPTION)
+    @Param(description = "the description of the vm snapshot")
+    private String description;
+
+    @SerializedName(ApiConstants.DISPLAY_NAME)
+    @Param(description = "the display name of the vm snapshot")
+    private String displayName;
+
+    @SerializedName(ApiConstants.ZONE_ID)
+    @Param(description = "the Zone ID of the vm snapshot")
+    private IdentityProxy zoneId = new IdentityProxy("data_center");
+
+    @SerializedName("vmid")
+    @Param(description = "the vm ID of the vm snapshot")
+    private IdentityProxy vmId = new IdentityProxy("vm_instance");
+
+    @SerializedName("parent")
+    @Param(description = "the parent ID of the vm snapshot")
+    private IdentityProxy parent = new IdentityProxy("vm_snapshots"); 
+    
+    @SerializedName("parentName")
+    @Param(description = "the parent displayName of the vm snapshot")
+    private String parentName; 
+    
+    @SerializedName("current")
+    @Param(description = "indiates if this is current snapshot")
+    private Boolean current; 
+    
+    @SerializedName("type")
+    @Param(description = "VM Snapshot type")
+    private String type; 
+    
+    @SerializedName(ApiConstants.CREATED)
+    @Param(description = "the create date of the vm snapshot")
+    private Date created;
+
+    @Override
+    public Long getObjectId() {
+        return getId();
+    }
+
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public Long getId() {
+        return id.getValue();
+    }
+
+    public void setId(Long id) {
+        this.id.setValue(id);
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setState(VMSnapshot.State state) {
+        this.state = state;
+    }
+
+    public VMSnapshot.State getState() {
+        return state;
+    }
+
+    public void setZoneId(Long zoneId) {
+        this.zoneId.setValue(zoneId);
+    }
+
+    public void setVmId(Long vmId) {
+        this.vmId.setValue(vmId);
+    }
+
+    public Boolean getCurrent() {
+        return current;
+    }
+
+    public void setCurrent(Boolean current) {
+        this.current = current;
+    }
+    
+    public Long getParent() {
+        return parent.getValue();
+    }
+
+    public void setParent(Long id) {
+        this.parent.setValue(id);
+    }
+
+    public void setParentName(String parentName) {
+        this.parentName = parentName;
+    }
+
+    public String getParentName() {
+        return parentName;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public void setType(String type) {
+        this.type = type;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/event/EventTypes.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index e84a403..41ae97e 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -290,5 +290,10 @@ public class EventTypes {
     // tag related events
     public static final String EVENT_TAGS_CREATE = "CREATE_TAGS";
     public static final String EVENT_TAGS_DELETE = "DELETE_TAGS";
+    
+	// vm snapshot events
+    public static final String EVENT_VM_SNAPSHOT_CREATE = "VMSNAPSHOT.CREATE";
+    public static final String EVENT_VM_SNAPSHOT_DELETE = "VMSNAPSHOT.DELETE";
+    public static final String EVENT_VM_SNAPSHOT_REVERT = "VMSNAPSHOT.REVERT";
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/server/ResourceTag.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java
old mode 100644
new mode 100755
index 117e721..137cc0d
--- a/api/src/com/cloud/server/ResourceTag.java
+++ b/api/src/com/cloud/server/ResourceTag.java
@@ -35,7 +35,8 @@ public interface ResourceTag extends ControlledEntity{
         Project,
         Vpc,
         NetworkACL,
-        StaticRoute
+        StaticRoute,
+        VMSnapshot
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index 1fa16c3..c9722b5 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -41,7 +41,11 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
         Migrating(true, "VM is being migrated.  host id holds to from host"),
         Error(false, "VM is in error"),
         Unknown(false, "VM state is unknown."),
-        Shutdowned(false, "VM is shutdowned from inside");
+        Shutdowned(false, "VM is shutdowned from inside"),
+        RunningSnapshotting(true, "VM is taking a snapshot in running state"),
+        StoppedSnapshotting(true, "VM is taking a snapshot in stopped state"),
+        RevertingToRunning(true, "VM is reverting to snapshot"),
+        RevertingToStopped(true, "VM is reverting to snapshot");
 
         private final boolean _transitional;
         String _description;
@@ -109,8 +113,24 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
             s_fsm.addTransition(State.Expunging, VirtualMachine.Event.ExpungeOperation, State.Expunging);
             s_fsm.addTransition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging);
             s_fsm.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging);
+            
+            s_fsm.addTransition(State.Running, VirtualMachine.Event.SnapshotRequested, State.RunningSnapshotting);
+            s_fsm.addTransition(State.Stopped, VirtualMachine.Event.SnapshotRequested, State.StoppedSnapshotting);
+            s_fsm.addTransition(State.RunningSnapshotting, VirtualMachine.Event.OperationSucceeded, State.Running);
+            s_fsm.addTransition(State.StoppedSnapshotting, VirtualMachine.Event.OperationSucceeded, State.Stopped);
+            s_fsm.addTransition(State.RunningSnapshotting, VirtualMachine.Event.OperationFailed, State.Running);
+            s_fsm.addTransition(State.StoppedSnapshotting, VirtualMachine.Event.OperationFailed, State.Stopped);
+            
+            s_fsm.addTransition(State.Running, VirtualMachine.Event.RevertRequested, State.RevertingToRunning);
+            s_fsm.addTransition(State.Stopped, VirtualMachine.Event.RevertRequested, State.RevertingToStopped);
+            s_fsm.addTransition(State.RevertingToRunning, VirtualMachine.Event.OperationFailed, State.Running);
+            s_fsm.addTransition(State.RevertingToStopped, VirtualMachine.Event.OperationFailed, State.Stopped);
+            s_fsm.addTransition(State.RevertingToRunning, VirtualMachine.Event.OperationSucceeded, State.Running);
+            s_fsm.addTransition(State.RevertingToStopped, VirtualMachine.Event.OperationSucceeded, State.Stopped);
+
+            
         }
-
+        
         public static boolean isVmStarted(State oldState, Event e, State newState) {
             if (oldState == State.Starting && newState == State.Running) {
                 return true;
@@ -172,7 +192,9 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
         OperationFailedToError,
         OperationRetry,
         AgentReportShutdowned,
-        AgentReportMigrated
+        AgentReportMigrated,
+        RevertRequested,
+        SnapshotRequested
     };
 
     public enum Type {

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/vm/snapshot/VMSnapshot.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshot.java b/api/src/com/cloud/vm/snapshot/VMSnapshot.java
new file mode 100755
index 0000000..709ceb1
--- /dev/null
+++ b/api/src/com/cloud/vm/snapshot/VMSnapshot.java
@@ -0,0 +1,104 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.vm.snapshot;
+
+import java.util.Date;
+
+import com.cloud.acl.ControlledEntity;
+import com.cloud.utils.fsm.StateMachine2;
+import com.cloud.utils.fsm.StateObject;
+
+public interface VMSnapshot extends ControlledEntity, StateObject<VMSnapshot.State> {
+
+    enum State {
+        Allocated("The VM snapshot is allocated but has not been created yet."),
+        Creating("The VM snapshot is being created."),
+        Ready("The VM snapshot is ready to be used."),
+        Reverting("The VM snapshot is being used to revert"),
+        Expunging("The volume is being expunging"),
+        Removed("The volume is destroyed, and can't be recovered."),        
+        Error ("The volume is in error state, and can't be recovered");            
+
+        String _description;
+
+        private State(String description) {
+            _description = description;
+        }
+
+        public static StateMachine2<State, Event, VMSnapshot> getStateMachine() {
+            return s_fsm;
+        }
+
+        public String getDescription() {
+            return _description;
+        }
+
+        private final static StateMachine2<State, Event, VMSnapshot> s_fsm = new StateMachine2<State, Event, VMSnapshot>();
+        static {
+            s_fsm.addTransition(Allocated, Event.CreateRequested, Creating);
+            s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
+            s_fsm.addTransition(Creating, Event.OperationFailed, Error);
+            s_fsm.addTransition(Ready, Event.RevertRequested, Reverting);            
+            s_fsm.addTransition(Reverting, Event.OperationSucceeded, Ready);
+            s_fsm.addTransition(Reverting, Event.OperationFailed, Ready);
+            s_fsm.addTransition(Ready, Event.ExpungeRequested, Expunging);
+            s_fsm.addTransition(Error, Event.ExpungeRequested, Expunging);  
+            s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed);  
+        }
+    }
+    
+    enum Type{
+        Disk, DiskAndMemory
+    }
+    
+    enum Event {
+        CreateRequested,
+        OperationFailed,
+        OperationSucceeded,
+        RevertRequested,
+        ExpungeRequested,
+    }
+    
+    long getId();
+
+    public String getName();
+
+    public Long getVmId();
+
+    public State getState();
+
+    public Date getCreated();
+
+    public String getDescription();
+
+    public String getDisplayName();
+
+    public Long getParent();
+    
+    public Boolean getCurrent();
+    
+    public Type getType();
+    
+    public long getUpdatedCount();
+
+    public void incrUpdatedCount();
+
+    public Date getUpdated();
+    
+    public Date getRemoved();
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshotService.java b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
new file mode 100755
index 0000000..281ed1e
--- /dev/null
+++ b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
@@ -0,0 +1,50 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.vm.snapshot;
+
+import java.util.List;
+
+import com.cloud.api.commands.CreateVMSnapshotCmd;
+import com.cloud.api.commands.DeleteVMSnapshotCmd;
+import com.cloud.api.commands.ListVmSnapshotCmd;
+import com.cloud.api.commands.RevertToSnapshotCmd;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+public interface VMSnapshotService {
+
+    List<? extends VMSnapshot> listVMSnapshots(ListVmSnapshotCmd cmd);
+
+    VMSnapshot getVMSnapshotById(long id);
+
+    VMSnapshot creatVMSnapshot(CreateVMSnapshotCmd cmd);
+
+    VMSnapshot allocVMSnapshot(CreateVMSnapshotCmd cmd)
+            throws ResourceAllocationException;
+
+    boolean deleteVMSnapshot(DeleteVMSnapshotCmd cmd);
+
+    UserVm revertToSnapshot(RevertToSnapshotCmd cmd) throws InsufficientServerCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException;
+
+    VirtualMachine getVMBySnapshotId(Long id);
+}

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/client/WEB-INF/classes/resources/messages.properties
----------------------------------------------------------------------
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
old mode 100644
new mode 100755
index b40fce4..2626aa0
--- a/client/WEB-INF/classes/resources/messages.properties
+++ b/client/WEB-INF/classes/resources/messages.properties
@@ -1386,6 +1386,20 @@ label.zone.step.4.title=Step 4: <strong>Add an IP range</strong>
 label.zone.wide=Zone-Wide
 label.zone=Zone
 
+#VM snapshot label
+label.vmsnapshot=VM Snapshots
+label.vmsnapshot.type=Type
+label.vmsnapshot.parentname=Parent
+label.vmsnapshot.current=isCurrent
+label.vmsnapshot.memory=Snapshot memory
+message.action.vmsnapshot.delete=Please confirm that you want to delete this VM snapshot.
+label.action.vmsnapshot.delete=Delete VM snapshot
+label.action.vmsnapshot.revert=Revert to VM snapshot
+message.action.vmsnapshot.revert=Revert VM snapshot
+label.action.vmsnapshot.create=Take VM Snapshot
+
+
+
 #Messages
 message.acquire.public.ip=Please select a zone from which you want to acquire your new IP from.
 message.action.cancel.maintenance.mode=Please confirm that you want to cancel this maintenance.

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/client/tomcatconf/commands.properties.in
----------------------------------------------------------------------
diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in
index e233694..b61e5a3 100755
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -401,3 +401,9 @@ resetVpnConnection=com.cloud.api.commands.ResetVpnConnectionCmd;15
 listVpnCustomerGateways=com.cloud.api.commands.ListVpnCustomerGatewaysCmd;15
 listVpnGateways=com.cloud.api.commands.ListVpnGatewaysCmd;15
 listVpnConnections=com.cloud.api.commands.ListVpnConnectionsCmd;15
+
+### VM Snapshot commands
+listVMSnapshot=com.cloud.api.commands.ListVmSnapshotCmd;15
+createVMSnapshot=com.cloud.api.commands.CreateVMSnapshotCmd;15
+deleteVMSnapshot=com.cloud.api.commands.DeleteVMSnapshotCmd;15
+revertToSnapshot=com.cloud.api.commands.RevertToSnapshotCmd;15
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/600fb904/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java b/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java
new file mode 100755
index 0000000..3f8e66c
--- /dev/null
+++ b/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java
@@ -0,0 +1,225 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.vm.snapshot;
+
+import java.util.Date;
+import java.util.UUID;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import javax.persistence.TableGenerator;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.cloud.api.Identity;
+import com.cloud.utils.db.GenericDao;
+
+@Entity
+@Table(name = "vm_snapshots")
+public class VMSnapshotVO implements VMSnapshot, Identity {
+    @Id
+    @TableGenerator(name = "vm_snapshots_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "vm_snapshots_seq", allocationSize = 1)
+    @GeneratedValue(strategy = GenerationType.TABLE)
+    @Column(name = "id")
+    long id;
+
+    @Column(name = "uuid")
+    String uuid = UUID.randomUUID().toString();
+
+    @Column(name = "name")
+    String name;
+
+    @Column(name = "display_name")
+    String displayName;
+
+    @Column(name = "description")
+    String description;
+
+    @Column(name = "vm_id")
+    long vmId;
+
+    @Column(name = "account_id")
+    long accountId;
+
+    @Column(name = "domain_id")
+    long domainId;
+
+    @Column(name = "vm_snapshot_type")
+    @Enumerated(EnumType.STRING)
+    VMSnapshot.Type type;
+
+    @Column(name = "state", updatable = true, nullable = false)
+    @Enumerated(value = EnumType.STRING)
+    private State state;
+
+    @Column(name = GenericDao.CREATED_COLUMN)
+    Date created;
+
+    @Column(name = GenericDao.REMOVED_COLUMN)
+    Date removed;
+
+    @Column(name = "current")
+    Boolean current;
+    
+    @Column(name = "parent")
+    Long parent;
+    
+    @Column(name = "updated")
+    @Temporal(value = TemporalType.TIMESTAMP)
+    Date updated;
+    
+    @Column(name="update_count", updatable = true, nullable=false)
+    protected long updatedCount;
+    
+    public Long getParent() {
+		return parent;
+	}
+
+	public void setParent(Long parent) {
+		this.parent = parent;
+	}
+
+	public VMSnapshotVO() {
+
+    }
+
+    public Date getRemoved() {
+        return removed;
+    }
+
+    public VMSnapshotVO(Long accountId, Long domainId, Long vmId,
+            String description, String vmSnapshotName, String vsDisplayName,
+            Long serviceOfferingId, Type type, Boolean current) {
+        this.accountId = accountId;
+        this.domainId = domainId;
+        this.vmId = vmId;
+        this.state = State.Allocated;
+        this.description = description;
+        this.name = vmSnapshotName;
+        this.displayName = vsDisplayName;
+        this.type = type;
+        this.current = current;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    @Override
+    public Date getCreated() {
+        return created;
+    }
+
+    public void setCreated(Date created) {
+        this.created = created;
+    }
+
+    @Override
+    public long getId() {
+        return id;
+    }
+
+    @Override
+    public Long getVmId() {
+        return vmId;
+    }
+
+    public void setVmId(Long vmId) {
+        this.vmId = vmId;
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public State getState() {
+        return state;
+    }
+
+    public void setState(State state) {
+        this.state = state;
+    }
+
+    @Override
+    public String getUuid() {
+        return uuid;
+    }
+
+    @Override
+    public long getAccountId() {
+        return accountId;
+    }
+
+    @Override
+    public long getDomainId() {
+        return domainId;
+    }
+
+    @Override
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+
+	public Boolean getCurrent() {
+		return current;
+	}
+
+	public void setCurrent(Boolean current) {
+		this.current = current;
+	}
+
+    @Override
+    public long getUpdatedCount() {
+        return updatedCount;
+    }
+
+    @Override
+    public void incrUpdatedCount() {
+        this.updatedCount++;
+    }
+
+    @Override
+    public Date getUpdated() {
+        return updated;
+    }
+
+    @Override
+    public Type getType() {
+        return type;
+    }
+    
+    public void setRemoved(Date removed) {
+        this.removed = removed;
+    }
+}