http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/DomainRouterVO.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/DomainRouterVO.java b/core/src/com/cloud/vm/DomainRouterVO.java deleted file mode 100755 index 2cc9364..0000000 --- a/core/src/com/cloud/vm/DomainRouterVO.java +++ /dev/null @@ -1,246 +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; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.Table; - -import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.network.router.VirtualRouter; - -/** - */ -@Entity -@Table(name="domain_router") -@PrimaryKeyJoinColumn(name="id") -@DiscriminatorValue(value="DomainRouter") -public class DomainRouterVO extends VMInstanceVO implements VirtualRouter { - @Column(name="element_id") - private long elementId; - - @Column(name="public_ip_address") - private String publicIpAddress; - - @Column(name="public_mac_address") - private String publicMacAddress; - - @Column(name="public_netmask") - private String publicNetmask; - - @Column(name="is_redundant_router") - boolean isRedundantRouter; - - @Column(name="priority") - int priority; - - @Column(name="is_priority_bumpup") - boolean isPriorityBumpUp; - - @Column(name="redundant_state") - @Enumerated(EnumType.STRING) - private RedundantState redundantState; - - @Column(name="stop_pending") - boolean stopPending; - - @Column(name="role") - @Enumerated(EnumType.STRING) - private Role role = Role.VIRTUAL_ROUTER; - - @Column(name="template_version") - private String templateVersion; - - @Column(name="scripts_version") - private String scriptsVersion; - - @Column(name="vpc_id") - private Long vpcId; - - public DomainRouterVO(long id, - long serviceOfferingId, - long elementId, - String name, - long templateId, - HypervisorType hypervisorType, - long guestOSId, - long domainId, - long accountId, - boolean isRedundantRouter, - int priority, - boolean isPriorityBumpUp, - RedundantState redundantState, - boolean haEnabled, - boolean stopPending, Long vpcId) { - super(id, serviceOfferingId, name, name, Type.DomainRouter, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled); - this.elementId = elementId; - this.isRedundantRouter = isRedundantRouter; - this.priority = priority; - this.redundantState = redundantState; - this.isPriorityBumpUp = isPriorityBumpUp; - this.stopPending = stopPending; - this.vpcId = vpcId; - } - - public DomainRouterVO(long id, - long serviceOfferingId, - long elementId, - String name, - long templateId, - HypervisorType hypervisorType, - long guestOSId, - long domainId, - long accountId, - boolean isRedundantRouter, - int priority, - boolean isPriorityBumpUp, - RedundantState redundantState, - boolean haEnabled, - boolean stopPending, - VirtualMachine.Type vmType, Long vpcId) { - super(id, serviceOfferingId, name, name, vmType, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled); - this.elementId = elementId; - this.isRedundantRouter = isRedundantRouter; - this.priority = priority; - this.redundantState = redundantState; - this.isPriorityBumpUp = isPriorityBumpUp; - this.stopPending = stopPending; - this.vpcId = vpcId; - } - - public long getElementId() { - return elementId; - } - - public void setPublicIpAddress(String publicIpAddress) { - this.publicIpAddress = publicIpAddress; - } - - public void setPublicMacAddress(String publicMacAddress) { - this.publicMacAddress = publicMacAddress; - } - - public void setPublicNetmask(String publicNetmask) { - this.publicNetmask = publicNetmask; - } - - @Override - public long getDataCenterId() { - return dataCenterId; - } - - public String getPublicNetmask() { - return publicNetmask; - } - - public String getPublicMacAddress() { - return publicMacAddress; - } - - protected DomainRouterVO() { - super(); - } - - @Override - public String getPublicIpAddress() { - return publicIpAddress; - } - - @Override - public Role getRole() { - return role; - } - - public void setRole(Role role) { - this.role = role; - } - - @Override - public boolean getIsRedundantRouter() { - return this.isRedundantRouter; - } - - public void setIsRedundantRouter(boolean isRedundantRouter) { - this.isRedundantRouter = isRedundantRouter; - } - - @Override - public long getServiceOfferingId() { - return serviceOfferingId; - } - - public int getPriority() { - return this.priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } - - @Override - public RedundantState getRedundantState() { - return this.redundantState; - } - - public void setRedundantState(RedundantState redundantState) { - this.redundantState = redundantState; - } - - public boolean getIsPriorityBumpUp() { - return this.isPriorityBumpUp; - } - - public void setIsPriorityBumpUp(boolean isPriorityBumpUp) { - this.isPriorityBumpUp = isPriorityBumpUp; - } - - @Override - public boolean isStopPending() { - return this.stopPending; - } - - @Override - public void setStopPending(boolean stopPending) { - this.stopPending = stopPending; - } - - public String getTemplateVersion() { - return this.templateVersion; - } - - public void setTemplateVersion(String templateVersion) { - this.templateVersion = templateVersion; - } - - public String getScriptsVersion() { - return this.scriptsVersion; - } - - public void setScriptsVersion(String scriptsVersion) { - this.scriptsVersion = scriptsVersion; - } - - @Override - public Long getVpcId() { - return vpcId; - } - -}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/InstanceGroupVMMapVO.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/InstanceGroupVMMapVO.java b/core/src/com/cloud/vm/InstanceGroupVMMapVO.java deleted file mode 100644 index 996655d..0000000 --- a/core/src/com/cloud/vm/InstanceGroupVMMapVO.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 com.cloud.vm; - -import org.apache.cloudstack.api.InternalIdentity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.SecondaryTable; -import javax.persistence.SecondaryTables; -import javax.persistence.Table; - -@Entity -@Table(name=("instance_group_vm_map")) -@SecondaryTables({ -@SecondaryTable(name="user_vm", - pkJoinColumns={@PrimaryKeyJoinColumn(name="instance_id", referencedColumnName="id")}), -@SecondaryTable(name="instance_group", - pkJoinColumns={@PrimaryKeyJoinColumn(name="group_id", referencedColumnName="id")}) - }) -public class InstanceGroupVMMapVO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private Long id; - - @Column(name="group_id") - private long groupId; - - @Column(name="instance_id") - private long instanceId; - - - public InstanceGroupVMMapVO() { } - - public InstanceGroupVMMapVO(long groupId, long instanceId) { - this.groupId = groupId; - this.instanceId = instanceId; - } - - public long getId() { - return id; - } - - public long getGroupId() { - return groupId; - } - - public long getInstanceId() { - return instanceId; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/InstanceGroupVO.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/InstanceGroupVO.java b/core/src/com/cloud/vm/InstanceGroupVO.java deleted file mode 100644 index ad66b5a..0000000 --- a/core/src/com/cloud/vm/InstanceGroupVO.java +++ /dev/null @@ -1,120 +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; - -import java.util.Date; -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.PrimaryKeyJoinColumn; -import javax.persistence.SecondaryTable; -import javax.persistence.Table; - -import org.apache.cloudstack.api.Identity; -import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; - -@Entity -@Table(name="instance_group") -@SecondaryTable(name="account", - pkJoinColumns={@PrimaryKeyJoinColumn(name="account_id", referencedColumnName="id")}) -public class InstanceGroupVO implements InstanceGroup { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="name") - String name; - - @Column(name="account_id") - private long accountId; - - @Column(name="domain_id", table="account", insertable=false, updatable=false) - private long domainId; - - @Column(name=GenericDao.REMOVED_COLUMN) - private Date removed; - - @Column(name=GenericDao.CREATED_COLUMN) - private Date created; - - @Column(name="uuid") - private String uuid; - - @Column(name="type", table="account", insertable=false, updatable=false) - private short accountType; - - public InstanceGroupVO(String name, long accountId) { - this.name = name; - this.accountId = accountId; - this.uuid = UUID.randomUUID().toString(); - } - - protected InstanceGroupVO() { - super(); - } - - @Override - public long getId() { - return id; - } - - @Override - public String getName() { - return name; - } - - @Override - public long getAccountId() { - return accountId; - } - - public long getDomainId() { - return domainId; - } - - public Date getRemoved() { - return removed; - } - - public Date getCreated() { - return created; - } - - public void setName(String name) { - this.name = name; - } - - @Override - public String getUuid() { - return this.uuid; - } - - public void setUuid(String uuid) { - this.uuid = uuid; - } - - @Override - public Short getAccountType() { - return accountType; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/SecondaryStorageVm.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/SecondaryStorageVm.java b/core/src/com/cloud/vm/SecondaryStorageVm.java deleted file mode 100644 index 9acff14..0000000 --- a/core/src/com/cloud/vm/SecondaryStorageVm.java +++ /dev/null @@ -1,26 +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; - -/** - * Secondary Storage VM is a system VM instance that is used - * to interface the management server to secondary storage - */ -public interface SecondaryStorageVm extends SystemVm { - enum Role { templateProcessor, commandExecutor } -} - http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/SecondaryStorageVmVO.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/SecondaryStorageVmVO.java b/core/src/com/cloud/vm/SecondaryStorageVmVO.java deleted file mode 100644 index aa2efa5..0000000 --- a/core/src/com/cloud/vm/SecondaryStorageVmVO.java +++ /dev/null @@ -1,135 +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; - -import java.util.Date; - -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; - -import com.cloud.hypervisor.Hypervisor.HypervisorType; - -/** - * SecondaryStorageVmVO domain object - */ - -@Entity -@Table(name = "secondary_storage_vm") -@PrimaryKeyJoinColumn(name = "id") -@DiscriminatorValue(value = "SecondaryStorageVm") -public class SecondaryStorageVmVO extends VMInstanceVO implements SecondaryStorageVm { - - @Column(name = "public_ip_address", nullable = false) - private String publicIpAddress; - - @Column(name = "public_mac_address", nullable = false) - private String publicMacAddress; - - @Column(name = "public_netmask", nullable = false) - private String publicNetmask; - - @Column(name = "guid", nullable = false) - private String guid; - - @Column(name = "nfs_share", nullable = false) - private String nfsShare; - - @Column(name = "role", nullable = false) - @Enumerated(value = EnumType.STRING) - private Role role; - - @Temporal(TemporalType.TIMESTAMP) - @Column(name = "last_update", updatable = true, nullable = true) - private Date lastUpdateTime; - - public SecondaryStorageVmVO(long id, long serviceOfferingId, String name, long templateId, HypervisorType hypervisorType, long guestOSId, long dataCenterId, long domainId, long accountId, - Role role, boolean haEnabled) { - super(id, serviceOfferingId, name, name, Type.SecondaryStorageVm, templateId, hypervisorType, guestOSId, domainId, accountId, haEnabled); - this.role = role; - } - - protected SecondaryStorageVmVO() { - super(); - } - - public void setPublicIpAddress(String publicIpAddress) { - this.publicIpAddress = publicIpAddress; - } - - public void setPublicNetmask(String publicNetmask) { - this.publicNetmask = publicNetmask; - } - - public void setPublicMacAddress(String publicMacAddress) { - this.publicMacAddress = publicMacAddress; - } - - public void setLastUpdateTime(Date time) { - this.lastUpdateTime = time; - } - - @Override - public String getPublicIpAddress() { - return this.publicIpAddress; - } - - @Override - public String getPublicNetmask() { - return this.publicNetmask; - } - - @Override - public String getPublicMacAddress() { - return this.publicMacAddress; - } - - @Override - public Date getLastUpdateTime() { - return this.lastUpdateTime; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public String getGuid() { - return guid; - } - - public void setNfsShare(String nfsShare) { - this.nfsShare = nfsShare; - } - - public String getNfsShare() { - return nfsShare; - } - - public Role getRole() { - return this.role; - } - - public void setRole(Role role) { - this.role = role; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/SystemVm.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/SystemVm.java b/core/src/com/cloud/vm/SystemVm.java deleted file mode 100644 index a697d08..0000000 --- a/core/src/com/cloud/vm/SystemVm.java +++ /dev/null @@ -1,26 +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; - -import java.util.Date; - -public interface SystemVm extends VirtualMachine { - public String getPublicIpAddress(); - public String getPublicNetmask(); - public String getPublicMacAddress(); - public Date getLastUpdateTime(); -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/UserVmCloneSettingVO.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/UserVmCloneSettingVO.java b/core/src/com/cloud/vm/UserVmCloneSettingVO.java deleted file mode 100644 index 24bb1e8..0000000 --- a/core/src/com/cloud/vm/UserVmCloneSettingVO.java +++ /dev/null @@ -1,50 +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; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; - -@Entity -@Table(name="user_vm_clone_setting") -public class UserVmCloneSettingVO { - - @Column(name="vm_id") - private Long vmId; - - @Column(name="clone_type") - private String cloneType; - - public UserVmCloneSettingVO() { - - } - - public UserVmCloneSettingVO(long id, - String cloneType) { - this.vmId = id; - this.cloneType = cloneType; - } - - public long getVmId() { - return this.vmId; - } - - public String getCloneType() { - return this.cloneType; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/UserVmDetailVO.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/UserVmDetailVO.java b/core/src/com/cloud/vm/UserVmDetailVO.java deleted file mode 100644 index 245b577..0000000 --- a/core/src/com/cloud/vm/UserVmDetailVO.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 com.cloud.vm; - -import org.apache.cloudstack.api.InternalIdentity; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -@Entity -@Table(name="user_vm_details") -public class UserVmDetailVO implements InternalIdentity { - @Id - @GeneratedValue(strategy=GenerationType.IDENTITY) - @Column(name="id") - private long id; - - @Column(name="vm_id") - private long vmId; - - @Column(name="name") - private String name; - - @Column(name="value", length=1024) - private String value; - - public UserVmDetailVO() {} - - public UserVmDetailVO(long vmId, String name, String value) { - this.vmId = vmId; - this.name = name; - this.value = value; - } - - public long getId() { - return id; - } - - public long getVmId() { - return vmId; - } - - public String getName() { - return name; - } - - public String getValue() { - return value; - } - - public void setId(long id) { - this.id = id; - } - - public void setVmId(long vmId) { - this.vmId = vmId; - } - - public void setName(String name) { - this.name = name; - } - - public void setValue(String value) { - this.value = value; - } - -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/UserVmVO.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/UserVmVO.java b/core/src/com/cloud/vm/UserVmVO.java deleted file mode 100755 index 2e9bdf5..0000000 --- a/core/src/com/cloud/vm/UserVmVO.java +++ /dev/null @@ -1,141 +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; - -import java.util.HashMap; - -import javax.persistence.Basic; -import javax.persistence.Column; -import javax.persistence.DiscriminatorValue; -import javax.persistence.Entity; -import javax.persistence.FetchType; -import javax.persistence.PrimaryKeyJoinColumn; -import javax.persistence.Table; - -import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.uservm.UserVm; - -@Entity -@Table(name="user_vm") -@DiscriminatorValue(value="User") -@PrimaryKeyJoinColumn(name="id") -public class UserVmVO extends VMInstanceVO implements UserVm { - - @Column(name="iso_id", nullable=true, length=17) - private Long isoId = null; - - @Column(name="user_data", updatable=true, nullable=true, length=32768) - @Basic(fetch = FetchType.LAZY) - private String userData; - - @Column(name="display_name", updatable=true, nullable=true) - private String displayName; - - @Column(name="update_parameters", updatable=true) - protected boolean updateParameters = true; - - transient String password; - - @Override - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - @Override - public Long getIsoId() { - return isoId; - } - - @Override - public long getServiceOfferingId() { - return serviceOfferingId; - } - - public UserVmVO(long id, - String instanceName, - String displayName, - long templateId, - HypervisorType hypervisorType, - long guestOsId, - boolean haEnabled, - boolean limitCpuUse, - long domainId, - long accountId, - long serviceOfferingId, - String userData, - String name, Long diskOfferingId) { - super(id, serviceOfferingId, name, instanceName, Type.User, templateId, hypervisorType, guestOsId, domainId, accountId, haEnabled, limitCpuUse, diskOfferingId); - this.userData = userData; - this.displayName = displayName; - this.details = new HashMap<String, String>(); - } - - protected UserVmVO() { - super(); - } - - public void setIsoId(Long id) { - this.isoId = id; - } - - @Override - public void setUserData(String userData) { - this.userData = userData; - } - - @Override - public String getUserData() { - return userData; - } - - @Override - public String getDisplayName() { - return displayName; - } - - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - - @Override - public String getDetail(String name) { - assert (details != null) : "Did you forget to load the details?"; - - return details != null ? details.get(name) : null; - } - - @Override - public void setAccountId(long accountId){ - this.accountId = accountId; - } - - public void setDomainId(long domainId){ - this.domainId = domainId; - } - - public void setUpdateParameters(boolean updateParameters) { - this.updateParameters = updateParameters; - } - - public boolean isUpdateParameters() { - return updateParameters; - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/VirtualMachineName.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/VirtualMachineName.java b/core/src/com/cloud/vm/VirtualMachineName.java deleted file mode 100755 index 81838b9..0000000 --- a/core/src/com/cloud/vm/VirtualMachineName.java +++ /dev/null @@ -1,190 +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; - -import java.util.Formatter; - -import com.cloud.dc.Vlan; - -/** - * VM Name. - */ -public class VirtualMachineName { - public static final String SEPARATOR = "-"; - - public static String getVnetName(long vnetId) { - StringBuilder vnet = new StringBuilder(); - Formatter formatter = new Formatter(vnet); - formatter.format("%04x", vnetId); - return vnet.toString(); - } - - public static boolean isValidVmName(String vmName) { - return isValidVmName(vmName, null); - } - - public static boolean isValidVmName(String vmName, String instance) { - String[] tokens = vmName.split(SEPARATOR); - /*Some vms doesn't have vlan/vnet id*/ - if (tokens.length != 5 && tokens.length != 4) { - return false; - } - - if (!tokens[0].equals("i")) { - return false; - } - - try { - Long.parseLong(tokens[1]); - Long.parseLong(tokens[2]); - if (tokens.length == 5 && !Vlan.UNTAGGED.equalsIgnoreCase(tokens[4])) { - Long.parseLong(tokens[4], 16); - } - } catch (NumberFormatException e) { - return false; - } - - return instance == null || instance.equals(tokens[3]); - } - - public static String getVmName(long vmId, long userId, String instance) { - StringBuilder vmName = new StringBuilder("i"); - vmName.append(SEPARATOR).append(userId).append(SEPARATOR).append(vmId); - vmName.append(SEPARATOR).append(instance); - return vmName.toString(); - } - - public static long getVmId(String vmName) { - int begin = vmName.indexOf(SEPARATOR); - begin = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length()); - int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length()); - return Long.parseLong(vmName.substring(begin + 1, end)); - } - - public static long getRouterId(String routerName) { - int begin = routerName.indexOf(SEPARATOR); - int end = routerName.indexOf(SEPARATOR, begin + SEPARATOR.length()); - return Long.parseLong(routerName.substring(begin + 1, end)); - } - - public static long getConsoleProxyId(String vmName) { - int begin = vmName.indexOf(SEPARATOR); - int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length()); - return Long.parseLong(vmName.substring(begin + 1, end)); - } - - public static long getSystemVmId(String vmName) { - int begin = vmName.indexOf(SEPARATOR); - int end = vmName.indexOf(SEPARATOR, begin + SEPARATOR.length()); - return Long.parseLong(vmName.substring(begin + 1, end)); - } - - public static String getVnet(String vmName) { - return vmName.substring(vmName.lastIndexOf(SEPARATOR) + SEPARATOR.length()); - } - - public static String getRouterName(long routerId, String instance) { - StringBuilder builder = new StringBuilder("r"); - builder.append(SEPARATOR).append(routerId).append(SEPARATOR).append(instance); - return builder.toString(); - } - - public static String getConsoleProxyName(long vmId, String instance) { - StringBuilder builder = new StringBuilder("v"); - builder.append(SEPARATOR).append(vmId).append(SEPARATOR).append(instance); - return builder.toString(); - } - - public static String getSystemVmName(long vmId, String instance, String prefix) { - StringBuilder builder = new StringBuilder(prefix); - builder.append(SEPARATOR).append(vmId).append(SEPARATOR).append(instance); - return builder.toString(); - } - - public static String attachVnet(String name, String vnet) { - return name + SEPARATOR + vnet; - } - - public static boolean isValidRouterName(String name) { - return isValidRouterName(name, null); - } - - public static boolean isValidRouterName(String name, String instance) { - String[] tokens = name.split(SEPARATOR); - if (tokens.length != 3 && tokens.length != 4 ) { - return false; - } - - if (!tokens[0].equals("r")) { - return false; - } - - try { - Long.parseLong(tokens[1]); - } catch (NumberFormatException ex) { - return false; - } - - return instance == null || tokens[2].equals(instance); - } - - public static boolean isValidConsoleProxyName(String name) { - return isValidConsoleProxyName(name, null); - } - - public static boolean isValidConsoleProxyName(String name, String instance) { - String[] tokens = name.split(SEPARATOR); - if (tokens.length != 3) { - return false; - } - - if (!tokens[0].equals("v")) { - return false; - } - - try { - Long.parseLong(tokens[1]); - } catch (NumberFormatException ex) { - return false; - } - - return instance == null || tokens[2].equals(instance); - } - - public static boolean isValidSecStorageVmName(String name, String instance) { - return isValidSystemVmName(name, instance, "s"); - } - - public static boolean isValidSystemVmName(String name, String instance, String prefix) { - String[] tokens = name.split(SEPARATOR); - if (tokens.length != 3) { - return false; - } - - if (!tokens[0].equals(prefix)) { - return false; - } - - try { - Long.parseLong(tokens[1]); - } catch (NumberFormatException ex) { - return false; - } - - return instance == null || tokens[2].equals(instance); - } -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/core/src/com/cloud/vm/VmDetailConstants.java ---------------------------------------------------------------------- diff --git a/core/src/com/cloud/vm/VmDetailConstants.java b/core/src/com/cloud/vm/VmDetailConstants.java deleted file mode 100644 index 5ff3ce0..0000000 --- a/core/src/com/cloud/vm/VmDetailConstants.java +++ /dev/null @@ -1,24 +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; - -public interface VmDetailConstants { - public static final String KEYBOARD = "keyboard"; - public static final String NIC_ADAPTER = "nicAdapter"; - public static final String ROOK_DISK_CONTROLLER = "rootDiskController"; - public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag"; -} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/alert/dao/AlertDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/alert/dao/AlertDao.java b/engine/schema/src/com/cloud/alert/dao/AlertDao.java new file mode 100755 index 0000000..fda814d --- /dev/null +++ b/engine/schema/src/com/cloud/alert/dao/AlertDao.java @@ -0,0 +1,33 @@ +// 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.alert.dao; + +import java.util.Date; +import java.util.List; + +import com.cloud.alert.AlertVO; +import com.cloud.utils.db.GenericDao; + +public interface AlertDao extends GenericDao<AlertVO, Long> { + AlertVO getLastAlert(short type, long dataCenterId, Long podId, Long clusterId); + // This is for backward compatibility + AlertVO getLastAlert(short type, long dataCenterId, Long podId); + + public boolean deleteAlert(List<Long> Ids, String type, Date olderThan, Long zoneId); + public boolean archiveAlert(List<Long> Ids, String type, Date olderThan, Long zoneId); + public List<AlertVO> listOlderAlerts(Date oldTime); +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java b/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java new file mode 100755 index 0000000..4b9bc6a --- /dev/null +++ b/engine/schema/src/com/cloud/alert/dao/AlertDaoImpl.java @@ -0,0 +1,156 @@ +// 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.alert.dao; + +import java.util.Date; +import java.util.List; + +import javax.ejb.Local; + +import org.springframework.stereotype.Component; + +import com.cloud.alert.AlertVO; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.Transaction; + +@Component +@Local(value = { AlertDao.class }) +public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements AlertDao { + + protected final SearchBuilder<AlertVO> AlertSearchByIdsAndType; + + public AlertDaoImpl() { + AlertSearchByIdsAndType = createSearchBuilder(); + AlertSearchByIdsAndType.and("id", AlertSearchByIdsAndType.entity().getId(), Op.IN); + AlertSearchByIdsAndType.and("type", AlertSearchByIdsAndType.entity().getType(), Op.EQ); + AlertSearchByIdsAndType.and("createdDateL", AlertSearchByIdsAndType.entity().getCreatedDate(), Op.LT); + AlertSearchByIdsAndType.and("data_center_id", AlertSearchByIdsAndType.entity().getDataCenterId(), Op.EQ); + AlertSearchByIdsAndType.done(); + } + + @Override + public AlertVO getLastAlert(short type, long dataCenterId, Long podId, Long clusterId) { + Filter searchFilter = new Filter(AlertVO.class, "createdDate", Boolean.FALSE, Long.valueOf(0), Long.valueOf(1)); + SearchCriteria<AlertVO> sc = createSearchCriteria(); + + sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type)); + sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId)); + if (podId != null) { + sc.addAnd("podId", SearchCriteria.Op.EQ, podId); + } + if (clusterId != null) { + sc.addAnd("clusterId", SearchCriteria.Op.EQ, clusterId); + } + + List<AlertVO> alerts = listBy(sc, searchFilter); + if ((alerts != null) && !alerts.isEmpty()) { + return alerts.get(0); + } + return null; + } + + @Override + public AlertVO getLastAlert(short type, long dataCenterId, Long podId) { + Filter searchFilter = new Filter(AlertVO.class, "createdDate", Boolean.FALSE, Long.valueOf(0), Long.valueOf(1)); + SearchCriteria<AlertVO> sc = createSearchCriteria(); + + sc.addAnd("type", SearchCriteria.Op.EQ, Short.valueOf(type)); + sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, Long.valueOf(dataCenterId)); + if (podId != null) { + sc.addAnd("podId", SearchCriteria.Op.EQ, podId); + } + + List<AlertVO> alerts = listBy(sc, searchFilter); + if ((alerts != null) && !alerts.isEmpty()) { + return alerts.get(0); + } + return null; + } + + @Override + public boolean archiveAlert(List<Long> Ids, String type, Date olderThan, Long zoneId) { + SearchCriteria<AlertVO> sc = AlertSearchByIdsAndType.create(); + + if (Ids != null) { + sc.setParameters("id", Ids.toArray(new Object[Ids.size()])); + } + if(type != null) { + sc.setParameters("type", type); + } + if(zoneId != null) { + sc.setParameters("data_center_id", zoneId); + } + if(olderThan != null) { + sc.setParameters("createdDateL", olderThan); + } + boolean result = true;; + List<AlertVO> alerts = listBy(sc); + if (Ids != null && alerts.size() < Ids.size()) { + result = false; + return result; + } + Transaction txn = Transaction.currentTxn(); + txn.start(); + for (AlertVO alert : alerts) { + alert = lockRow(alert.getId(), true); + alert.setArchived(true); + update(alert.getId(), alert); + txn.commit(); + } + txn.close(); + return result; + } + + @Override + public boolean deleteAlert(List<Long> ids, String type, Date olderThan, Long zoneId) { + SearchCriteria<AlertVO> sc = AlertSearchByIdsAndType.create(); + + if (ids != null) { + sc.setParameters("id", ids.toArray(new Object[ids.size()])); + } + if(type != null) { + sc.setParameters("type", type); + } + if(zoneId != null) { + sc.setParameters("data_center_id", zoneId); + } + if(olderThan != null) { + sc.setParameters("createdDateL", olderThan); + } + boolean result = true; + List<AlertVO> alerts = listBy(sc); + if (ids != null && alerts.size() < ids.size()) { + result = false; + return result; + } + remove(sc); + return result; + } + + @Override + public List<AlertVO> listOlderAlerts(Date oldTime) { + if (oldTime == null) return null; + SearchCriteria<AlertVO> sc = createSearchCriteria(); + sc.addAnd("createDate", SearchCriteria.Op.LT, oldTime); + return listIncludingRemovedBy(sc, null); + } + +} http://git-wip-us.apache.org/repos/asf/cloudstack/blob/572e71e5/engine/schema/src/com/cloud/capacity/dao/CapacityDao.java ---------------------------------------------------------------------- diff --git a/engine/schema/src/com/cloud/capacity/dao/CapacityDao.java b/engine/schema/src/com/cloud/capacity/dao/CapacityDao.java new file mode 100755 index 0000000..04466f4 --- /dev/null +++ b/engine/schema/src/com/cloud/capacity/dao/CapacityDao.java @@ -0,0 +1,45 @@ +// 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.capacity.dao; + +import java.util.List; +import java.util.Map; + +import com.cloud.capacity.CapacityVO; +import com.cloud.capacity.dao.CapacityDaoImpl.SummedCapacity; +import com.cloud.utils.Pair; +import com.cloud.utils.db.GenericDao; + +public interface CapacityDao extends GenericDao<CapacityVO, Long> { + CapacityVO findByHostIdType(Long hostId, short capacityType); + List<Long> listClustersInZoneOrPodByHostCapacities(long id, int requiredCpu, long requiredRam, short capacityTypeForOrdering, boolean isZone); + List<Long> listHostsWithEnoughCapacity(int requiredCpu, long requiredRam, Long clusterId, String hostType); + boolean removeBy(Short capacityType, Long zoneId, Long podId, Long clusterId, Long hostId); + List<SummedCapacity> findByClusterPodZone(Long zoneId, Long podId, Long clusterId); + List<SummedCapacity> findNonSharedStorageForClusterPodZone(Long zoneId,Long podId, Long clusterId); + Pair<List<Long>, Map<Long, Double>> orderClustersByAggregateCapacity(long id, short capacityType, boolean isZone); + List<SummedCapacity> findCapacityBy(Integer capacityType, Long zoneId, Long podId, Long clusterId); + + List<Long> listPodsByHostCapacities(long zoneId, int requiredCpu, long requiredRam, short capacityType); + Pair<List<Long>, Map<Long, Double>> orderPodsByAggregateCapacity(long zoneId, short capacityType); + List<SummedCapacity> findCapacityBy(Integer capacityType, Long zoneId, + Long podId, Long clusterId, String resourceState); + List<SummedCapacity> listCapacitiesGroupedByLevelAndType(Integer capacityType, Long zoneId, Long podId, Long clusterId, int level, Long limit); + void updateCapacityState(Long dcId, Long podId, Long clusterId, + Long hostId, String capacityState); + List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId, String ConfigName, long computeRequested); +}