コード例 #1
0
ファイル: VGCreate.java プロジェクト: rdndnl/lcmc
 @Override
 public void run() {
   Tools.invokeAndWait(new EnableCreateRunnable(false));
   disableComponents();
   getProgressBar().start(CREATE_TIMEOUT * hostCheckBoxes.size());
   boolean oneFailed = false;
   for (final Host h : hostCheckBoxes.keySet()) {
     if (hostCheckBoxes.get(h).isSelected()) {
       final List<String> pvNames = new ArrayList<String>();
       for (final String pv : pvCheckBoxes.keySet()) {
         if (pvCheckBoxes.get(pv).isSelected()) {
           pvNames.add(pv);
         }
       }
       final boolean ret = vgCreate(h, vgNameWi.getStringValue(), pvNames);
       if (!ret) {
         oneFailed = true;
       }
     }
   }
   enableComponents();
   if (oneFailed) {
     for (final Host h : hostCheckBoxes.keySet()) {
       h.getBrowser().getClusterBrowser().updateHWInfo(h);
     }
     checkButtons();
     progressBarDoneError();
   } else {
     progressBarDone();
     disposeDialog();
     for (final Host h : hostCheckBoxes.keySet()) {
       h.getBrowser().getClusterBrowser().updateHWInfo(h);
     }
   }
 }
コード例 #2
0
ファイル: VMSDiskInfo.java プロジェクト: rdndnl/lcmc
 /** Returns possible choices for drop down lists. */
 @Override
 protected Object[] getParamPossibleChoices(final String param) {
   if (DiskData.SOURCE_FILE.equals(param)) {
     final Set<String> sourceFileDirs = new TreeSet<String>();
     sourceFileDirs.add(LIBVIRT_IMAGE_LOCATION);
     for (final Host h : getVMSVirtualDomainInfo().getDefinedOnHosts()) {
       final VMSXML vmsxml = getBrowser().getVMSXML(h);
       if (vmsxml != null) {
         sourceFileDirs.addAll(vmsxml.getsourceFileDirs());
       }
     }
     return sourceFileDirs.toArray(new String[sourceFileDirs.size()]);
   } else if (DiskData.SOURCE_DEVICE.equals(param)) {
     for (final Host h : getVMSVirtualDomainInfo().getDefinedOnHosts()) {
       final VMSXML vmsxml = getBrowser().getVMSXML(h);
       final List<String> bds = new ArrayList<String>();
       bds.add(null);
       if (vmsxml != null) {
         for (final BlockDevInfo bdi : h.getBrowser().getBlockDevInfos()) {
           if (bdi.getBlockDevice().isDrbd()) {
             bds.add(bdi.getDrbdVolumeInfo().getDeviceByRes());
           } else {
             bds.add(bdi.getName());
           }
         }
         return bds.toArray(new String[bds.size()]);
       }
     }
   }
   return POSSIBLE_VALUES.get(param);
 }
コード例 #3
0
ファイル: VGCreate.java プロジェクト: rdndnl/lcmc
 /** Create VG. */
 private boolean vgCreate(final Host host, final String vgName, final List<String> pvNames) {
   for (final String pv : pvNames) {
     final BlockDevInfo bdi =
         host.getBrowser().getDrbdGraph().findBlockDevInfo(host.getName(), pv);
     if (bdi != null) {
       bdi.getBlockDevice().setVolumeGroupOnPhysicalVolume(vgName);
       bdi.getBrowser().getDrbdGraph().startAnimation(bdi);
     }
   }
   final boolean ret = LVM.vgCreate(host, vgName, pvNames, false);
   if (ret) {
     answerPaneAddText(
         "Volume group " + vgName + " was successfully created " + " on " + host.getName() + ".");
   } else {
     answerPaneAddTextError("Creating of volume group " + vgName + " failed.");
   }
   return ret;
 }