[PC-BSD Commits] r16313 - pcbsd/current/src-qt4/pc-installgui

svn at pcbsd.org svn at pcbsd.org
Tue Apr 10 09:17:33 PDT 2012


Author: kris
Date: 2012-04-10 16:17:32 +0000 (Tue, 10 Apr 2012)
New Revision: 16313

Modified:
   pcbsd/current/src-qt4/pc-installgui/installer.cpp
   pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp
   pcbsd/current/src-qt4/pc-installgui/wizardDisk.h
   pcbsd/current/src-qt4/pc-installgui/wizardDisk.ui
Log:

Add new page to disk wizard in Advanced mode. Now when we specify ZFS,
we are given options page to enable mirror,raid1z, raid2z and raid3z
at install time. 



Modified: pcbsd/current/src-qt4/pc-installgui/installer.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/installer.cpp	2012-04-10 15:44:40 UTC (rev 16312)
+++ pcbsd/current/src-qt4/pc-installgui/installer.cpp	2012-04-10 16:17:32 UTC (rev 16313)
@@ -323,6 +323,9 @@
           summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
           summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
           summaryList << tr("Mount:") + " " + copyList.at(i).at(2);
+          if ( ! XtraTmp.isEmpty() ) {
+            summaryList << tr("Options:") + " " + copyList.at(i).at(5);
+          }
 
           // Done with this item, remove it now
           copyList.removeAt(i);
@@ -374,6 +377,9 @@
         summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
         summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
         summaryList << tr("Mount:") + " " + copyList.at(i).at(2);
+        if ( ! XtraTmp.isEmpty() ) {
+          summaryList << tr("Options:") + " " + copyList.at(i).at(5);
+        }
 
         // Done with this item, remove it now
         copyList.removeAt(i);

Modified: pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp	2012-04-10 15:44:40 UTC (rev 16312)
+++ pcbsd/current/src-qt4/pc-installgui/wizardDisk.cpp	2012-04-10 16:17:32 UTC (rev 16313)
@@ -37,6 +37,13 @@
   connect(treeMounts,SIGNAL(customContextMenuRequested(const QPoint &)),this,SLOT(slotTreeMountsRightClick()));
   connect(pushTerminal, SIGNAL(clicked()), this, SLOT(slotTerminal()));
 
+  // ZFS Mode Page
+  connect(comboZFSMode,SIGNAL(currentIndexChanged(int)),this,SLOT(slotCheckComplete()));
+  connect(groupZFSOpts,SIGNAL(clicked(bool)),this,SLOT(slotCheckComplete()));
+  connect(listZFSDisks,SIGNAL(itemClicked(QListWidgetItem *)),this,SLOT(slotCheckComplete()));
+  connect(listZFSDisks,SIGNAL(itemActivated(QListWidgetItem *)),this,SLOT(slotCheckComplete()));
+  connect(listZFSDisks,SIGNAL(itemChanged(QListWidgetItem *)),this,SLOT(slotCheckComplete()));
+
   // Set the suggested FileSystem
   systemMemory = Scripts::Backend::systemMemory();
   if ( systemMemory > 4028 )
@@ -114,6 +121,11 @@
        if (radioBasic->isChecked())
          return Page_Confirmation;
        break;
+     case Page_FS:
+       if (radioZFS->isChecked() )
+         return Page_ZFS;
+       return Page_Mounts;
+       break;
      case Page_Mounts:
        return Page_Confirmation;
        break;
@@ -134,7 +146,16 @@
     generateDiskLayout();
     populateDiskTree();
   }
+  // Generate suggested disk layout and show disk tree
+  if ( prevID == Page_ZFS && currentId() == Page_Mounts) {
+    generateDiskLayout();
+    populateDiskTree();
+  }
 
+  // Show the other disks available
+  if ( prevID == Page_FS && currentId() == Page_ZFS)
+     populateZFSDisks();
+
   // Basic mode, generate a disk layout and show summary
   if ( prevID == Page_BasicEnc && currentId() == Page_Confirmation) {
     generateDiskLayout();
@@ -181,6 +202,60 @@
          }
          button(QWizard::NextButton)->setEnabled(true);
          return true;
+     case Page_ZFS:
+         // Check if we have valid ZFS disk options specified
+	 if ( ! groupZFSOpts->isChecked() ) {
+           button(QWizard::NextButton)->setEnabled(true);
+	   return true;
+	 }
+         // Need at least one other disk for mirroring
+	 if ( comboZFSMode->currentText() == "mirror" ) {
+            labelZFSMsg->setText(tr("Please select at least 1 other drive for mirroring"));
+	    for ( int i = 0; i < listZFSDisks->count(); ++i )
+            {
+		if ( listZFSDisks->item(i)->checkState() == Qt::Checked ) {
+                   button(QWizard::NextButton)->setEnabled(true);
+	           return true;
+                }
+            }
+         }
+	 if ( comboZFSMode->currentText() == "raidz1" ) {
+            labelZFSMsg->setText(tr("Please select at least 2 other drives for raidz1"));
+	    int numChecked = 0;
+	    for ( int i = 0; i < listZFSDisks->count(); ++i )
+		if ( listZFSDisks->item(i)->checkState() == Qt::Checked )
+		   numChecked++;
+            if ( numChecked >= 2 ) {
+              button(QWizard::NextButton)->setEnabled(true);
+	      return true;
+            }
+         }
+	 if ( comboZFSMode->currentText() == "raidz2" ) {
+            labelZFSMsg->setText(tr("Please select at least 5 other drives for raidz2"));
+	    int numChecked = 0;
+	    for ( int i = 0; i < listZFSDisks->count(); ++i )
+		if ( listZFSDisks->item(i)->checkState() == Qt::Checked )
+		   numChecked++;
+            if ( numChecked >= 5 ) {
+              button(QWizard::NextButton)->setEnabled(true);
+	      return true;
+            }
+         }
+	 if ( comboZFSMode->currentText() == "raidz3" ) {
+            labelZFSMsg->setText(tr("Please select at least 8 other drives for raidz3"));
+	    int numChecked = 0;
+	    for ( int i = 0; i < listZFSDisks->count(); ++i )
+		if ( listZFSDisks->item(i)->checkState() == Qt::Checked )
+		   numChecked++;
+            if ( numChecked >= 8 ) {
+              button(QWizard::NextButton)->setEnabled(true);
+	      return true;
+            }
+         }
+
+         // Disable the next button until we get a working config
+         button(QWizard::NextButton)->setEnabled(false);
+         return false;
      case Page_Confirmation:
          button(QWizard::FinishButton)->setEnabled(true);
          return true;
