use of org.ovirt.engine.core.common.businessentities.storage.CinderVolumeDriver in project ovirt-engine by oVirt.
the class CinderBroker method updateConnectionInfoForDisk.
public void updateConnectionInfoForDisk(CinderDisk cinderDisk) {
try {
CinderConnectionInfo connectionInfo = initializeConnectionForDisk(cinderDisk);
CinderVolumeDriver cinderVolumeDriver = CinderVolumeDriver.forValue(connectionInfo.getDriverVolumeType());
if (cinderVolumeDriver == null) {
logDiskEvent(cinderDisk, AuditLogType.CINDER_DISK_CONNECTION_VOLUME_DRIVER_UNSUPPORTED);
}
cinderDisk.setCinderConnectionInfo(connectionInfo);
} catch (OpenStackResponseException ex) {
logDiskEvent(cinderDisk, AuditLogType.CINDER_DISK_CONNECTION_FAILURE);
throw ex;
}
}
use of org.ovirt.engine.core.common.businessentities.storage.CinderVolumeDriver in project ovirt-engine by oVirt.
the class VmInfoBuildUtils method buildCinderDisk.
@SuppressWarnings("unchecked")
public void buildCinderDisk(CinderDisk cinderDisk, Map<String, Object> struct) {
CinderConnectionInfo connectionInfo = cinderDisk.getCinderConnectionInfo();
CinderVolumeDriver cinderVolumeDriver = CinderVolumeDriver.forValue(connectionInfo.getDriverVolumeType());
if (cinderVolumeDriver == null) {
log.error("Unsupported Cinder volume driver: '{}' (disk: '{}')", connectionInfo.getDriverVolumeType(), cinderDisk.getDiskAlias());
return;
}
switch(cinderVolumeDriver) {
case RBD:
Map<String, Object> connectionInfoData = cinderDisk.getCinderConnectionInfo().getData();
struct.put(VdsProperties.Path, connectionInfoData.get("name"));
struct.put(VdsProperties.Format, VolumeFormat.RAW.toString().toLowerCase());
struct.put(VdsProperties.PropagateErrors, PropagateErrors.Off.toString().toLowerCase());
struct.put(VdsProperties.Protocol, cinderDisk.getCinderConnectionInfo().getDriverVolumeType());
struct.put(VdsProperties.DiskType, VdsProperties.NETWORK);
List<String> hostAddresses = (ArrayList<String>) connectionInfoData.get("hosts");
List<String> hostPorts = (ArrayList<String>) connectionInfoData.get("ports");
List<Map<String, Object>> hosts = new ArrayList<>();
// (Cinder should ensure that the addresses and ports lists are synced in order).
for (int i = 0; i < hostAddresses.size(); i++) {
Map<String, Object> hostMap = new HashMap<>();
hostMap.put(VdsProperties.NetworkDiskName, hostAddresses.get(i));
hostMap.put(VdsProperties.NetworkDiskPort, hostPorts.get(i));
hostMap.put(VdsProperties.NetworkDiskTransport, VdsProperties.Tcp);
hosts.add(hostMap);
}
struct.put(VdsProperties.NetworkDiskHosts, hosts);
boolean authEnabled = (boolean) connectionInfoData.get(VdsProperties.CinderAuthEnabled);
String secretType = (String) connectionInfoData.get(VdsProperties.CinderSecretType);
String authUsername = (String) connectionInfoData.get(VdsProperties.CinderAuthUsername);
String secretUuid = (String) connectionInfoData.get(VdsProperties.CinderSecretUuid);
if (authEnabled) {
Map<String, Object> authMap = new HashMap<>();
authMap.put(VdsProperties.NetworkDiskAuthSecretType, secretType);
authMap.put(VdsProperties.NetworkDiskAuthUsername, authUsername);
authMap.put(VdsProperties.NetworkDiskAuthSecretUuid, secretUuid);
struct.put(VdsProperties.NetworkDiskAuth, authMap);
}
break;
}
}
Aggregations