Ignore:
Timestamp:
Jun 18, 2013 9:37:39 AM (10 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
1421110
Parents:
ea6d5ac
Message:

Cleanup disk wizard, long live ZFS!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-installgui/wizardDisk.cpp

    rd63d157 rda366a8  
    2727  connect(pushAddMount, SIGNAL(clicked()), this, SLOT(slotAddFS())); 
    2828  connect(this,SIGNAL(currentIdChanged(int)),this,SLOT(slotCheckComplete())); 
    29   connect(lineEncPW,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete())); 
    30   connect(lineEncPW2,SIGNAL(textChanged(const QString)),this,SLOT(slotCheckComplete())); 
    3129  connect(comboDisk,SIGNAL(currentIndexChanged(int)),this,SLOT(slotCheckComplete())); 
    3230  connect(comboDisk,SIGNAL(currentIndexChanged(int)),this,SLOT(slotChangedDisk())); 
    3331  connect(comboPartition,SIGNAL(currentIndexChanged(int)),this,SLOT(slotCheckComplete())); 
    34   connect(groupEncryption,SIGNAL(toggled(bool)),this,SLOT(slotCheckComplete())); 
    3532  connect(treeMounts,SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)),this,SLOT(slotTreeDiskChanged())); 
    3633  treeMounts->setContextMenuPolicy(Qt::CustomContextMenu); 
     
    4441  connect(listZFSDisks,SIGNAL(itemActivated(QListWidgetItem *)),this,SLOT(slotCheckComplete())); 
    4542  connect(listZFSDisks,SIGNAL(itemChanged(QListWidgetItem *)),this,SLOT(slotCheckComplete())); 
    46  
    47   // Get the system arch type 
    48   QProcess m; 
    49   m.start(QString("uname"), QStringList() << "-m"); 
    50   while(m.state() == QProcess::Starting || m.state() == QProcess::Running) { 
    51      m.waitForFinished(200); 
    52      QCoreApplication::processEvents(); 
    53   } 
    54   // Get output 
    55   QString Arch = m.readLine().simplified(); 
    56  
    57   // Set the suggested FileSystem 
    58   systemMemory = Scripts::Backend::systemMemory(); 
    59   if ( systemMemory > 2028 && Arch != "i386" ) 
    60     radioZFS->setChecked(true); 
    61   else 
    62     radioUFS->setChecked(true); 
    63    
    64   // If less than 768 MB, disable ZFS completely 
    65   if ( systemMemory < 768 ) 
    66     radioZFS->setEnabled(false); 
    6743 
    6844} 
     
    129105    emit saved(sysFinalDiskLayout, false, false); 
    130106  else 
    131     emit saved(sysFinalDiskLayout, checkMBR->isChecked(), useGPT); 
     107    emit saved(sysFinalDiskLayout, true, useGPT); 
    132108  close(); 
    133109} 
     
    146122     case Page_BasicDisk: 
    147123       if (radioBasic->isChecked()) 
    148          return Page_BasicEnc; 
    149        return Page_FS; 
    150        break; 
    151      case Page_FS: 
    152        if (radioZFS->isChecked() ) { 
    153          // Only enable ZFS mirror / raidz when doing full disk install 
    154          if (comboPartition->currentIndex() != 0 ) 
    155            groupZFSOpts->setEnabled(false); 
    156          else 
    157            groupZFSOpts->setEnabled(true); 
     124         return Page_Confirmation; 
     125       if (comboPartition->currentIndex() != 0 ) { 
     126         groupZFSOpts->setEnabled(false); 
     127         return Page_Mounts; 
     128       } else { 
     129         groupZFSOpts->setEnabled(true); 
    158130         return Page_ZFS; 
    159131       } 
    160        return Page_Mounts; 
    161132       break; 
    162133     case Page_ZFS: 
    163        // If we are using ZFS raidz / mirror, skip encryption 
    164        if ( groupZFSOpts->isChecked() ) 
    165           return Page_Mounts; 
    166        return Page_BasicEnc; 
    167        break; 
    168      case Page_BasicEnc: 
    169        if (radioBasic->isChecked()) 
    170          return Page_Confirmation; 
    171134       return Page_Mounts; 
    172135       break; 
     
    187150{ 
    188151  // Generate suggested disk layout and show disk tree 
    189   if ( prevID == Page_FS && currentId() == Page_Mounts) { 
     152  if ( prevID == Page_BasicDisk && currentId() == Page_Mounts) { 
    190153    generateDiskLayout(); 
    191154    populateDiskTree(); 
     
    198161  }  
    199162 
    200   // Generate suggested disk layout and show disk tree 
    201   if ( prevID == Page_BasicEnc && currentId() == Page_Mounts) { 
    202     generateDiskLayout(); 
    203     populateDiskTree(); 
    204   } 
    205  
    206163  // Show the other disks available 
    207   if ( prevID == Page_FS && currentId() == Page_ZFS) 
     164  if ( prevID == Page_BasicDisk && currentId() == Page_ZFS) 
    208165     populateZFSDisks(); 
    209166 
    210167  // Basic mode, generate a disk layout and show summary 
    211   if ( prevID == Page_BasicEnc && currentId() == Page_Confirmation) { 
     168  if ( prevID == Page_BasicDisk && currentId() == Page_Confirmation) { 
    212169    generateDiskLayout(); 
    213170    generateConfirmationText(); 
     
    248205         
    249206         // if we get this far, all the fields are filled in 
    250          button(QWizard::NextButton)->setEnabled(true); 
    251          return true; 
    252      case Page_BasicEnc: 
    253          if ( groupEncryption->isChecked() && (lineEncPW->text() != lineEncPW2->text() || lineEncPW->text().isEmpty()) ) { 
    254            button(QWizard::NextButton)->setEnabled(false); 
    255            return false; 
    256          } 
    257207         button(QWizard::NextButton)->setEnabled(true); 
    258208         return true; 
     
    357307{ 
    358308  QString targetType, tmp; 
    359   int targetLoc, totalSize = 0, mntsize; 
     309  int targetLoc, totalSize = 0; 
    360310  QString targetDisk, targetSlice, tmpPass, fsType, target; 
    361311 
     
    364314  QStringList fileSystem; 
    365315  qDebug() << "Generating disk layout"; 
    366  
    367   // If doing ZFS advanced setup, disable encryption 
    368   if ( groupZFSOpts->isChecked() ) 
    369     groupEncryption->setChecked(false); 
    370316 
    371317  if ( comboPartition->currentIndex() == 0) { 
     
    391337  if ( totalSize != -1 ) 
    392338  { 
    393      // We got a valid size for this disk / slice, lets generate the layout now 
    394      mntsize = 2048; 
    395  
    396      // This is set automatically if in basic mode 
    397      if ( radioUFS->isChecked() ) { 
    398  
    399        fsType="UFS+SUJ"; 
    400  
    401        fileSystem << targetDisk << targetSlice << "/" << fsType << tmp.setNum(mntsize) << "" << ""; 
    402        totalSize = totalSize - mntsize; 
    403        //qDebug() << "Auto-Gen FS:" <<  fileSystem; 
    404        sysFinalDiskLayout << fileSystem; 
    405        fileSystem.clear(); 
    406        
    407  
    408        // Figure out the swap size, try for 2xPhysMem first, fallback to 256 if not enough space 
    409        mntsize = systemMemory * 2; 
    410        if ( totalSize - mntsize < 3000 ) 
    411           mntsize = 256; 
    412  
    413        // Cap the swap size to 2GB 
    414        if ( mntsize > 2000 ) 
    415           mntsize = 2000; 
    416  
    417        fileSystem << targetDisk << targetSlice << "SWAP" << "SWAP" << tmp.setNum(mntsize) << "" << ""; 
    418        totalSize = totalSize - mntsize; 
    419        //qDebug() << "Auto-Gen FS:" <<  fileSystem; 
    420        sysFinalDiskLayout << fileSystem; 
    421        fileSystem.clear(); 
    422  
    423        // If less than 3GB, skip /var and leave on / 
    424        if ( totalSize > 3000 ) { 
    425          // Figure out the default size for /var if we are on FreeBSD / PC-BSD 
    426          mntsize = 2048; 
    427          fileSystem << targetDisk << targetSlice << "/var" << fsType << tmp.setNum(mntsize) << "" << ""; 
    428          totalSize = totalSize - mntsize; 
    429          //qDebug() << "Auto-Gen FS:" <<  fileSystem; 
    430          sysFinalDiskLayout << fileSystem; 
    431          fileSystem.clear(); 
    432        } 
    433  
    434        // See if using encryption for this partition 
    435        if ( groupEncryption->isChecked() ) { 
    436          fsType+= ".eli"; 
    437          tmpPass=lineEncPW->text(); 
    438        } 
    439  
    440        // Now use the rest of the disk / slice for /usr 
    441        fileSystem << targetDisk << targetSlice << "/usr" << fsType << tmp.setNum(totalSize) << "" << tmpPass; 
    442        sysFinalDiskLayout << fileSystem; 
    443        fileSystem.clear(); 
    444  
    445      } else { 
    446         // Using ZFS 
    447  
    448        // If encryption is enabled, we need a ufs /boot partition 
    449        if ( groupEncryption->isChecked() ) { 
    450          totalSize = totalSize - 2048; 
    451          fileSystem << targetDisk << targetSlice << "/boot" << "UFS+SUJ" << tmp.setNum(2048) << "" << ""; 
    452          sysFinalDiskLayout << fileSystem; 
    453          fileSystem.clear(); 
    454        } 
    455  
    456        // See if using encryption for this partition 
    457        if ( groupEncryption->isChecked() ) { 
    458          fsType= "ZFS.eli"; 
    459          tmpPass=lineEncPW->text(); 
    460        } else { 
    461          fsType= "ZFS"; 
    462        } 
    463  
    464        // This lets the user do nifty stuff like a mirror/raid post-install with a single zpool command 
    465        fileSystem << targetDisk << targetSlice << "/,/tmp(compress=lzjb),/usr(canmount=off),/usr/home,/usr/jails,/usr/obj(compress=lzjb),/usr/pbi,/usr/ports(compress=gzip),/usr/ports/distfiles(compress=off),/usr/src(compress=gzip),/var(canmount=off),/var/audit(compress=lzjb),/var/log(compress=gzip),/var/tmp(compress=lzjb)" << fsType << tmp.setNum(totalSize) << "" << tmpPass; 
    466        //qDebug() << "Auto-Gen FS:" <<  fileSystem; 
    467        sysFinalDiskLayout << fileSystem; 
    468        fileSystem.clear(); 
    469      } 
     339     fsType= "ZFS"; 
     340 
     341     // This lets the user do nifty stuff like a mirror/raid post-install with a single zpool command 
     342    fileSystem << targetDisk << targetSlice << "/,/tmp(compress=lzjb),/usr(canmount=off),/usr/home,/usr/jails,/usr/obj(compress=lzjb),/usr/pbi,/usr/ports(compress=gzip),/usr/ports/distfiles(compress=off),/usr/src(compress=gzip),/var(canmount=off),/var/audit(compress=lzjb),/var/log(compress=gzip),/var/tmp(compress=lzjb)" << fsType << tmp.setNum(totalSize) << "" << tmpPass; 
     343     //qDebug() << "Auto-Gen FS:" <<  fileSystem; 
     344     sysFinalDiskLayout << fileSystem; 
     345     fileSystem.clear(); 
    470346  } 
    471347   
     
    477353  QStringList tmpList, zMnts; 
    478354  QString tmp, opts; 
    479   int usedSpace = 0; 
    480   bool ok; 
    481  
    482   // If doing ZFS advanced setup, disable encryption 
    483   if ( groupZFSOpts->isChecked() ) 
    484     groupEncryption->setChecked(false); 
    485355 
    486356  treeMounts->clear(); 
    487   if (radioUFS->isChecked()) { 
    488     treeMounts->setHeaderLabels(QStringList() << "ID" << tr("Mount") << tr("Size") << tr("Type") << "Pass" ); 
    489     treeMounts->header()->setSectionHidden(4, true); 
    490     treeMounts->setColumnCount(5); 
    491     labelFreeSpace->setVisible(true); 
    492     lineFreeMB->setVisible(true); 
    493     pushSizeMount->setVisible(true); 
    494   } else { 
    495     treeMounts->setHeaderLabels(QStringList() << "ID" << tr("ZFS Mounts") << tr("ZFS Options") ); 
    496     treeMounts->setColumnCount(3); 
    497     labelFreeSpace->setVisible(false); 
    498     lineFreeMB->setVisible(false); 
    499     pushSizeMount->setVisible(false); 
    500   } 
     357  treeMounts->setHeaderLabels(QStringList() << "ID" << tr("ZFS Mounts") << tr("ZFS Options") ); 
     358  treeMounts->setColumnCount(3); 
     359  labelFreeSpace->setVisible(false); 
     360  lineFreeMB->setVisible(false); 
     361  pushSizeMount->setVisible(false); 
    501362 
    502363  treeMounts->header()->setSectionHidden(0, true); 
    503364  treeMounts->header()->setDefaultSectionSize(150); 
    504365 
    505   if (radioUFS->isChecked()) { 
    506     for (int i=0; i < sysFinalDiskLayout.count(); ++i) { 
    507       // Start adding the disk items to our tree widget 
    508       new QTreeWidgetItem(treeMounts, QStringList() << tmp.setNum(i) << sysFinalDiskLayout.at(i).at(2) << sysFinalDiskLayout.at(i).at(4) << sysFinalDiskLayout.at(i).at(3) << sysFinalDiskLayout.at(i).at(6)); 
    509       usedSpace = usedSpace +  sysFinalDiskLayout.at(i).at(4).toInt(&ok); 
    510     } 
    511      
    512     // Now lets show how much is free to play with 
    513     lineFreeMB->setText(QString().setNum(getDiskSliceSize() - usedSpace)); 
    514  
    515   } else { 
    516     // Show ZFS stuff 
    517  
    518     // If using encryption, skip the /boot UFS partition 
    519     if ( groupEncryption->isChecked()) 
    520       zMnts = sysFinalDiskLayout.at(1).at(2).split(","); 
    521     else 
    522       zMnts = sysFinalDiskLayout.at(0).at(2).split(","); 
    523  
    524     // Now loop through ZFS mounts 
    525     for (int i=0; i < zMnts.count(); ++i) { 
    526       tmpList.clear(); 
    527       opts = zMnts.at(i).section("(", 1, 1).section(")", 0, 0);  
    528       tmpList << tmp.setNum(i+1) << zMnts.at(i).split("(").at(0) << opts ; 
    529       QTreeWidgetItem *mItem = new QTreeWidgetItem(treeMounts, tmpList); 
    530       mItem->setToolTip(2, opts); 
    531     } 
     366 
     367  zMnts = sysFinalDiskLayout.at(0).at(2).split(","); 
     368 
     369  // Now loop through ZFS mounts 
     370  for (int i=0; i < zMnts.count(); ++i) { 
     371    tmpList.clear(); 
     372    opts = zMnts.at(i).section("(", 1, 1).section(")", 0, 0);  
     373    tmpList << tmp.setNum(i+1) << zMnts.at(i).split("(").at(0) << opts ; 
     374    QTreeWidgetItem *mItem = new QTreeWidgetItem(treeMounts, tmpList); 
     375    mItem->setToolTip(2, opts); 
    532376  } 
    533377 
     
    640484  treeMounts->setCurrentItem(treeMounts->findItems("0", Qt::MatchFixedString).at(0)); 
    641485 
    642   // If editing UFS, lets adjust the available size 
    643   if (radioUFS->isChecked()) { 
    644     bool ok; 
    645     QString tmp; 
    646     int fSize = rmItem->text(2).toInt(&ok); 
    647     int newAvailSize = lineFreeMB->text().toInt(&ok) + fSize;  
    648     lineFreeMB->setText(tmp.setNum(newAvailSize)); 
    649   } 
    650  
    651486  delete rmItem; 
    652487} 
     
    664499  // Sanity checks 
    665500  //////////////////////////////////////// 
    666   if (nMount == "/boot" && radioZFS->isChecked() && groupEncryption->isChecked() ) { 
    667       QMessageBox::critical(this, tr("Invalid Mount"), 
    668               tr("Cannot create /boot dataset on ZFS with encryption enabled!"), 
    669               QMessageBox::Ok, 
    670               QMessageBox::Ok); 
    671       return; 
    672   } 
    673501  if ( nMount.indexOf("/") != 0 ) { 
    674502      QMessageBox::critical(this, tr("Invalid Mount"), 
     
    688516  } 
    689517 
    690   if  ( radioUFS->isChecked() ) { 
    691     // Doing UFS mount, lets get a size from the user 
    692     addingMount = nMount; 
    693     int availSize = lineFreeMB->text().toInt(&ok);  
    694     rFS = new dialogFSSize(); 
    695     rFS->programInit(QString(tr("Specify a size for the mount") + " " + addingMount), 100, availSize, 100); 
    696     rFS->setWindowModality(Qt::ApplicationModal); 
    697     connect(rFS, SIGNAL(saved(int)), this, SLOT(slotSaveFSResize(int))); 
    698     rFS->show(); 
    699     rFS->raise(); 
    700   } else { 
    701     new QTreeWidgetItem(treeMounts, QStringList() << tmp.setNum(mItems.size() + 1) << nMount ); 
    702   } 
     518  new QTreeWidgetItem(treeMounts, QStringList() << tmp.setNum(mItems.size() + 1) << nMount ); 
    703519} 
    704520 
     
    756572  popup->addSeparator(); 
    757573 
    758   if  ( radioUFS->isChecked() ) { 
    759     // No options to change for / or /boot 
    760     if ( treeMounts->currentItem()->text(1) == "/" ) 
    761       return; 
    762     if ( treeMounts->currentItem()->text(1) == "/boot" ) 
    763       return; 
    764  
    765     if ( treeMounts->currentItem()->text(3).indexOf(".eli") != -1 ) 
    766       popup->addAction( tr("Disable Encryption"), this, SLOT(slotUEnc())); 
    767     else 
    768       popup->addAction( tr("Enable Encryption"), this, SLOT(slotUEnc())); 
    769  
    770     // End of UFS options 
    771   } else { 
    772     // No options to change for /swap 
    773     if ( treeMounts->currentItem()->text(1) == "/swap" ) { 
    774       popup->addAction( "Change size", this, SLOT(slotZSwapSize())); 
    775       popup->exec( QCursor::pos() ); 
    776       return; 
    777     } 
    778  
    779     // Create atime sub-menu 
    780     popupAT = popup->addMenu("atime"); 
    781     popupAT->addAction( "on", this, SLOT(slotZATON())); 
    782     popupAT->addAction( "off", this, SLOT(slotZATOFF())); 
    783  
    784     // Create canmount sub-menu 
    785     popupCM = popup->addMenu("canmount"); 
    786     popupCM->addAction( "on", this, SLOT(slotZCMON())); 
    787     popupCM->addAction( "off", this, SLOT(slotZCMOFF())); 
    788     popupCM->addAction( "noauto", this, SLOT(slotZCMNOAUTO())); 
    789  
    790     // Create Checksum sub-menu 
    791     popupCH = popup->addMenu("checksum"); 
    792     popupCH->addAction( "on", this, SLOT(slotZChkON())); 
    793     popupCH->addAction( "off", this, SLOT(slotZChkOFF())); 
    794  
    795     // Create compression sub-menu 
    796     popupCmp = popup->addMenu("compression"); 
    797     popupCmp->addAction( "off", this, SLOT(slotZCmpOFF())); 
    798     popupCmp->addAction( "lzjb", this, SLOT(slotZCmpLZJB())); 
    799     popupCmp->addAction( "gzip", this, SLOT(slotZCmpGZIP())); 
    800     popupCmp->addAction( "zle", this, SLOT(slotZCmpZLE())); 
    801  
    802     // Create dedup sub-menu 
    803     // dedup is disabled for now, until such time as it is safe in all cases 
    804     //popupDD = popup->addMenu("dedup"); 
    805     //popupDD->addAction( "off", this, SLOT(slotZDDOFF())); 
    806     //popupDD->addAction( "on", this, SLOT(slotZDDON())); 
    807     //popupDD->addAction( "verify", this, SLOT(slotZDDVERIFY())); 
    808  
    809     // Create exec sub-menu 
    810     popupNE = popup->addMenu("exec"); 
    811     popupNE->addAction( "on", this, SLOT(slotZEXON())); 
    812     popupNE->addAction( "off", this, SLOT(slotZEXOFF())); 
    813  
    814   } 
     574  // No options to change for /swap 
     575  if ( treeMounts->currentItem()->text(1) == "/swap" ) { 
     576    popup->addAction( "Change size", this, SLOT(slotZSwapSize())); 
     577    popup->exec( QCursor::pos() ); 
     578    return; 
     579  } 
     580 
     581  // Create atime sub-menu 
     582  popupAT = popup->addMenu("atime"); 
     583  popupAT->addAction( "on", this, SLOT(slotZATON())); 
     584  popupAT->addAction( "off", this, SLOT(slotZATOFF())); 
     585 
     586  // Create canmount sub-menu 
     587  popupCM = popup->addMenu("canmount"); 
     588  popupCM->addAction( "on", this, SLOT(slotZCMON())); 
     589  popupCM->addAction( "off", this, SLOT(slotZCMOFF())); 
     590  popupCM->addAction( "noauto", this, SLOT(slotZCMNOAUTO())); 
     591 
     592  // Create Checksum sub-menu 
     593  popupCH = popup->addMenu("checksum"); 
     594  popupCH->addAction( "on", this, SLOT(slotZChkON())); 
     595  popupCH->addAction( "off", this, SLOT(slotZChkOFF())); 
     596 
     597  // Create compression sub-menu 
     598  popupCmp = popup->addMenu("compression"); 
     599  popupCmp->addAction( "off", this, SLOT(slotZCmpOFF())); 
     600  popupCmp->addAction( "lzjb", this, SLOT(slotZCmpLZJB())); 
     601  popupCmp->addAction( "gzip", this, SLOT(slotZCmpGZIP())); 
     602  popupCmp->addAction( "zle", this, SLOT(slotZCmpZLE())); 
     603 
     604  // Create dedup sub-menu 
     605  // dedup is disabled for now, until such time as it is safe in all cases 
     606  //popupDD = popup->addMenu("dedup"); 
     607  //popupDD->addAction( "off", this, SLOT(slotZDDOFF())); 
     608  //popupDD->addAction( "on", this, SLOT(slotZDDON())); 
     609  //popupDD->addAction( "verify", this, SLOT(slotZDDVERIFY())); 
     610 
     611  // Create exec sub-menu 
     612  popupNE = popup->addMenu("exec"); 
     613  popupNE->addAction( "on", this, SLOT(slotZEXON())); 
     614  popupNE->addAction( "off", this, SLOT(slotZEXOFF())); 
     615 
    815616  popup->exec( QCursor::pos() ); 
    816617 
     
    955756  QString targetDisk, targetSlice, tmpPass, fsType, target; 
    956757 
    957   // If doing ZFS advanced setup, disable encryption 
    958   if ( groupZFSOpts->isChecked() ) 
    959     groupEncryption->setChecked(false); 
    960         
    961758  // Clear out the original disk layout 
    962759  sysFinalDiskLayout.clear(); 
     
    982779  } 
    983780 
    984   if (radioUFS->isChecked() ) 
    985   { 
    986     // Start building the UFS file-systems 
    987     QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard); 
    988     for ( int i = 0; i < mItems.size(); ++i) { 
    989       fileSystem.clear(); 
    990       fsType=mItems.at(i)->text(3); 
    991       if ( fsType.indexOf(".eli") != -1 && mItems.at(i)->text(1) != "SWAP" ) 
    992         tmpPass=mItems.at(i)->text(4); 
    993       else 
    994         tmpPass=""; 
    995  
    996       fileSystem << targetDisk << targetSlice << mItems.at(i)->text(1) << fsType << mItems.at(i)->text(2) << "" << tmpPass; 
    997       sysFinalDiskLayout << fileSystem; 
    998     } 
    999   } else { 
    1000     // Start building the ZFS file-systems 
    1001     QStringList zMnts; 
    1002     QString fsType = "ZFS"; 
    1003     int zpoolSize = getDiskSliceSize(); 
    1004  
    1005     // Check if we need a UFS /boot for encryption 
    1006     if ( groupEncryption->isChecked()) { 
    1007       fileSystem << targetDisk << targetSlice << "/boot" << "UFS+SUJ" << "2048" << "" << ""; 
    1008       sysFinalDiskLayout << fileSystem; 
    1009       zpoolSize = zpoolSize - 2048; 
    1010       fsType="ZFS.eli"; 
    1011       tmpPass=lineEncPW->text(); 
    1012     } 
    1013  
    1014     // Get the zfs mounts 
    1015     QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard); 
    1016     for ( int i = 0; i < mItems.size(); ++i) { 
    1017       if ( mItems.at(i)->text(2).isEmpty() ) 
    1018         zMnts << mItems.at(i)->text(1); 
    1019       else 
    1020         zMnts << mItems.at(i)->text(1) + "(" + mItems.at(i)->text(2) + ")"; 
    1021     } 
    1022  
    1023     // If we have any additional ZFS mirror / raidz devices set it up now 
    1024     QString zOpts, zDisk; 
    1025     if ( groupZFSOpts->isChecked() ) { 
    1026        zOpts = comboZFSMode->currentText() + ":"; 
    1027        for ( int i = 0; i < listZFSDisks->count(); ++i ) 
    1028           if ( listZFSDisks->item(i)->checkState() == Qt::Checked ) { 
    1029              zDisk = listZFSDisks->item(i)->text(); 
    1030              zDisk.truncate(zDisk.indexOf(" -")); 
    1031              zOpts = zOpts + " " + zDisk; 
    1032           } 
    1033     } 
    1034  
    1035     // Save the final disk layout 
    1036     fileSystem.clear(); 
    1037     fileSystem << targetDisk << targetSlice << zMnts.join(",") << fsType << tmp.setNum(zpoolSize) << zOpts << tmpPass; 
    1038     sysFinalDiskLayout << fileSystem; 
    1039   } 
     781  // Start building the ZFS file-systems 
     782  QStringList zMnts; 
     783  fsType = "ZFS"; 
     784  int zpoolSize = getDiskSliceSize(); 
     785 
     786  // Get the zfs mounts 
     787  QList<QTreeWidgetItem *> mItems = treeMounts->findItems("*", Qt::MatchWildcard); 
     788  for ( int i = 0; i < mItems.size(); ++i) { 
     789    if ( mItems.at(i)->text(2).isEmpty() ) 
     790      zMnts << mItems.at(i)->text(1); 
     791    else 
     792      zMnts << mItems.at(i)->text(1) + "(" + mItems.at(i)->text(2) + ")"; 
     793  } 
     794 
     795  // If we have any additional ZFS mirror / raidz devices set it up now 
     796  QString zOpts, zDisk; 
     797  if ( groupZFSOpts->isChecked() ) { 
     798     zOpts = comboZFSMode->currentText() + ":"; 
     799     for ( int i = 0; i < listZFSDisks->count(); ++i ) 
     800        if ( listZFSDisks->item(i)->checkState() == Qt::Checked ) { 
     801           zDisk = listZFSDisks->item(i)->text(); 
     802           zDisk.truncate(zDisk.indexOf(" -")); 
     803           zOpts = zOpts + " " + zDisk; 
     804        } 
     805  } 
     806 
     807  // Save the final disk layout 
     808  fileSystem.clear(); 
     809  fileSystem << targetDisk << targetSlice << zMnts.join(",") << fsType << tmp.setNum(zpoolSize) << zOpts << tmpPass; 
     810  sysFinalDiskLayout << fileSystem; 
    1040811 
    1041812  qDebug() <<"AutoLayout:" << sysFinalDiskLayout; 
     
    1219990} 
    1220991 
    1221 void wizardDisk::slotUEnc() 
    1222 { 
    1223   if ( ! treeMounts->currentItem() ) 
    1224     return; 
    1225  
    1226   if ( treeMounts->currentItem()->text(3).indexOf(".eli") != -1 ) 
    1227     treeMounts->currentItem()->setText(3, treeMounts->currentItem()->text(3).replace(".eli", "") ); 
    1228   else { 
    1229     bool ok; 
    1230  
    1231     // If on /swap, we don't need password 
    1232     if ( treeMounts->currentItem()->text(1) == "SWAP" ) { 
    1233       treeMounts->currentItem()->setText(3, treeMounts->currentItem()->text(3) + ".eli" ); 
    1234       return; 
    1235     } 
    1236  
    1237     QString text = QInputDialog::getText(this, tr("Please enter the password for this partition:"), 
    1238                                          tr("Password:"), QLineEdit::Password, 
    1239                                          QString(), &ok); 
    1240     if (!ok || text.isEmpty()) 
    1241       return; 
    1242  
    1243     QString text2 = QInputDialog::getText(this, tr("Please confirm the password for this partition:"), 
    1244                                          tr("Confirm Password:"), QLineEdit::Password, 
    1245                                          QString(), &ok); 
    1246     if (!ok || text.isEmpty()) 
    1247       return; 
    1248  
    1249     if ( text != text2 ) { 
    1250       QMessageBox::critical(this, tr("Password Mismatch"), 
    1251               tr("The passwords entered do not match!"), 
    1252               QMessageBox::Ok, 
    1253               QMessageBox::Ok); 
    1254       return;  
    1255     } 
    1256  
    1257     // Save the password 
    1258     treeMounts->currentItem()->setText(3, treeMounts->currentItem()->text(3) + ".eli" ); 
    1259     treeMounts->currentItem()->setText(4, text); 
    1260   } 
    1261  
    1262 } 
Note: See TracChangeset for help on using the changeset viewer.