-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[VMware] Disk controller mappings #10454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 8 commits
f834504
5459efe
ad7ca02
de794a0
7476f60
f3f7aa3
d13c92a
a0f9c55
1913e53
bb819b6
cd77162
991af0a
d983a7d
6424403
7b8069b
188be60
8984f68
352bbca
6edb407
f013bab
bb64294
adce7af
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 org.apache.cloudstack.storage; | ||
|
|
||
| import com.cloud.hypervisor.Hypervisor.HypervisorType; | ||
| import org.apache.cloudstack.api.Identity; | ||
| import org.apache.cloudstack.api.InternalIdentity; | ||
|
|
||
| import java.util.Date; | ||
|
|
||
| public interface DiskControllerMapping extends InternalIdentity, Identity { | ||
| String getName(); | ||
|
|
||
| String getControllerReference(); | ||
|
|
||
| String getBusName(); | ||
|
|
||
| HypervisorType getHypervisor(); | ||
|
|
||
| Integer getMaxDeviceCount(); | ||
|
|
||
| Integer getMaxControllerCount(); | ||
|
|
||
| String getVmdkAdapterType(); | ||
|
|
||
| String getMinHardwareVersion(); | ||
|
|
||
| Date getRemoved(); | ||
|
|
||
| Date getCreated(); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,205 @@ | ||
| // 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.storage; | ||
|
|
||
| import com.cloud.hypervisor.Hypervisor.HypervisorType; | ||
| import com.cloud.utils.db.GenericDao; | ||
| import org.apache.cloudstack.util.HypervisorTypeConverter; | ||
| import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils; | ||
|
|
||
| import javax.persistence.Column; | ||
| import javax.persistence.Convert; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
| import javax.persistence.GenerationType; | ||
| import javax.persistence.Id; | ||
| import javax.persistence.Table; | ||
| import javax.persistence.Temporal; | ||
| import javax.persistence.TemporalType; | ||
| import java.util.Date; | ||
| import java.util.UUID; | ||
|
|
||
| @Entity | ||
| @Table(name = "disk_controller_mapping") | ||
| public class DiskControllerMappingVO implements DiskControllerMapping { | ||
| @Id | ||
| @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| @Column(name = "id", nullable = false) | ||
| private Long id; | ||
|
|
||
| @Column(name = "uuid", nullable = false) | ||
| private String uuid = UUID.randomUUID().toString(); | ||
|
|
||
| @Column(name = "name", nullable = false) | ||
| private String name; | ||
|
|
||
| @Column(name = "controller_reference", nullable = false) | ||
| private String controllerReference; | ||
|
|
||
| @Column(name = "bus_name", nullable = false) | ||
| private String busName; | ||
|
|
||
| @Column(name = "hypervisor", nullable = false) | ||
| @Convert(converter = HypervisorTypeConverter.class) | ||
| private HypervisorType hypervisor; | ||
|
|
||
| @Column(name = "max_device_count") | ||
| private Integer maxDeviceCount = null; | ||
|
|
||
| @Column(name = "max_controller_count") | ||
| private Integer maxControllerCount = null; | ||
|
|
||
| @Column(name = "vmdk_adapter_type") | ||
| private String vmdkAdapterType = null; | ||
|
|
||
| @Column(name = "min_hardware_version") | ||
| private String minHardwareVersion = null; | ||
|
|
||
| @Column(name = GenericDao.CREATED_COLUMN, nullable = false) | ||
| @Temporal(value = TemporalType.TIMESTAMP) | ||
| private Date created; | ||
|
|
||
| @Column(name = GenericDao.REMOVED_COLUMN) | ||
| @Temporal(value = TemporalType.TIMESTAMP) | ||
| private Date removed = null; | ||
|
|
||
| public DiskControllerMappingVO() { | ||
| } | ||
|
|
||
| @Override | ||
| public String getName() { | ||
|
Check warning on line 84 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| return name; | ||
| } | ||
|
Check warning on line 86 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public String getControllerReference() { | ||
|
Check warning on line 89 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| return controllerReference; | ||
| } | ||
|
Check warning on line 91 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public String getBusName() { | ||
|
Check warning on line 94 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| return busName; | ||
| } | ||
|
Check warning on line 96 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public HypervisorType getHypervisor() { | ||
| return hypervisor; | ||
| } | ||
|
Check warning on line 101 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public Integer getMaxDeviceCount() { | ||
|
Check warning on line 104 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| return maxDeviceCount; | ||
| } | ||
|
Check warning on line 106 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public Integer getMaxControllerCount() { | ||
|
Check warning on line 109 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| return maxControllerCount; | ||
| } | ||
|
Check warning on line 111 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public String getVmdkAdapterType() { | ||
| return vmdkAdapterType; | ||
| } | ||
|
Check warning on line 116 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public String getMinHardwareVersion() { | ||
|
Check warning on line 119 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| return minHardwareVersion; | ||
| } | ||
|
Check warning on line 121 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public Date getRemoved() { | ||
| return removed; | ||
| } | ||
|
Check warning on line 126 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public Date getCreated() { | ||
| return created; | ||
| } | ||
|
Check warning on line 131 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public String getUuid() { | ||
| return uuid; | ||
| } | ||
|
Check warning on line 136 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public long getId() { | ||
| return id; | ||
| } | ||
|
Check warning on line 141 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| public void setId(Long id) { | ||
| this.id = id; | ||
| } | ||
|
Check warning on line 145 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| public void setUuid(String uuid) { | ||
| this.uuid = uuid; | ||
| } | ||
|
Check warning on line 149 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| public void setName(String name) { | ||
|
Check warning on line 151 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| this.name = name; | ||
| } | ||
|
|
||
| public void setControllerReference(String controllerReference) { | ||
|
Check warning on line 155 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| this.controllerReference = controllerReference; | ||
| } | ||
|
|
||
| public void setBusName(String busName) { | ||
|
Check warning on line 159 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| this.busName = busName; | ||
| } | ||
|
|
||
| public void setHypervisor(HypervisorType hypervisor) { | ||
| this.hypervisor = hypervisor; | ||
| } | ||
|
Check warning on line 165 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| public void setMaxDeviceCount(Integer maxDeviceCount) { | ||
|
Check warning on line 167 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| this.maxDeviceCount = maxDeviceCount; | ||
| } | ||
|
|
||
| public void setMaxControllerCount(Integer maxControllerCount) { | ||
|
Check warning on line 171 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| this.maxControllerCount = maxControllerCount; | ||
| } | ||
|
|
||
| public void setVmdkAdapterType(String vmdkAdapterType) { | ||
| this.vmdkAdapterType = vmdkAdapterType; | ||
| } | ||
|
Check warning on line 177 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| public void setMinHardwareVersion(String minHardwareVersion) { | ||
|
Check warning on line 179 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| this.minHardwareVersion = minHardwareVersion; | ||
| } | ||
|
|
||
| public void setCreated(Date created) { | ||
| this.created = created; | ||
| } | ||
|
Check warning on line 185 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| public void setRemoved(Date removed) { | ||
| this.removed = removed; | ||
| } | ||
|
Check warning on line 189 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
|
Check warning on line 192 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| if (!(obj instanceof DiskControllerMappingVO)) { | ||
| return false; | ||
|
Check warning on line 194 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| } | ||
| DiskControllerMappingVO that = (DiskControllerMappingVO) obj; | ||
| return controllerReference.equals(that.getControllerReference()); | ||
| } | ||
|
Check warning on line 198 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
|
|
||
| @Override | ||
| public String toString() { | ||
| return ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "name", "controllerReference", | ||
|
Check warning on line 202 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| "busName", "hypervisor", "maxDeviceCount", "maxControllerCount", "vmdkAdapterType", "minHardwareVersion"); | ||
| } | ||
|
Check warning on line 204 in engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| package org.apache.cloudstack.storage.dao; | ||
|
|
||
| import com.cloud.hypervisor.Hypervisor.HypervisorType; | ||
| import org.apache.cloudstack.storage.DiskControllerMappingVO; | ||
| import com.cloud.utils.db.GenericDao; | ||
|
|
||
| import java.util.List; | ||
|
|
||
| public interface DiskControllerMappingDao extends GenericDao<DiskControllerMappingVO, Long> { | ||
| DiskControllerMappingVO findDiskControllerMapping(String name, String classReference, HypervisorType hypervisor); | ||
|
|
||
| List<DiskControllerMappingVO> listForHypervisor(HypervisorType hypervisor); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // 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.storage.dao; | ||
|
|
||
| import com.cloud.hypervisor.Hypervisor.HypervisorType; | ||
| import com.cloud.utils.db.GenericDaoBase; | ||
| import com.cloud.utils.db.SearchBuilder; | ||
| import com.cloud.utils.db.SearchCriteria; | ||
| import org.apache.cloudstack.storage.DiskControllerMappingVO; | ||
| import org.springframework.stereotype.Component; | ||
|
|
||
| import javax.annotation.PostConstruct; | ||
| import java.util.List; | ||
|
|
||
| @Component | ||
| public class DiskControllerMappingDaoImpl extends GenericDaoBase<DiskControllerMappingVO, Long> implements DiskControllerMappingDao { | ||
| private SearchBuilder<DiskControllerMappingVO> diskControllerMappingSearch; | ||
|
|
||
| @PostConstruct | ||
| public void init() { | ||
| diskControllerMappingSearch = createSearchBuilder(); | ||
| diskControllerMappingSearch.and("name", diskControllerMappingSearch.entity().getName(), SearchCriteria.Op.EQ); | ||
| diskControllerMappingSearch.and("controllerReference", diskControllerMappingSearch.entity().getControllerReference(), SearchCriteria.Op.EQ); | ||
| diskControllerMappingSearch.and("hypervisor", diskControllerMappingSearch.entity().getHypervisor(), SearchCriteria.Op.EQ); | ||
| diskControllerMappingSearch.done(); | ||
| } | ||
|
Check warning on line 40 in engine/schema/src/main/java/org/apache/cloudstack/storage/dao/DiskControllerMappingDaoImpl.java
|
||
|
|
||
| @Override | ||
| public DiskControllerMappingVO findDiskControllerMapping(String name, String controllerReference, HypervisorType hypervisor) { | ||
| SearchCriteria<DiskControllerMappingVO> sc = diskControllerMappingSearch.create(); | ||
| sc.setParametersIfNotNull("name", name); | ||
| sc.setParametersIfNotNull("controllerReference", controllerReference); | ||
| sc.setParameters("hypervisor", hypervisor); | ||
| return findOneBy(sc); | ||
| } | ||
|
Check warning on line 49 in engine/schema/src/main/java/org/apache/cloudstack/storage/dao/DiskControllerMappingDaoImpl.java
|
||
|
|
||
| @Override | ||
| public List<DiskControllerMappingVO> listForHypervisor(HypervisorType hypervisor) { | ||
| SearchCriteria<DiskControllerMappingVO> sc = diskControllerMappingSearch.create(); | ||
| sc.setParameters("hypervisor", hypervisor); | ||
| return listBy(sc); | ||
| } | ||
|
Check warning on line 56 in engine/schema/src/main/java/org/apache/cloudstack/storage/dao/DiskControllerMappingDaoImpl.java
|
||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.