Exemple #1
0
 /** Returns array of volume group checkboxes. */
 private Map<String, JCheckBox> getPVCheckBoxes(final Set<String> selectedPVs) {
   final Map<String, JCheckBox> components = new LinkedHashMap<String, JCheckBox>();
   for (final BlockDevice pv : host.getPhysicalVolumes()) {
     final String pvName = pv.getName();
     final JCheckBox button = new JCheckBox(pvName, selectedPVs.contains(pvName));
     button.setBackground(Tools.getDefaultColor("ConfigDialog.Background.Light"));
     components.put(pvName, button);
   }
   return components;
 }
Exemple #2
0
 /** Returns true if the specified host has specified PVs without VGs. */
 private boolean hostHasPVS(final Host host) {
   final Map<String, BlockDevice> oPVS = new HashMap<String, BlockDevice>();
   for (final BlockDevice bd : host.getPhysicalVolumes()) {
     oPVS.put(bd.getName(), bd);
   }
   final Set<String> pvs = pvCheckBoxes.keySet();
   int selected = 0;
   for (final String pv : pvs) {
     if (!pvCheckBoxes.get(pv).isSelected()) {
       continue;
     }
     selected++;
     final BlockDevice opv = oPVS.get(pv);
     if (opv == null) {
       return false;
     }
     if (!opv.isPhysicalVolume() || opv.isVolumeGroupOnPhysicalVolume()) {
       return false;
     }
   }
   return selected > 0;
 }