You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ko...@apache.org on 2013/04/08 15:13:57 UTC

[47/55] [abbrv] git commit: updated refs/heads/cisco-vnmc-api-integration to f38be48

1) fix CLOUDSTACK-1946 2) remove redundant VMSnapshotVO.java


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

Branch: refs/heads/cisco-vnmc-api-integration
Commit: a85b498afd224fbc34e52b032ee4ba05f141f2a0
Parents: b1ef747
Author: Mice Xia <mi...@tcloudcomputing.com>
Authored: Sun Apr 7 17:41:26 2013 +0800
Committer: Mice Xia <mi...@tcloudcomputing.com>
Committed: Sun Apr 7 17:41:26 2013 +0800

----------------------------------------------------------------------
 server/src/com/cloud/vm/UserVmManagerImpl.java     |   22 +--
 server/src/com/cloud/vm/snapshot/VMSnapshotVO.java |  224 ---------------
 2 files changed, 4 insertions(+), 242 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a85b498a/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 24bce8b..646cf92 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -222,7 +222,9 @@ import com.cloud.vm.dao.UserVmCloneSettingDao;
 import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.UserVmDetailsDao;
 import com.cloud.vm.dao.VMInstanceDao;
+import com.cloud.vm.snapshot.VMSnapshot;
 import com.cloud.vm.snapshot.VMSnapshotManager;
+import com.cloud.vm.snapshot.VMSnapshotVO;
 import com.cloud.vm.snapshot.dao.VMSnapshotDao;
 
 @Local(value = { UserVmManager.class, UserVmService.class })
@@ -699,22 +701,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
         }
     }
 
-
-
-
-    private void checkVMSnapshots(UserVmVO vm, Long volumeId, boolean attach) {
-        // Check that if vm has any VM snapshot
-        /*Long vmId = vm.getId();
-        List<VMSnapshotVO> listSnapshot = _vmSnapshotDao.listByInstanceId(vmId,
-                VMSnapshot.State.Ready, VMSnapshot.State.Creating, VMSnapshot.State.Reverting, VMSnapshot.State.Expunging);
-        if (listSnapshot != null && listSnapshot.size() != 0) {
-            throw new InvalidParameterValueException(
-                        "The VM has VM snapshots, do not allowed to attach volume. Please delete the VM snapshots first.");
-        }*/
-    }
-
-
-
     private UserVm rebootVirtualMachine(long userId, long vmId)
             throws InsufficientCapacityException, ResourceUnavailableException {
         UserVmVO vm = _vmDao.findById(vmId);
@@ -777,7 +763,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
         _itMgr.checkIfCanUpgrade(vmInstance, svcOffId);
 
         // remove diskAndMemory VM snapshots
-        /* List<VMSnapshotVO> vmSnapshots = _vmSnapshotDao.findByVm(vmId);
+        List<VMSnapshotVO> vmSnapshots = _vmSnapshotDao.findByVm(vmId);
         for (VMSnapshotVO vmSnapshotVO : vmSnapshots) {
             if(vmSnapshotVO.getType() == VMSnapshot.Type.DiskAndMemory){
                 if(!_vmSnapshotMgr.deleteAllVMSnapshots(vmId, VMSnapshot.Type.DiskAndMemory)){
@@ -787,7 +773,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
                 }
 
             }
-        }*/
+        }
 
         _itMgr.upgradeVmDb(vmId, svcOffId);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a85b498a/server/src/com/cloud/vm/snapshot/VMSnapshotVO.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotVO.java b/server/src/com/cloud/vm/snapshot/VMSnapshotVO.java
deleted file mode 100644
index 03d4945..0000000
--- a/server/src/com/cloud/vm/snapshot/VMSnapshotVO.java
+++ /dev/null
@@ -1,224 +0,0 @@
-// 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.utils.db.GenericDao;
-
-@Entity
-@Table(name = "vm_snapshots")
-public class VMSnapshotVO implements VMSnapshot {
-    @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;
-    }
-}