Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f834504
Disk controller mappings
winterhazel Jan 29, 2025
5459efe
Merge branch 'main' into disk-controller-mappings
winterhazel Feb 24, 2025
ad7ca02
Fix merge errors
winterhazel Feb 24, 2025
de794a0
Merge branch 'main' into disk-controller-mappings
winterhazel Feb 26, 2025
7476f60
Merge branch 'main' into disk-controller-mappings
winterhazel Jun 4, 2025
f3f7aa3
Merge branch 'main' into disk-controller-mappings
winterhazel Jul 8, 2025
d13c92a
Update server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
winterhazel Jul 8, 2025
a0f9c55
Add log
winterhazel Jul 8, 2025
1913e53
Merge branch 'main' into disk-controller-mappings
winterhazel Jul 30, 2025
bb819b6
Add comment explaining a section
winterhazel Jul 30, 2025
cd77162
Merge branch 'main' into disk-controller-mappings
winterhazel Aug 7, 2025
991af0a
Merge branch 'main' into disk-controller-mappings
winterhazel Sep 2, 2025
d983a7d
Merge branch 'main' into disk-controller-mappings
winterhazel Sep 3, 2025
6424403
Merge branch 'main' into disk-controller-mappings
winterhazel Oct 8, 2025
7b8069b
Fix checkstyle
winterhazel Oct 9, 2025
188be60
add missing class
winterhazel Oct 9, 2025
8984f68
Merge branch 'main' into disk-controller-mappings (& move to 4.23)
winterhazel Dec 13, 2025
352bbca
Merge branch 'main' into disk-controller-mappings
winterhazel Dec 26, 2025
6edb407
Merge remote-tracking branch 'upstream/main' into disk-controller-map…
winterhazel Jan 29, 2026
f013bab
Merge remote-tracking branch 'upstream/main' into disk-controller-map…
winterhazel Mar 29, 2026
bb64294
Merge remote-tracking branch 'upstream/main' into disk-controller-map…
winterhazel Mar 31, 2026
adce7af
Address Copilot reviews
winterhazel Mar 31, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Expand Up @@ -20,13 +20,18 @@
package com.cloud.agent.api;

import com.cloud.agent.api.LogLevel.Log4jLevel;
import org.apache.cloudstack.storage.DiskControllerMappingVO;

import java.util.List;

public class SecStorageVMSetupCommand extends Command {
String[] allowedInternalSites = new String[0];
String copyUserName;
@LogLevel(Log4jLevel.Off)
String copyPassword;

private List<DiskControllerMappingVO> supportedDiskControllers;

public SecStorageVMSetupCommand() {
super();
}
Expand Down Expand Up @@ -60,4 +65,11 @@ public void setCopyPassword(String copyPassword) {
this.copyPassword = copyPassword;
}

public List<DiskControllerMappingVO> getSupportedDiskControllers() {
return supportedDiskControllers;
}

public void setSupportedDiskControllers(List<DiskControllerMappingVO> supportedDiskControllers) {
this.supportedDiskControllers = supportedDiskControllers;
}
}
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");
}
}
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();
}

@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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<bean id="dataCenterJoinDaoImpl" class="com.cloud.api.query.dao.DataCenterJoinDaoImpl" />
<bean id="domainVlanMapDaoImpl" class="com.cloud.dc.dao.DomainVlanMapDaoImpl" />
<bean id="engineDcDetailsDaoImpl" class="org.apache.cloudstack.engine.datacenter.entity.api.db.dao.DcDetailsDaoImpl" />
<bean id="diskControllerMappingDaoImpl" class="org.apache.cloudstack.storage.dao.DiskControllerMappingDaoImpl" />
<bean id="diskOfferingJoinDaoImpl" class="com.cloud.api.query.dao.DiskOfferingJoinDaoImpl" />
<bean id="domainDaoImpl" class="com.cloud.domain.dao.DomainDaoImpl" />
<bean id="domainDetailsDaoImpl" class="com.cloud.domain.dao.DomainDetailsDaoImpl" />
Expand Down
Loading
Loading