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 sets (i.e., 'disks' is null) 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 11, 2022
1 parent 153e96f commit e1370f6
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.ovirt.engine.ui.common.widget.uicommon.storage;

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

import org.ovirt.engine.ui.common.CommonApplicationConstants;
import org.ovirt.engine.ui.common.PopupSimpleTableResources;
Expand Down Expand Up @@ -189,11 +191,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 = Collections.emptyList();
}
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 e1370f6

Please sign in to comment.