@@ -192,6 +267,23 @@
   return true;
 }
 
+void wizardDisk::populateZFSDisks()
+{
+   qDebug() << "Adding ZFS disks...";
+   listZFSDisks->clear();
+
+   QString curDisk = comboDisk->currentText();
+   curDisk.truncate(curDisk.indexOf(" -"));
+
+   for (int z=0; z < sysDisks.count(); ++z)
+     if ( sysDisks.at(z).at(0) == "DRIVE" && sysDisks.at(z).at(1) != curDisk  )
+     {
+        QListWidgetItem *dItem = new QListWidgetItem(sysDisks.at(z).at(1) + " - " + sysDisks.at(z).at(2) + "MB " + sysDisks.at(z).at(3));
+        dItem->setCheckState(Qt::Unchecked);
+        listZFSDisks->addItem(dItem);
+     }
+}
+
 bool wizardDisk::checkDiskSpace()
 {
   if ( getDiskSliceSize() < 10000 )
@@ -742,8 +834,22 @@
       else
         zMnts << mItems.at(i)->text(1) + "(" + mItems.at(i)->text(2) + ")";
     }
+
+    // If we have any additional ZFS mirror / raidz devices set it up now
+    QString zOpts, zDisk;
+    if ( groupZFSOpts->isChecked() ) {
+       zOpts = comboZFSMode->currentText() + ":";
+       for ( int i = 0; i < listZFSDisks->count(); ++i )
+          if ( listZFSDisks->item(i)->checkState() == Qt::Checked ) {
+             zDisk = listZFSDisks->item(i)->text();
+             zDisk.truncate(zDisk.indexOf(" -"));
+	     zOpts = zOpts + " " + zDisk;
+          }
+    }
+
+    // Save the final disk layout
     fileSystem.clear();
-    fileSystem << targetDisk << targetSlice << zMnts.join(",") << "ZFS" << tmp.setNum(zpoolSize) << "" << tmpPass;
+    fileSystem << targetDisk << targetSlice << zMnts.join(",") << "ZFS" << tmp.setNum(zpoolSize) << zOpts << tmpPass;
     sysFinalDiskLayout << fileSystem;
   }
 
@@ -834,6 +940,9 @@
           summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
           summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
           summaryList << tr("Mount:") + " " + copyList.at(i).at(2);
+	  if ( ! XtraTmp.isEmpty() ) {
+            summaryList << tr("Options:") + " " + copyList.at(i).at(5);
+          }
 
           // Done with this item, remove it now
           copyList.removeAt(i);
@@ -885,6 +994,9 @@
         summaryList << tr("FileSystem:") + " " + copyList.at(i).at(3);
         summaryList << tr("Size:") + " " + copyList.at(i).at(4) + "MB ";
         summaryList << tr("Mount:") + " " + copyList.at(i).at(2);
+	if ( ! XtraTmp.isEmpty() ) {
+          summaryList << tr("Options:") + " " + copyList.at(i).at(5);
+        }
 
         // Done with this item, remove it now
         copyList.removeAt(i);

Modified: pcbsd/current/src-qt4/pc-installgui/wizardDisk.h
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/wizardDisk.h	2012-04-10 15:44:40 UTC (rev 16312)
+++ pcbsd/current/src-qt4/pc-installgui/wizardDisk.h	2012-04-10 16:17:32 UTC (rev 16313)
@@ -48,6 +48,7 @@
 private:
     void populateDiskInfo();
     void populateDiskTree();
+    void populateZFSDisks();
     void generateDiskLayout();
     void generateCustomDiskLayout();
     void generateConfirmationText();
@@ -64,7 +65,7 @@
 
     QMenu *popup;
     dialogFSSize *rFS;
-    enum { Page_Intro, Page_BasicDisk, Page_BasicEnc, Page_FS, Page_Mounts, Page_Expert, Page_Confirmation };
+    enum { Page_Intro, Page_BasicDisk, Page_BasicEnc, Page_FS, Page_ZFS, Page_Mounts, Page_Expert, Page_Confirmation };
 
 signals:
     void saved(QList<QStringList>, bool, bool);

Modified: pcbsd/current/src-qt4/pc-installgui/wizardDisk.ui
===================================================================
(Binary files differ)



More information about the Commits mailing list