You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2013/07/16 22:42:12 UTC
[2/4] git commit: updated refs/heads/4.2 to f53a063
CLOUDSTACK-2155 Anti-Affinity -When Vm deployment is done in parallel , anti-affinity rule is not honored.
Changes to check if the destination found does not conflict with any vm reservation
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/9cb91ba5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/9cb91ba5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/9cb91ba5
Branch: refs/heads/4.2
Commit: 9cb91ba58c4440a0ce56321662cfe3778f1cbe95
Parents: f37877d
Author: Prachi Damle <pr...@cloud.com>
Authored: Fri Jul 12 13:39:24 2013 -0700
Committer: Prachi Damle <pr...@cloud.com>
Committed: Tue Jul 16 13:41:12 2013 -0700
----------------------------------------------------------------------
.../affinity/AffinityGroupProcessor.java | 13 +
.../affinity/AffinityProcessorBase.java | 7 +
.../cloud/entity/api/VMEntityManagerImpl.java | 66 ++-
.../cloud/entity/api/db/VMComputeTagVO.java | 67 ---
.../engine/cloud/entity/api/db/VMEntityVO.java | 577 -------------------
.../cloud/entity/api/db/VMNetworkMapVO.java | 71 ---
.../cloud/entity/api/db/VMReservationVO.java | 127 ----
.../cloud/entity/api/db/VMRootDiskTagVO.java | 67 ---
.../entity/api/db/VolumeReservationVO.java | 84 ---
.../entity/api/db/dao/VMComputeTagDao.java | 31 -
.../entity/api/db/dao/VMComputeTagDaoImpl.java | 89 ---
.../cloud/entity/api/db/dao/VMEntityDao.java | 41 --
.../entity/api/db/dao/VMEntityDaoImpl.java | 169 ------
.../entity/api/db/dao/VMNetworkMapDao.java | 31 -
.../entity/api/db/dao/VMNetworkMapDaoImpl.java | 85 ---
.../entity/api/db/dao/VMReservationDao.java | 34 --
.../entity/api/db/dao/VMReservationDaoImpl.java | 111 ----
.../entity/api/db/dao/VMRootDiskTagDao.java | 31 -
.../entity/api/db/dao/VMRootDiskTagDaoImpl.java | 88 ---
.../entity/api/db/dao/VolumeReservationDao.java | 31 -
.../api/db/dao/VolumeReservationDaoImpl.java | 68 ---
.../cloud/entity/api/db/VMComputeTagVO.java | 67 +++
.../engine/cloud/entity/api/db/VMEntityVO.java | 577 +++++++++++++++++++
.../cloud/entity/api/db/VMNetworkMapVO.java | 71 +++
.../cloud/entity/api/db/VMReservationVO.java | 127 ++++
.../cloud/entity/api/db/VMRootDiskTagVO.java | 67 +++
.../entity/api/db/VolumeReservationVO.java | 84 +++
.../entity/api/db/dao/VMComputeTagDao.java | 31 +
.../entity/api/db/dao/VMComputeTagDaoImpl.java | 89 +++
.../cloud/entity/api/db/dao/VMEntityDao.java | 41 ++
.../entity/api/db/dao/VMEntityDaoImpl.java | 169 ++++++
.../entity/api/db/dao/VMNetworkMapDao.java | 31 +
.../entity/api/db/dao/VMNetworkMapDaoImpl.java | 85 +++
.../entity/api/db/dao/VMReservationDao.java | 34 ++
.../entity/api/db/dao/VMReservationDaoImpl.java | 111 ++++
.../entity/api/db/dao/VMRootDiskTagDao.java | 31 +
.../entity/api/db/dao/VMRootDiskTagDaoImpl.java | 88 +++
.../entity/api/db/dao/VolumeReservationDao.java | 31 +
.../api/db/dao/VolumeReservationDaoImpl.java | 68 +++
.../affinity/HostAntiAffinityProcessor.java | 51 ++
.../cloud/deploy/DeploymentPlanningManager.java | 4 +
.../deploy/DeploymentPlanningManagerImpl.java | 22 +
42 files changed, 1937 insertions(+), 1830 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java b/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
index 60b8e4c..e3a9b62 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityGroupProcessor.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.affinity;
+import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AffinityConflictException;
@@ -46,4 +47,16 @@ public interface AffinityGroupProcessor extends Adapter {
* @return String Affinity/Anti-affinity type
*/
String getType();
+
+ /**
+ * check() is called to see if the planned destination fits the group
+ * requirements
+ *
+ * @param vm
+ * virtual machine.
+ * @param plannedDestination
+ * deployment destination where VM is planned to be deployed
+ */
+ boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination plannedDestination)
+ throws AffinityConflictException;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java b/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
index 70ecd08..325ab80 100644
--- a/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
+++ b/api/src/org/apache/cloudstack/affinity/AffinityProcessorBase.java
@@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.affinity;
+import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AffinityConflictException;
@@ -41,4 +42,10 @@ public class AffinityProcessorBase extends AdapterBase implements AffinityGroupP
public void setType(String type) {
_type = type;
}
+
+ @Override
+ public boolean check(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination plannedDestination)
+ throws AffinityConflictException {
+ return true;
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
index 38ed7e6..00aeb71 100755
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java
@@ -16,7 +16,6 @@
// under the License.
package org.apache.cloudstack.engine.cloud.entity.api;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -181,38 +180,49 @@ public class VMEntityManagerImpl implements VMEntityManager {
}
- DeployDestination dest;
- try {
- dest = _dpMgr.planDeployment(vmProfile, plan, exclude);
- } catch (AffinityConflictException e) {
- throw new CloudRuntimeException("Unable to create deployment, affinity rules associted to the VM conflict");
- }
+ while (true) {
+ DeployDestination dest = null;
+ try {
+ dest = _dpMgr.planDeployment(vmProfile, plan, exclude);
+ } catch (AffinityConflictException e) {
+ throw new CloudRuntimeException(
+ "Unable to create deployment, affinity rules associted to the VM conflict");
+ }
+
+ if (dest != null) {
+ if (_dpMgr.finalizeReservation(dest, vmProfile, plan, exclude)) {
+ // save destination with VMEntityVO
+ VMReservationVO vmReservation = new VMReservationVO(vm.getId(), dest.getDataCenter().getId(), dest
+ .getPod().getId(), dest.getCluster().getId(), dest.getHost().getId());
+ Map<Long, Long> volumeReservationMap = new HashMap<Long, Long>();
+
+ if (vm.getHypervisorType() != HypervisorType.BareMetal) {
+ for (Volume vo : dest.getStorageForDisks().keySet()) {
+ volumeReservationMap.put(vo.getId(), dest.getStorageForDisks().get(vo).getId());
+ }
+ vmReservation.setVolumeReservation(volumeReservationMap);
+ }
- if (dest != null) {
- //save destination with VMEntityVO
- VMReservationVO vmReservation = new VMReservationVO(vm.getId(), dest.getDataCenter().getId(), dest.getPod().getId(), dest.getCluster().getId(), dest.getHost().getId());
- Map<Long,Long> volumeReservationMap = new HashMap<Long,Long>();
+ vmEntityVO.setVmReservation(vmReservation);
+ _vmEntityDao.persist(vmEntityVO);
- if (vm.getHypervisorType() != HypervisorType.BareMetal) {
- for(Volume vo : dest.getStorageForDisks().keySet()){
- volumeReservationMap.put(vo.getId(), dest.getStorageForDisks().get(vo).getId());
+ return vmReservation.getUuid();
+ } else {
+ try {
+ Thread.sleep(10000);
+ } catch (final InterruptedException e) {
+ }
+ continue;
}
- vmReservation.setVolumeReservation(volumeReservationMap);
+ } else if (planChangedByReadyVolume) {
+ // we could not reserve in the Volume's cluster - let the deploy
+ // call retry it.
+ return UUID.randomUUID().toString();
+ } else {
+ throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile,
+ DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile));
}
-
- vmEntityVO.setVmReservation(vmReservation);
- _vmEntityDao.persist(vmEntityVO);
-
- return vmReservation.getUuid();
- } else if (planChangedByReadyVolume) {
- // we could not reserve in the Volume's cluster - let the deploy
- // call retry it.
- return UUID.randomUUID().toString();
- }else{
- throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile,
- DataCenter.class, plan.getDataCenterId(), areAffinityGroupsAssociated(vmProfile));
}
-
}
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java
deleted file mode 100644
index e4fc228..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java
+++ /dev/null
@@ -1,67 +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 org.apache.cloudstack.engine.cloud.entity.api.db;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = "vm_compute_tags")
-public class VMComputeTagVO implements InternalIdentity{
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name = "vm_id")
- private long vmId;
-
- @Column(name = "compute_tag")
- private String computeTag;
-
- /**
- * There should never be a public constructor for this class. Since it's
- * only here to define the table for the DAO class.
- */
- protected VMComputeTagVO() {
- }
-
- public VMComputeTagVO(long vmId, String tag) {
- this.vmId = vmId;
- this.computeTag = tag;
- }
-
- public long getId() {
- return id;
- }
-
- public long getVmId() {
- return vmId;
- }
-
- public String getComputeTag() {
- return computeTag;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
deleted file mode 100644
index 4748215..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java
+++ /dev/null
@@ -1,577 +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 org.apache.cloudstack.engine.cloud.entity.api.db;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-import java.util.Random;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.DiscriminatorColumn;
-import javax.persistence.DiscriminatorType;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Inheritance;
-import javax.persistence.InheritanceType;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.utils.db.Encrypt;
-import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.db.StateMachine;
-import com.cloud.utils.fsm.FiniteStateObject;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachine.State;
-
-@Entity
-@Table(name="vm_instance")
-@Inheritance(strategy=InheritanceType.JOINED)
-@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
-public class VMEntityVO implements VirtualMachine, FiniteStateObject<State, VirtualMachine.Event> {
- @Id
- @TableGenerator(name="vm_instance_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_instance_seq", allocationSize=1)
- @Column(name="id", updatable=false, nullable = false)
- protected long id;
-
- @Column(name="name", updatable=false, nullable=false, length=255)
- protected String hostName = null;
-
- @Encrypt
- @Column(name="vnc_password", updatable=true, nullable=false, length=255)
- protected String vncPassword;
-
- @Column(name="proxy_id", updatable=true, nullable=true)
- protected Long proxyId;
-
- @Temporal(TemporalType.TIMESTAMP)
- @Column(name="proxy_assign_time", updatable=true, nullable=true)
- protected Date proxyAssignTime;
-
- /**
- * Note that state is intentionally missing the setter. Any updates to
- * the state machine needs to go through the DAO object because someone
- * else could be updating it as well.
- */
- @Enumerated(value=EnumType.STRING)
- @StateMachine(state=State.class, event=Event.class)
- @Column(name="state", updatable=true, nullable=false, length=32)
- protected State state = null;
-
- @Column(name="private_ip_address", updatable=true)
- protected String privateIpAddress;
-
- @Column(name="instance_name", updatable=true, nullable=false)
- protected String instanceName;
-
- @Column(name="vm_template_id", updatable=true, nullable=true, length=17)
- protected Long templateId = new Long(-1);
-
- @Column(name="guest_os_id", nullable=false, length=17)
- protected long guestOSId;
-
- @Column(name="host_id", updatable=true, nullable=true)
- protected Long hostId;
-
- @Column(name="last_host_id", updatable=true, nullable=true)
- protected Long lastHostId;
-
- @Column(name="pod_id", updatable=true, nullable=false)
- protected Long podIdToDeployIn;
-
- @Column(name="private_mac_address", updatable=true, nullable=true)
- protected String privateMacAddress;
-
- @Column(name="data_center_id", updatable=true, nullable=false)
- protected long dataCenterIdToDeployIn;
-
- @Column(name="vm_type", updatable=false, nullable=false, length=32)
- @Enumerated(value=EnumType.STRING)
- protected Type type;
-
- @Column(name="ha_enabled", updatable=true, nullable=true)
- protected boolean haEnabled;
-
- @Column(name="limit_cpu_use", updatable=true, nullable=true)
- private boolean limitCpuUse;
-
- @Column(name="update_count", updatable = true, nullable=false)
- protected long updated; // This field should be updated everytime the state is updated. There's no set method in the vo object because it is done with in the dao code.
-
- @Column(name=GenericDao.CREATED_COLUMN)
- protected Date created;
-
- @Column(name=GenericDao.REMOVED_COLUMN)
- protected Date removed;
-
- @Column(name="update_time", updatable=true)
- @Temporal(value=TemporalType.TIMESTAMP)
- protected Date updateTime;
-
- @Column(name="domain_id")
- protected long domainId;
-
- @Column(name="account_id")
- protected long accountId;
-
- @Column(name="service_offering_id")
- protected long serviceOfferingId;
-
- @Column(name="reservation_id")
- protected String reservationId;
-
- @Column(name="hypervisor_type")
- @Enumerated(value=EnumType.STRING)
- protected HypervisorType hypervisorType;
-
- @Column(name="ram")
- protected long ram;
-
- @Column(name="cpu")
- protected int cpu;
-
- @Transient
- Map<String, String> details;
-
- @Column(name="uuid")
- protected String uuid = UUID.randomUUID().toString();
-
- //orchestration columns
- @Column(name="owner")
- private String owner = null;
-
- @Column(name="speed")
- private int speed;
-
- @Transient
- List<String> computeTags;
-
- @Transient
- List<String> rootDiskTags;
-
- @Column(name="host_name")
- private String hostname = null;
-
- @Column(name="display_name")
- private String displayname = null;
-
- @Transient
- List<String> networkIds;
-
- @Column(name="disk_offering_id")
- protected Long diskOfferingId;
-
- @Transient
- private VMReservationVO vmReservation;
-
-
- public VMEntityVO(long id,
- long serviceOfferingId,
- String name,
- String instanceName,
- Type type,
- Long vmTemplateId,
- HypervisorType hypervisorType,
- long guestOSId,
- long domainId,
- long accountId,
- boolean haEnabled, Long diskOfferingId) {
- this.id = id;
- this.hostName = name != null ? name : this.uuid;
- if (vmTemplateId != null) {
- this.templateId = vmTemplateId;
- }
- this.instanceName = instanceName;
- this.type = type;
- this.guestOSId = guestOSId;
- this.haEnabled = haEnabled;
- this.vncPassword = Long.toHexString(new Random().nextLong());
- this.state = State.Stopped;
- this.accountId = accountId;
- this.domainId = domainId;
- this.serviceOfferingId = serviceOfferingId;
- this.hypervisorType = hypervisorType;
- this.limitCpuUse = false;
- this.diskOfferingId = diskOfferingId;
- }
-
- public VMEntityVO(long id,
- long serviceOfferingId,
- String name,
- String instanceName,
- Type type,
- Long vmTemplateId,
- HypervisorType hypervisorType,
- long guestOSId,
- long domainId,
- long accountId,
- boolean haEnabled,
- boolean limitResourceUse) {
- this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled, null);
- this.limitCpuUse = limitResourceUse;
- }
-
-
-
- protected VMEntityVO() {
- }
-
- public Date getRemoved() {
- return removed;
- }
-
- @Override
- public long getDomainId() {
- return domainId;
- }
-
- @Override
- public long getAccountId() {
- return accountId;
- }
-
- @Override
- public Type getType() {
- return type;
- }
-
- public long getUpdated() {
- return updated;
- }
-
- @Override
- public long getId() {
- return id;
- }
-
- @Override
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- @Override
- public HypervisorType getHypervisorType() {
- return hypervisorType;
- }
-
- @Override
- public Date getCreated() {
- return created;
- }
-
- public Date getUpdateTime() {
- return updateTime;
- }
-
- @Override
- public long getDataCenterId() {
- return dataCenterIdToDeployIn;
- }
-
- @Override
- public String getHostName() {
- return hostName;
- }
-
- @Override
- public String getInstanceName() {
- return instanceName;
- }
-
- @Override
- public State getState() {
- return state;
- }
-
- // don't use this directly, use VM state machine instead, this method is added for migration tool only
- @Override
- public void setState(State state) {
- this.state = state;
- }
-
- @Override
- public String getPrivateIpAddress() {
- return privateIpAddress;
- }
-
- public void setPrivateIpAddress(String address) {
- privateIpAddress = address;
- }
-
- public void setVncPassword(String vncPassword) {
- this.vncPassword = vncPassword;
- }
-
- @Override
- public String getVncPassword() {
- return vncPassword;
- }
-
- @Override
- public long getServiceOfferingId() {
- return serviceOfferingId;
- }
-
- public Long getProxyId() {
- return proxyId;
- }
-
- public void setProxyId(Long proxyId) {
- this.proxyId = proxyId;
- }
-
- public Date getProxyAssignTime() {
- return this.proxyAssignTime;
- }
-
- public void setProxyAssignTime(Date time) {
- this.proxyAssignTime = time;
- }
-
- @Override
- public long getTemplateId() {
- if (templateId == null) {
- return -1;
- } else {
- return templateId;
- }
- }
-
- public void setTemplateId(Long templateId) {
- this.templateId = templateId;
- }
-
- @Override
- public long getGuestOSId() {
- return guestOSId;
- }
-
- public void setGuestOSId(long guestOSId) {
- this.guestOSId = guestOSId;
- }
-
- public void incrUpdated() {
- updated++;
- }
-
- public void decrUpdated() {
- updated--;
- }
-
- @Override
- public Long getHostId() {
- return hostId;
- }
-
- @Override
- public Long getLastHostId() {
- return lastHostId;
- }
-
- public void setLastHostId(Long lastHostId) {
- this.lastHostId = lastHostId;
- }
-
- public void setHostId(Long hostId) {
- this.hostId = hostId;
- }
-
- @Override
- public boolean isHaEnabled() {
- return haEnabled;
- }
-
- @Override
- public boolean limitCpuUse() {
- return limitCpuUse;
- }
-
- public void setLimitCpuUse(boolean value) {
- limitCpuUse = value;
- }
-
- @Override
- public String getPrivateMacAddress() {
- return privateMacAddress;
- }
-
- @Override
- public Long getPodIdToDeployIn() {
- return podIdToDeployIn;
- }
-
- public void setPodId(long podId) {
- this.podIdToDeployIn = podId;
- }
-
- public void setPrivateMacAddress(String privateMacAddress) {
- this.privateMacAddress = privateMacAddress;
- }
-
- public void setDataCenterId(long dataCenterId) {
- this.dataCenterIdToDeployIn = dataCenterId;
- }
-
- public boolean isRemoved() {
- return removed != null;
- }
-
- public void setHaEnabled(boolean value) {
- haEnabled = value;
- }
-
- public void setReservationId(String reservationId) {
- this.reservationId = reservationId;
- }
-
- public String getReservationId() {
- return this.reservationId;
- }
-
- @Override
- public Map<String, String> getDetails() {
- return details;
- }
-
- public void setDetail(String name, String value) {
- assert (details != null) : "Did you forget to load the details?";
-
- details.put(name, value);
- }
-
- public void setDetails(Map<String, String> details) {
- this.details = details;
- }
-
- transient String toString;
- @Override
- public String toString() {
- if (toString == null) {
- toString = new StringBuilder("VM[").append(type.toString()).append("|").append(hostName).append("]").toString();
- }
- return toString;
- }
-
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + (int) (id ^ (id >>> 32));
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- VMEntityVO other = (VMEntityVO) obj;
- if (id != other.id)
- return false;
- return true;
- }
-
-
- public void setServiceOfferingId(long serviceOfferingId) {
- this.serviceOfferingId = serviceOfferingId;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- public int getSpeed() {
- return speed;
- }
-
- public void setSpeed(int speed) {
- this.speed = speed;
- }
-
- public List<String> getComputeTags() {
- return computeTags;
- }
-
- public void setComputeTags(List<String> computeTags) {
- this.computeTags = computeTags;
- }
-
- public List<String> getRootDiskTags() {
- return rootDiskTags;
- }
-
- public void setRootDiskTags(List<String> rootDiskTags) {
- this.rootDiskTags = rootDiskTags;
- }
-
- public String getHostname() {
- return hostname;
- }
-
- public void setHostname(String hostname) {
- this.hostname = hostname;
- }
-
- public String getDisplayname() {
- return displayname;
- }
-
- public void setDisplayname(String displayname) {
- this.displayname = displayname;
- }
-
- public List<String> getNetworkIds() {
- return networkIds;
- }
-
- public void setNetworkIds(List<String> networkIds) {
- this.networkIds = networkIds;
- }
-
- @Override
- public Long getDiskOfferingId() {
- return diskOfferingId;
- }
-
- public VMReservationVO getVmReservation() {
- return vmReservation;
- }
-
- public void setVmReservation(VMReservationVO vmReservation) {
- this.vmReservation = vmReservation;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMNetworkMapVO.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMNetworkMapVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMNetworkMapVO.java
deleted file mode 100644
index f29b19f..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMNetworkMapVO.java
+++ /dev/null
@@ -1,71 +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 org.apache.cloudstack.engine.cloud.entity.api.db;
-
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import org.apache.cloudstack.api.InternalIdentity;
-
-
-@Entity
-@Table(name = "vm_network_map")
-public class VMNetworkMapVO implements InternalIdentity{
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name = "vm_id")
- private long vmId;
-
- @Column(name="network_id")
- private long networkId;
-
-
- /**
- * There should never be a public constructor for this class. Since it's
- * only here to define the table for the DAO class.
- */
- protected VMNetworkMapVO() {
- }
-
- public VMNetworkMapVO(long vmId, long networkId) {
- this.vmId = vmId;
- this.networkId = networkId;
- }
-
-
- public long getId() {
- return id;
- }
-
- public long getVmId() {
- return vmId;
- }
-
-
- public long getNetworkId() {
- return networkId;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMReservationVO.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMReservationVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMReservationVO.java
deleted file mode 100644
index 5a69ec8..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMReservationVO.java
+++ /dev/null
@@ -1,127 +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 org.apache.cloudstack.engine.cloud.entity.api.db;
-
-import java.util.Date;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.persistence.Transient;
-
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name = "vm_reservation")
-public class VMReservationVO implements Identity, InternalIdentity{
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name = "vm_id")
- private long vmId;
-
- @Column(name="uuid")
- private String uuid;
-
- @Column(name="data_center_id")
- private long dataCenterId;
-
- @Column(name="pod_id")
- private long podId;
-
- @Column(name="cluster_id")
- private long clusterId;
-
- @Column(name="host_id")
- private long hostId;
-
- @Column(name=GenericDao.CREATED_COLUMN)
- private Date created;
-
- @Column(name=GenericDao.REMOVED_COLUMN)
- private Date removed;
-
- // VolumeId -> poolId
- @Transient
- Map<Long,Long> volumeReservationMap;
-
- /**
- * There should never be a public constructor for this class. Since it's
- * only here to define the table for the DAO class.
- */
- protected VMReservationVO() {
- }
-
- public VMReservationVO(long vmId, long dataCenterId, long podId, long clusterId, long hostId) {
- this.vmId = vmId;
- this.dataCenterId = dataCenterId;
- this.podId = podId;
- this.clusterId = clusterId;
- this.hostId = hostId;
- this.uuid = UUID.randomUUID().toString();
- }
-
-
- public long getId() {
- return id;
- }
-
- public long getVmId() {
- return vmId;
- }
-
- @Override
- public String getUuid() {
- return uuid;
- }
-
- public long getDataCenterId() {
- return dataCenterId;
- }
-
- public Long getPodId() {
- return podId;
- }
-
- public Long getClusterId() {
- return clusterId;
- }
-
- public Long getHostId() {
- return hostId;
- }
-
- public Map<Long,Long> getVolumeReservation(){
- return volumeReservationMap;
- }
-
- public void setVolumeReservation(Map<Long,Long> volumeReservationMap){
- this.volumeReservationMap = volumeReservationMap;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMRootDiskTagVO.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMRootDiskTagVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMRootDiskTagVO.java
deleted file mode 100644
index 3c09e93..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMRootDiskTagVO.java
+++ /dev/null
@@ -1,67 +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 org.apache.cloudstack.engine.cloud.entity.api.db;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = "vm_root_disk_tags")
-public class VMRootDiskTagVO implements InternalIdentity {
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name = "vm_id")
- private long vmId;
-
- @Column(name = "root_disk_tag")
- private String rootDiskTag;
-
- /**
- * There should never be a public constructor for this class. Since it's
- * only here to define the table for the DAO class.
- */
- protected VMRootDiskTagVO() {
- }
-
- public VMRootDiskTagVO(long vmId, String rootDiskTag) {
- this.vmId = vmId;
- this.rootDiskTag = rootDiskTag;
- }
-
- public long getId() {
- return id;
- }
-
- public long getVmId() {
- return vmId;
- }
-
- public String getRootDiskTag() {
- return rootDiskTag;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java
deleted file mode 100644
index e858f74..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java
+++ /dev/null
@@ -1,84 +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 org.apache.cloudstack.engine.cloud.entity.api.db;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import org.apache.cloudstack.api.InternalIdentity;
-
-@Entity
-@Table(name = "volume_reservation")
-public class VolumeReservationVO implements InternalIdentity{
-
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- private long id;
-
- @Column(name = "vm_reservation_id")
- private long vmReservationId;
-
- @Column(name = "vm_id")
- private long vmId;
-
- @Column(name="volume_id")
- private long volumeId;
-
- @Column(name="pool_id")
- private long poolId;
-
- /**
- * There should never be a public constructor for this class. Since it's
- * only here to define the table for the DAO class.
- */
- protected VolumeReservationVO() {
- }
-
- public VolumeReservationVO(long vmId, long volumeId, long poolId, long vmReservationId) {
- this.vmId = vmId;
- this.volumeId = volumeId;
- this.poolId = poolId;
- this.vmReservationId = vmReservationId;
- }
-
-
- public long getId() {
- return id;
- }
-
- public long getVmId() {
- return vmId;
- }
-
- public long getVmReservationId() {
- return vmReservationId;
- }
-
- public long getVolumeId() {
- return volumeId;
- }
-
- public Long getPoolId() {
- return poolId;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDao.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDao.java
deleted file mode 100644
index d8178d4..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDao.java
+++ /dev/null
@@ -1,31 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMComputeTagVO;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface VMComputeTagDao extends GenericDao<VMComputeTagVO, Long>{
-
- void persist(long vmId, List<String> computeTags);
-
- List<String> getComputeTags(long vmId);
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDaoImpl.java
deleted file mode 100644
index 6f70b35..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDaoImpl.java
+++ /dev/null
@@ -1,89 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMComputeTagVO;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-
-@Component
-@Local(value = { VMComputeTagDao.class })
-public class VMComputeTagDaoImpl extends GenericDaoBase<VMComputeTagVO, Long> implements VMComputeTagDao {
-
- protected SearchBuilder<VMComputeTagVO> VmIdSearch;
-
- public VMComputeTagDaoImpl() {
- }
-
- @PostConstruct
- public void init() {
- VmIdSearch = createSearchBuilder();
- VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
- VmIdSearch.done();
-
- }
-
- @Override
- public void persist(long vmId, List<String> computeTags) {
- Transaction txn = Transaction.currentTxn();
-
- txn.start();
- SearchCriteria<VMComputeTagVO> sc = VmIdSearch.create();
- sc.setParameters("vmId", vmId);
- expunge(sc);
-
- for (String tag : computeTags) {
- if(tag != null){
- tag = tag.trim();
- if(tag.length() > 0) {
- VMComputeTagVO vo = new VMComputeTagVO(vmId, tag);
- persist(vo);
- }
- }
- }
- txn.commit();
- }
-
- @Override
- public List<String> getComputeTags(long vmId) {
-
- SearchCriteria<VMComputeTagVO> sc = VmIdSearch.create();
- sc.setParameters("vmId", vmId);
-
- List<VMComputeTagVO> results = search(sc, null);
- List<String> computeTags = new ArrayList<String>(results.size());
- for (VMComputeTagVO result : results) {
- computeTags.add(result.getComputeTag());
- }
-
- return computeTags;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDao.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDao.java
deleted file mode 100644
index aa063dc..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDao.java
+++ /dev/null
@@ -1,41 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
-
-import com.cloud.utils.Pair;
-import com.cloud.utils.db.GenericDao;
-import com.cloud.utils.fsm.StateDao;
-import com.cloud.vm.VMInstanceVO;
-import com.cloud.vm.VirtualMachine;
-import com.cloud.vm.VirtualMachine.State;
-import com.cloud.vm.VirtualMachine.Type;
-
-
-/*
- * Data Access Object for vm_instance table
- */
-public interface VMEntityDao extends GenericDao<VMEntityVO, Long> {
-
- void loadVmReservation(VMEntityVO vm);
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDaoImpl.java
deleted file mode 100644
index 3082d21..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDaoImpl.java
+++ /dev/null
@@ -1,169 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
-import org.apache.log4j.Logger;
-import org.springframework.stereotype.Component;
-
-
-import com.cloud.network.dao.NetworkDao;
-import com.cloud.network.dao.NetworkVO;
-import com.cloud.utils.Pair;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.Transaction;
-import com.cloud.vm.NicProfile;
-
-
-
-@Component
-@Local(value = { VMEntityDao.class })
-public class VMEntityDaoImpl extends GenericDaoBase<VMEntityVO, Long> implements VMEntityDao {
-
- public static final Logger s_logger = Logger.getLogger(VMEntityDaoImpl.class);
-
-
- @Inject protected VMReservationDao _vmReservationDao;
-
- @Inject protected VMComputeTagDao _vmComputeTagDao;
-
- @Inject protected VMRootDiskTagDao _vmRootDiskTagsDao;
-
- @Inject protected VMNetworkMapDao _vmNetworkMapDao;
-
-
- @Inject
- protected NetworkDao _networkDao;
-
- public VMEntityDaoImpl() {
- }
-
- @PostConstruct
- protected void init() {
-
- }
-
- @Override
- public void loadVmReservation(VMEntityVO vm) {
- VMReservationVO vmReservation = _vmReservationDao.findByVmId(vm.getId());
- vm.setVmReservation(vmReservation);
- }
-
- @Override
- @DB
- public VMEntityVO persist(VMEntityVO vm) {
- Transaction txn = Transaction.currentTxn();
- txn.start();
-
- VMEntityVO dbVO = super.persist(vm);
-
- saveVmNetworks(vm);
- loadVmNetworks(dbVO);
- saveVmReservation(vm);
- loadVmReservation(dbVO);
- saveComputeTags(vm.getId(), vm.getComputeTags());
- loadComputeTags(dbVO);
- saveRootDiskTags(vm.getId(), vm.getRootDiskTags());
- loadRootDiskTags(dbVO);
-
- txn.commit();
-
- return dbVO;
- }
-
- private void loadVmNetworks(VMEntityVO dbVO) {
- List<Long> networksIds = _vmNetworkMapDao.getNetworks(dbVO.getId());
-
- List<String> networks = new ArrayList<String>();
- for(Long networkId : networksIds){
- NetworkVO network = _networkDao.findById(networkId);
- if(network != null){
- networks.add(network.getUuid());
- }
- }
-
- dbVO.setNetworkIds(networks);
-
- }
-
- private void saveVmNetworks(VMEntityVO vm) {
- List<Long> networks = new ArrayList<Long>();
-
- List<String> networksIds = vm.getNetworkIds();
-
- if (networksIds == null || (networksIds != null && networksIds.isEmpty())) {
- return;
- }
-
-
- for(String uuid : networksIds){
- NetworkVO network = _networkDao.findByUuid(uuid);
- if(network != null){
- networks.add(network.getId());
- }
- }
- _vmNetworkMapDao.persist(vm.getId(), networks);
-
- }
-
- private void loadRootDiskTags(VMEntityVO dbVO) {
- List<String> rootDiskTags = _vmRootDiskTagsDao.getRootDiskTags(dbVO.getId());
- dbVO.setRootDiskTags(rootDiskTags);
-
- }
-
- private void loadComputeTags(VMEntityVO dbVO) {
- List<String> computeTags = _vmComputeTagDao.getComputeTags(dbVO.getId());
- dbVO.setComputeTags(computeTags);
-
- }
-
- private void saveRootDiskTags(long vmId, List<String> rootDiskTags) {
- if (rootDiskTags == null || (rootDiskTags != null && rootDiskTags.isEmpty())) {
- return;
- }
- _vmRootDiskTagsDao.persist(vmId, rootDiskTags);
-
- }
-
- private void saveComputeTags(long vmId, List<String> computeTags) {
- if (computeTags == null || (computeTags != null && computeTags.isEmpty())) {
- return;
- }
-
- _vmComputeTagDao.persist(vmId, computeTags);
- }
-
- private void saveVmReservation(VMEntityVO vm) {
- if(vm.getVmReservation() != null){
- _vmReservationDao.persist(vm.getVmReservation());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDao.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDao.java
deleted file mode 100644
index 59c41c2..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDao.java
+++ /dev/null
@@ -1,31 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface VMNetworkMapDao extends GenericDao<VMNetworkMapVO, Long>{
-
- void persist(long vmId, List<Long> networks);
-
- List<Long> getNetworks(long vmId);
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDaoImpl.java
deleted file mode 100644
index 0f2c4cc..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDaoImpl.java
+++ /dev/null
@@ -1,85 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-import javax.inject.Inject;
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO;
-import org.springframework.stereotype.Component;
-import com.cloud.network.dao.NetworkDao;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-
-@Component
-@Local(value = { VMNetworkMapDao.class })
-public class VMNetworkMapDaoImpl extends GenericDaoBase<VMNetworkMapVO, Long> implements VMNetworkMapDao {
-
- protected SearchBuilder<VMNetworkMapVO> VmIdSearch;
-
- @Inject
- protected NetworkDao _networkDao;
-
- public VMNetworkMapDaoImpl() {
- }
-
- @PostConstruct
- public void init() {
- VmIdSearch = createSearchBuilder();
- VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
- VmIdSearch.done();
-
- }
-
- @Override
- public void persist(long vmId, List<Long> networks) {
- Transaction txn = Transaction.currentTxn();
-
- txn.start();
- SearchCriteria<VMNetworkMapVO> sc = VmIdSearch.create();
- sc.setParameters("vmId", vmId);
- expunge(sc);
-
- for (Long networkId : networks) {
- VMNetworkMapVO vo = new VMNetworkMapVO(vmId, networkId);
- persist(vo);
- }
-
- txn.commit();
- }
-
- @Override
- public List<Long> getNetworks(long vmId) {
-
- SearchCriteria<VMNetworkMapVO> sc = VmIdSearch.create();
- sc.setParameters("vmId", vmId);
-
- List<VMNetworkMapVO> results = search(sc, null);
- List<Long> networks = new ArrayList<Long>(results.size());
- for (VMNetworkMapVO result : results) {
- networks.add(result.getNetworkId());
- }
-
- return networks;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDao.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDao.java
deleted file mode 100644
index 721a8c4..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDao.java
+++ /dev/null
@@ -1,34 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-
-import java.util.Map;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface VMReservationDao extends GenericDao<VMReservationVO, Long>{
-
- VMReservationVO findByVmId(long vmId);
-
- void loadVolumeReservation(VMReservationVO reservation);
-
- VMReservationVO findByReservationId(String reservationId);
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDaoImpl.java
deleted file mode 100644
index 73b4dd2..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDaoImpl.java
+++ /dev/null
@@ -1,111 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
-import org.apache.cloudstack.engine.cloud.entity.api.db.VolumeReservationVO;
-import org.springframework.stereotype.Component;
-
-import com.cloud.host.dao.HostTagsDaoImpl;
-import com.cloud.utils.db.DB;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-
-@Component
-@Local(value = { VMReservationDao.class })
-public class VMReservationDaoImpl extends GenericDaoBase<VMReservationVO, Long> implements VMReservationDao {
-
- protected SearchBuilder<VMReservationVO> VmIdSearch;
-
- @Inject protected VolumeReservationDao _volumeReservationDao;
-
- public VMReservationDaoImpl() {
- }
-
- @PostConstruct
- public void init() {
- VmIdSearch = createSearchBuilder();
- VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
- VmIdSearch.done();
- }
-
- @Override
- public VMReservationVO findByVmId(long vmId) {
- SearchCriteria<VMReservationVO> sc = VmIdSearch.create("vmId", vmId);
- VMReservationVO vmRes = findOneBy(sc);
- loadVolumeReservation(vmRes);
- return vmRes;
- }
-
-
- @Override
- public void loadVolumeReservation(VMReservationVO reservation){
- if(reservation != null){
- List<VolumeReservationVO> volumeResList = _volumeReservationDao.listVolumeReservation(reservation.getId());
- Map<Long, Long> volumeReservationMap = new HashMap<Long,Long>();
-
- for(VolumeReservationVO res : volumeResList){
- volumeReservationMap.put(res.getVolumeId(), res.getPoolId());
- }
- reservation.setVolumeReservation(volumeReservationMap);
- }
- }
-
- @Override
- @DB
- public VMReservationVO persist(VMReservationVO reservation) {
- Transaction txn = Transaction.currentTxn();
- txn.start();
-
- VMReservationVO dbVO = super.persist(reservation);
-
- saveVolumeReservation(reservation);
- loadVolumeReservation(dbVO);
-
- txn.commit();
-
- return dbVO;
- }
-
- private void saveVolumeReservation(VMReservationVO reservation) {
- if(reservation.getVolumeReservation() != null){
- for(Long volumeId : reservation.getVolumeReservation().keySet()){
- VolumeReservationVO volumeReservation = new VolumeReservationVO(reservation.getVmId(), volumeId, reservation.getVolumeReservation().get(volumeId), reservation.getId());
- _volumeReservationDao.persist(volumeReservation);
- }
- }
- }
-
- @Override
- public VMReservationVO findByReservationId(String reservationId) {
- VMReservationVO vmRes = super.findByUuid(reservationId);
- loadVolumeReservation(vmRes);
- return vmRes;
- }
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDao.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDao.java
deleted file mode 100644
index dc00880..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDao.java
+++ /dev/null
@@ -1,31 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMRootDiskTagVO;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface VMRootDiskTagDao extends GenericDao<VMRootDiskTagVO, Long>{
-
- void persist(long vmId, List<String> diskTags);
-
- List<String> getRootDiskTags(long vmId);
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDaoImpl.java
deleted file mode 100644
index be194bb..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDaoImpl.java
+++ /dev/null
@@ -1,88 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMRootDiskTagVO;
-
-import org.springframework.stereotype.Component;
-
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-import com.cloud.utils.db.Transaction;
-
-@Component
-@Local(value = { VMRootDiskTagDao.class })
-public class VMRootDiskTagDaoImpl extends GenericDaoBase<VMRootDiskTagVO, Long> implements VMRootDiskTagDao {
-
- protected SearchBuilder<VMRootDiskTagVO> VmIdSearch;
-
- public VMRootDiskTagDaoImpl() {
- }
-
- @PostConstruct
- public void init() {
- VmIdSearch = createSearchBuilder();
- VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
- VmIdSearch.done();
-
- }
-
- @Override
- public void persist(long vmId, List<String> rootDiskTags) {
- Transaction txn = Transaction.currentTxn();
-
- txn.start();
- SearchCriteria<VMRootDiskTagVO> sc = VmIdSearch.create();
- sc.setParameters("vmId", vmId);
- expunge(sc);
-
- for (String tag : rootDiskTags) {
- if(tag != null){
- tag = tag.trim();
- if(tag.length() > 0) {
- VMRootDiskTagVO vo = new VMRootDiskTagVO(vmId, tag);
- persist(vo);
- }
- }
- }
- txn.commit();
- }
-
-
- @Override
- public List<String> getRootDiskTags(long vmId) {
- SearchCriteria<VMRootDiskTagVO> sc = VmIdSearch.create();
- sc.setParameters("vmId", vmId);
-
- List<VMRootDiskTagVO> results = search(sc, null);
- List<String> computeTags = new ArrayList<String>(results.size());
- for (VMRootDiskTagVO result : results) {
- computeTags.add(result.getRootDiskTag());
- }
- return computeTags;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDao.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDao.java
deleted file mode 100644
index fd709b0..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDao.java
+++ /dev/null
@@ -1,31 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-import java.util.List;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VolumeReservationVO;
-
-import com.cloud.utils.db.GenericDao;
-
-public interface VolumeReservationDao extends GenericDao<VolumeReservationVO, Long>{
-
- VolumeReservationVO findByVmId(long vmId);
-
- List<VolumeReservationVO> listVolumeReservation(long vmReservationId);
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java
deleted file mode 100644
index 4f3761b..0000000
--- a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java
+++ /dev/null
@@ -1,68 +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 org.apache.cloudstack.engine.cloud.entity.api.db.dao;
-
-
-import java.util.List;
-
-import javax.annotation.PostConstruct;
-import javax.ejb.Local;
-import javax.inject.Inject;
-
-import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
-import org.apache.cloudstack.engine.cloud.entity.api.db.VolumeReservationVO;
-import org.springframework.stereotype.Component;
-
-import com.cloud.host.dao.HostTagsDaoImpl;
-import com.cloud.utils.db.GenericDaoBase;
-import com.cloud.utils.db.SearchBuilder;
-import com.cloud.utils.db.SearchCriteria;
-
-@Component
-@Local(value = { VolumeReservationDao.class })
-public class VolumeReservationDaoImpl extends GenericDaoBase<VolumeReservationVO, Long> implements VolumeReservationDao {
-
- protected SearchBuilder<VolumeReservationVO> VmIdSearch;
- protected SearchBuilder<VolumeReservationVO> VmReservationIdSearch;
-
- public VolumeReservationDaoImpl() {
- }
-
- @PostConstruct
- public void init() {
- VmIdSearch = createSearchBuilder();
- VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ);
- VmIdSearch.done();
-
- VmReservationIdSearch = createSearchBuilder();
- VmReservationIdSearch.and("vmReservationId", VmReservationIdSearch.entity().getVmReservationId(), SearchCriteria.Op.EQ);
- VmReservationIdSearch.done();
- }
-
- @Override
- public VolumeReservationVO findByVmId(long vmId) {
- SearchCriteria<VolumeReservationVO> sc = VmIdSearch.create("vmId", vmId);
- return findOneBy(sc);
- }
-
- @Override
- public List<VolumeReservationVO> listVolumeReservation(long vmReservationId) {
- SearchCriteria<VolumeReservationVO> sc = VmReservationIdSearch.create("vmReservationId", vmReservationId);
- return listBy(sc);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/9cb91ba5/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java
----------------------------------------------------------------------
diff --git a/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java
new file mode 100644
index 0000000..e4fc228
--- /dev/null
+++ b/engine/schema/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java
@@ -0,0 +1,67 @@
+// 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 org.apache.cloudstack.engine.cloud.entity.api.db;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.apache.cloudstack.api.InternalIdentity;
+
+@Entity
+@Table(name = "vm_compute_tags")
+public class VMComputeTagVO implements InternalIdentity{
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id")
+ private long id;
+
+ @Column(name = "vm_id")
+ private long vmId;
+
+ @Column(name = "compute_tag")
+ private String computeTag;
+
+ /**
+ * There should never be a public constructor for this class. Since it's
+ * only here to define the table for the DAO class.
+ */
+ protected VMComputeTagVO() {
+ }
+
+ public VMComputeTagVO(long vmId, String tag) {
+ this.vmId = vmId;
+ this.computeTag = tag;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public long getVmId() {
+ return vmId;
+ }
+
+ public String getComputeTag() {
+ return computeTag;
+ }
+
+}