-
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
Open
winterhazel
wants to merge
22
commits into
apache:main
Choose a base branch
from
scclouds:disk-controller-mappings
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
f834504
Disk controller mappings
winterhazel 5459efe
Merge branch 'main' into disk-controller-mappings
winterhazel ad7ca02
Fix merge errors
winterhazel de794a0
Merge branch 'main' into disk-controller-mappings
winterhazel 7476f60
Merge branch 'main' into disk-controller-mappings
winterhazel f3f7aa3
Merge branch 'main' into disk-controller-mappings
winterhazel d13c92a
Update server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
winterhazel a0f9c55
Add log
winterhazel 1913e53
Merge branch 'main' into disk-controller-mappings
winterhazel bb819b6
Add comment explaining a section
winterhazel cd77162
Merge branch 'main' into disk-controller-mappings
winterhazel 991af0a
Merge branch 'main' into disk-controller-mappings
winterhazel d983a7d
Merge branch 'main' into disk-controller-mappings
winterhazel 6424403
Merge branch 'main' into disk-controller-mappings
winterhazel 7b8069b
Fix checkstyle
winterhazel 188be60
add missing class
winterhazel 8984f68
Merge branch 'main' into disk-controller-mappings (& move to 4.23)
winterhazel 352bbca
Merge branch 'main' into disk-controller-mappings
winterhazel 6edb407
Merge remote-tracking branch 'upstream/main' into disk-controller-map…
winterhazel f013bab
Merge remote-tracking branch 'upstream/main' into disk-controller-map…
winterhazel bb64294
Merge remote-tracking branch 'upstream/main' into disk-controller-map…
winterhazel adce7af
Address Copilot reviews
winterhazel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
api/src/main/java/org/apache/cloudstack/storage/DiskControllerMapping.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
210 changes: 210 additions & 0 deletions
210
engine/schema/src/main/java/org/apache/cloudstack/storage/DiskControllerMappingVO.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,210 @@ | ||
| // 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() { | ||
| return name; | ||
| } | ||
|
|
||
| @Override | ||
| public String getControllerReference() { | ||
| return controllerReference; | ||
| } | ||
|
|
||
| @Override | ||
| public String getBusName() { | ||
| return busName; | ||
| } | ||
|
|
||
| @Override | ||
| public HypervisorType getHypervisor() { | ||
| return hypervisor; | ||
| } | ||
|
|
||
| @Override | ||
| public Integer getMaxDeviceCount() { | ||
| return maxDeviceCount; | ||
| } | ||
|
|
||
| @Override | ||
| public Integer getMaxControllerCount() { | ||
| return maxControllerCount; | ||
| } | ||
|
|
||
| @Override | ||
| public String getVmdkAdapterType() { | ||
| return vmdkAdapterType; | ||
| } | ||
|
|
||
| @Override | ||
| public String getMinHardwareVersion() { | ||
| return minHardwareVersion; | ||
| } | ||
|
|
||
| @Override | ||
| public Date getRemoved() { | ||
| return removed; | ||
| } | ||
|
|
||
| @Override | ||
| public Date getCreated() { | ||
| return created; | ||
| } | ||
|
|
||
| @Override | ||
| public String getUuid() { | ||
| return uuid; | ||
| } | ||
|
|
||
| @Override | ||
| public long getId() { | ||
| return id; | ||
| } | ||
|
|
||
| public void setId(Long id) { | ||
| this.id = id; | ||
| } | ||
|
|
||
| public void setUuid(String uuid) { | ||
| this.uuid = uuid; | ||
| } | ||
|
|
||
| public void setName(String name) { | ||
| this.name = name; | ||
| } | ||
|
|
||
| public void setControllerReference(String controllerReference) { | ||
| this.controllerReference = controllerReference; | ||
| } | ||
|
|
||
| public void setBusName(String busName) { | ||
| this.busName = busName; | ||
| } | ||
|
|
||
| public void setHypervisor(HypervisorType hypervisor) { | ||
| this.hypervisor = hypervisor; | ||
| } | ||
|
|
||
| public void setMaxDeviceCount(Integer maxDeviceCount) { | ||
| this.maxDeviceCount = maxDeviceCount; | ||
| } | ||
|
|
||
| public void setMaxControllerCount(Integer maxControllerCount) { | ||
| this.maxControllerCount = maxControllerCount; | ||
| } | ||
|
|
||
| public void setVmdkAdapterType(String vmdkAdapterType) { | ||
| this.vmdkAdapterType = vmdkAdapterType; | ||
| } | ||
|
|
||
| public void setMinHardwareVersion(String minHardwareVersion) { | ||
| this.minHardwareVersion = minHardwareVersion; | ||
| } | ||
|
|
||
| public void setCreated(Date created) { | ||
| this.created = created; | ||
| } | ||
|
|
||
| public void setRemoved(Date removed) { | ||
| this.removed = removed; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (!(obj instanceof DiskControllerMappingVO)) { | ||
| return false; | ||
| } | ||
| DiskControllerMappingVO that = (DiskControllerMappingVO) obj; | ||
| return controllerReference.equals(that.getControllerReference()); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return controllerReference.hashCode(); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "name", "controllerReference", | ||
| "busName", "hypervisor", "maxDeviceCount", "maxControllerCount", "vmdkAdapterType", "minHardwareVersion"); | ||
| } | ||
| } | ||
29 changes: 29 additions & 0 deletions
29
engine/schema/src/main/java/org/apache/cloudstack/storage/dao/DiskControllerMappingDao.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } |
57 changes: 57 additions & 0 deletions
57
.../schema/src/main/java/org/apache/cloudstack/storage/dao/DiskControllerMappingDaoImpl.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } | ||
|
|
||
| @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); | ||
| } | ||
|
|
||
| @Override | ||
| public List<DiskControllerMappingVO> listForHypervisor(HypervisorType hypervisor) { | ||
| SearchCriteria<DiskControllerMappingVO> sc = diskControllerMappingSearch.create(); | ||
| sc.setParameters("hypervisor", hypervisor); | ||
| return listBy(sc); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.