Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ install_artifacts:
install -dm 0755 "$(DESTDIR)$(PKG_JBOSS_MODULES)/$${category}"; \
find "$(MAVEN_OUTPUT_DIR)" -name '*'"-$${category}-modules.zip" | grep -v tmp.repos | xargs -r -n 1 unzip -q -o -d "$(DESTDIR)$(PKG_JBOSS_MODULES)/$${category}"; \
done
rm -rf "$(DESTDIR)$(PKG_EAR_DIR)"
install -dm 0755 "$(DESTDIR)$(PKG_EAR_DIR)"
find "$(MAVEN_OUTPUT_DIR)" -name '*.ear' -type f | grep -v tmp.repos | xargs -n 1 unzip -q -o -d "$(DESTDIR)$(PKG_EAR_DIR)"
install -dm 0755 "$(DESTDIR)$(DATA_DIR)/restapi.war"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ public ValidationResult setAndValidateDiskProfiles(Map<DiskImage, Guid> map, DbU
diskProfilesList = diskProfileDao.getAllForStorageDomain(storageDomainId);
storageDiskProfilesMap.put(storageDomainId, diskProfilesList);
}
// No disk profiles for this domain (e.g. managed block storage) - leave diskProfileId null.
if (diskProfilesList.isEmpty()) {
continue;
}
// Set Disk Profile according to permissions
if (!updateDiskProfileForBackwardCompatibility(diskImage,
diskProfilesList,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,11 @@ protected void executeVmCommand() {
switch (getParameters().getDiskInfo().getDiskStorageType()) {
case IMAGE:
case KUBERNETES:
createDiskBasedOnImage();
if (getStorageDomain() != null && StorageType.MANAGED_BLOCK_STORAGE.equals(getStorageDomain().getStorageType())) {
createManagedBlockStorageDisk();
} else {
createDiskBasedOnImage();
}
break;
case LUN:
createDiskBasedOnLun();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ protected void childCommandsExecutionEnded(CommandBase<?> command,
}

DiskImage diskImage = (DiskImage) addDiskCommand.getParameters().getDiskInfo();
// Skip VDSM volume-info path when storageIds is not set (e.g. MBS upload: disk created via
// AddManagedBlockStorageDisk while getChildActionType() is AddImageFromScratch due to IMAGE disk type).
if (diskImage.getStorageIds() == null || diskImage.getStorageIds().isEmpty()) {
super.childCommandsExecutionEnded(command, anyFailed, childCmdIds, status, completedChildren);
return;
}

log.info("Getting volume info for image '{}/{}'", diskImage.getId(), diskImage.getImageId());
try {
DiskImage fromVdsm = imagesHandler.getVolumeInfoFromVdsm(diskImage.getStoragePoolId(),
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.ovirt.engine.core.bll.utils.VmDeviceUtils;
import org.ovirt.engine.core.common.VdcObjectType;
import org.ovirt.engine.core.common.action.AddManagedBlockStorageDiskParameters;
import org.ovirt.engine.core.common.businessentities.StorageDomain;
import org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap;
import org.ovirt.engine.core.common.businessentities.SubjectEntity;
import org.ovirt.engine.core.common.businessentities.VmDevice;
import org.ovirt.engine.core.common.businessentities.storage.DiskVmElement;
Expand All @@ -37,6 +39,8 @@
import org.ovirt.engine.core.dao.DiskVmElementDao;
import org.ovirt.engine.core.dao.ImageDao;
import org.ovirt.engine.core.dao.ManagedBlockStorageDao;
import org.ovirt.engine.core.dao.StorageDomainDao;
import org.ovirt.engine.core.dao.StoragePoolIsoMapDao;
import org.ovirt.engine.core.utils.JsonHelper;
import org.ovirt.engine.core.utils.transaction.TransactionSupport;

Expand Down Expand Up @@ -66,6 +70,12 @@ public class AddManagedBlockStorageDiskCommand<T extends AddManagedBlockStorageD
@Inject
private VmDeviceUtils vmDeviceUtils;

@Inject
private StorageDomainDao storageDomainDao;

@Inject
private StoragePoolIsoMapDao storagePoolIsoMapDao;

public AddManagedBlockStorageDiskCommand(Guid commandId) {
super(commandId);
}
Expand Down Expand Up @@ -158,6 +168,23 @@ private ManagedBlockStorageDisk createDisk() {
disk.setDiskDescription(getParameters().getDiskInfo().getDiskDescription());
disk.setShareable(getParameters().getDiskInfo().isShareable());
disk.setStorageIds(new ArrayList<>(Arrays.asList(getParameters().getStorageDomainId())));

Guid storagePoolId = null;
StorageDomain storageDomain =
storageDomainDao.get(getParameters().getStorageDomainId());
if (storageDomain != null) {
storagePoolId = storageDomain.getStoragePoolId();
}
if (storagePoolId == null) {
List<StoragePoolIsoMap> maps =
storagePoolIsoMapDao.getAllForStorage(getParameters().getStorageDomainId());
if (!maps.isEmpty() && maps.get(0).getStoragePoolId() != null) {
storagePoolId = maps.get(0).getStoragePoolId();
}
}
if (storagePoolId != null) {
disk.setStoragePoolId(storagePoolId);
}
disk.setVolumeType(VolumeType.Unassigned);
disk.setVolumeFormat(VolumeFormat.RAW);
disk.setImageStatus(ImageStatus.OK);
Expand Down
Loading