Skip to content

Commit

Permalink
webadmin: fix error when changing cluster of diskless vms
Browse files Browse the repository at this point in the history
DisksAllocationView#addDiskList wasn't prepared for getting a model
without disks and since 50e0bb9 this might happen, therefore
proper handling (treating this case as if an empty list of disks is
set) is added to DisksAllocationView#addDiskList.

Bug-Url: https://bugzilla.redhat.com/2121083
Signed-off-by: Arik Hadas <ahadas@redhat.com>
  • Loading branch information
ahadas committed Sep 5, 2022
1 parent 81422ee commit 28c4b8b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ovirt.engine.ui.common.widget.uicommon.storage;

import java.util.ArrayList;
import java.util.List;

import org.ovirt.engine.ui.common.CommonApplicationConstants;
import org.ovirt.engine.ui.common.PopupSimpleTableResources;
Expand Down Expand Up @@ -189,11 +190,15 @@ private void initListeners(final DisksAllocationModel model) {

void addDiskList(DisksAllocationModel model) {
diskListPanel.clear();
diskAllocationLabel.setVisible(!model.getDisks().isEmpty());
List<DiskModel> disks = model.getDisks();
if (disks == null) {
disks = new ArrayList<>();
}
diskAllocationLabel.setVisible(!disks.isEmpty());

int diskIndex = 0;
String columnWidth = calculateColumnWidthPercentage();
for (final DiskModel diskModel : model.getDisks()) {
for (final DiskModel diskModel : disks) {
DisksAllocationItemView disksAllocationItemView = new DisksAllocationItemView(columnWidth);
disksAllocationItemView.edit(diskModel);
disksAllocationItemView.setIsAliasChangeable(model.getIsAliasChangeable());
Expand Down

0 comments on commit 28c4b8b

Please sign in to comment.