[PC-BSD Commits] r7220 - in pcbsd: current/SysInstaller stable/SysInstaller
svn at pcbsd.org
svn at pcbsd.org
Thu Jul 15 07:46:04 PDT 2010
Author: kris
Date: 2010-07-15 07:46:04 -0700 (Thu, 15 Jul 2010)
New Revision: 7220
Modified:
pcbsd/current/SysInstaller/dialogFileSystem.cpp
pcbsd/current/SysInstaller/dialogFileSystem.h
pcbsd/stable/SysInstaller/dialogFileSystem.cpp
pcbsd/stable/SysInstaller/dialogFileSystem.h
Log:
Updated SysInstaller to allow selecting partition/slices for integration into a zpool
Modified: pcbsd/current/SysInstaller/dialogFileSystem.cpp
===================================================================
--- pcbsd/current/SysInstaller/dialogFileSystem.cpp 2010-07-15 09:02:16 UTC (rev 7219)
+++ pcbsd/current/SysInstaller/dialogFileSystem.cpp 2010-07-15 14:46:04 UTC (rev 7220)
@@ -1,5 +1,6 @@
#include "dialogFileSystem.h"
#include "ui_dialogFileSystem.h"
+#include <QDebug>
dialogFileSystem::~dialogFileSystem()
@@ -40,9 +41,8 @@
connect(horizontalSizeSliderZFS, SIGNAL(sliderMoved(int)), this, SLOT(slotSliderChangedValue(int)));
connect(spinSize, SIGNAL(valueChanged(int)), this, SLOT(slotSpinBoxChanged(int)));
connect(spinSizeZFS, SIGNAL(valueChanged(int)), this, SLOT(slotSpinBoxChanged(int)));
-
+ connect(listZPoolDevices,SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(slotCheckSanity()));
-
// Add the file-system types
comboDiskType->addItem("UFS");
comboDiskType->addItem("UFS+S");
@@ -204,13 +204,39 @@
}
+// Check the sanity of the zpool
+bool dialogFileSystem::checkZpoolSanity()
+{
+ QStringList zUsed;
+ QString tmp;
+
+ // Check for any zpool conflicts
+ for ( int z=0; z<listZPoolDevices->count(); ++z) {
+ tmp = listZPoolDevices->item(z)->text();
+ tmp.truncate(tmp.indexOf(" "));
+
+ // Test if this device is checked and we need to add it to the used pile
+ if ( listZPoolDevices->item(z)->checkState() == Qt::Checked )
+ zUsed << tmp;
+ }
+
+
+ // Now check if this device cannot be included with already checked ones
+ for (int i=0; i < zUsed.count(); ++i)
+ for ( int z=0; z < zUsed.count(); ++z)
+ if ( zUsed.at(i).indexOf(zUsed.at(z)) != -1 && zUsed.at(i) != zUsed.at(z) )
+ return false;
+
+ return true;
+}
+
// Function to display the list of available drivces / partitions which can be added to this zpool
void dialogFileSystem::populateZpoolList()
{
QString availSize, desc;
// Figure out the current device
- QString curDevice;
+ QString curDevice, curSlice;
// Get the index
int sysIndex = getSysIndexFromCombo(comboDiskSelection->currentIndex());
@@ -219,35 +245,55 @@
return;
// Set our vars with Disk / Slice info, size, etc
- if ( sysDisks.at(sysIndex).at(0) == "DRIVE")
- curDevice = sysDisks.at(sysIndex).at(1);
- else
- curDevice = sysDisks.at(sysIndex).at(1);
+ curDevice = sysDisks.at(sysIndex).at(1);
+ if ( sysDisks.at(sysIndex).at(0) == "SLICE")
+ curSlice = sysDisks.at(sysIndex).at(1) + sysDisks.at(sysIndex).at(2);
listZPoolDevices->clear();
- // Start adding / listing our disks / partitions available
+ // Start adding / listing our disks
for (int i=0; i < sysDisks.count(); ++i) {
// Make sure to only add the drives to the comboDiskList
if ( sysDisks.at(i).at(0) == "DRIVE" \
&& diskNoExistingPartition(sysDisks.at(i).at(1)) \
&& curDevice != sysDisks.at(i).at(1) \
) {
- //&& calculateFreeSpace(i) > 0 ) {
availSize.setNum(calculateFreeSpace(i));
desc = sysDisks.at(i).at(3);
desc = desc.remove(0, 1);
desc.truncate(desc.size() -1);
- desc.truncate(20);
+ desc.truncate(25);
- QListWidgetItem *zpoolDev = new QListWidgetItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB (" + availSize + " Avail) " + desc, listZPoolDevices);
+ QListWidgetItem *zpoolDev = new QListWidgetItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB " + desc, listZPoolDevices);
zpoolDev->setCheckState(Qt::Unchecked);
- if ( calculateFreeSpace(i) == 0 )
- zpoolDev->setHidden(true);
+ if ( calculateFreeSpace(i) <= 0 )
+ zpoolDev->setHidden(TRUE);
+
}
}
+
+ // Start adding our available slices
+ for (int i=0; i < sysDisks.count(); ++i) {
+ // Make sure to only add the drives to the comboDiskList
+ if ( sysDisks.at(i).at(0) == "SLICE" \
+ && curSlice != sysDisks.at(i).at(1) + sysDisks.at(i).at(2) \
+ && curDevice != sysDisks.at(i).at(1) \
+ ) {
+ availSize.setNum(calculateFreeSpace(i));
+ desc = sysDisks.at(i).at(4);
+ desc.truncate(30);
+
+ QListWidgetItem *zpoolDev = new QListWidgetItem(sysDisks.at(i).at(2) + " - " + sysDisks.at(i).at(3) + "MB " + desc, listZPoolDevices);
+ zpoolDev->setCheckState(Qt::Unchecked);
+
+ if ( calculateFreeSpace(i) <= 0 )
+ zpoolDev->setHidden(TRUE);
+ }
+ }
+
+
}
// Public slot which lets us set if we are editing a partition, or creating a new one
@@ -688,6 +734,9 @@
ready = false;
}
+ // Check Zpool Details
+ ready = checkZpoolSanity();
+
} else {
// Mirror sanity checks
QString selDev = comboDiskSelection->currentText();
Modified: pcbsd/current/SysInstaller/dialogFileSystem.h
===================================================================
--- pcbsd/current/SysInstaller/dialogFileSystem.h 2010-07-15 09:02:16 UTC (rev 7219)
+++ pcbsd/current/SysInstaller/dialogFileSystem.h 2010-07-15 14:46:04 UTC (rev 7220)
@@ -50,6 +50,7 @@
bool diskNoZFSMirrorSet(QString Device);
bool sliceNoExistingDiskPartition(QString Device);
bool checkExistingMount();
+ bool checkZpoolSanity();
void addDisksSane();
bool isEditing;
int editIndex;
Modified: pcbsd/stable/SysInstaller/dialogFileSystem.cpp
===================================================================
--- pcbsd/stable/SysInstaller/dialogFileSystem.cpp 2010-07-15 09:02:16 UTC (rev 7219)
+++ pcbsd/stable/SysInstaller/dialogFileSystem.cpp 2010-07-15 14:46:04 UTC (rev 7220)
@@ -1,5 +1,6 @@
#include "dialogFileSystem.h"
#include "ui_dialogFileSystem.h"
+#include <QDebug>
dialogFileSystem::~dialogFileSystem()
@@ -40,9 +41,8 @@
connect(horizontalSizeSliderZFS, SIGNAL(sliderMoved(int)), this, SLOT(slotSliderChangedValue(int)));
connect(spinSize, SIGNAL(valueChanged(int)), this, SLOT(slotSpinBoxChanged(int)));
connect(spinSizeZFS, SIGNAL(valueChanged(int)), this, SLOT(slotSpinBoxChanged(int)));
-
+ connect(listZPoolDevices,SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(slotCheckSanity()));
-
// Add the file-system types
comboDiskType->addItem("UFS");
comboDiskType->addItem("UFS+S");
@@ -204,13 +204,39 @@
}
+// Check the sanity of the zpool
+bool dialogFileSystem::checkZpoolSanity()
+{
+ QStringList zUsed;
+ QString tmp;
+
+ // Check for any zpool conflicts
+ for ( int z=0; z<listZPoolDevices->count(); ++z) {
+ tmp = listZPoolDevices->item(z)->text();
+ tmp.truncate(tmp.indexOf(" "));
+
+ // Test if this device is checked and we need to add it to the used pile
+ if ( listZPoolDevices->item(z)->checkState() == Qt::Checked )
+ zUsed << tmp;
+ }
+
+
+ // Now check if this device cannot be included with already checked ones
+ for (int i=0; i < zUsed.count(); ++i)
+ for ( int z=0; z < zUsed.count(); ++z)
+ if ( zUsed.at(i).indexOf(zUsed.at(z)) != -1 && zUsed.at(i) != zUsed.at(z) )
+ return false;
+
+ return true;
+}
+
// Function to display the list of available drivces / partitions which can be added to this zpool
void dialogFileSystem::populateZpoolList()
{
QString availSize, desc;
// Figure out the current device
- QString curDevice;
+ QString curDevice, curSlice;
// Get the index
int sysIndex = getSysIndexFromCombo(comboDiskSelection->currentIndex());
@@ -219,35 +245,55 @@
return;
// Set our vars with Disk / Slice info, size, etc
- if ( sysDisks.at(sysIndex).at(0) == "DRIVE")
- curDevice = sysDisks.at(sysIndex).at(1);
- else
- curDevice = sysDisks.at(sysIndex).at(1);
+ curDevice = sysDisks.at(sysIndex).at(1);
+ if ( sysDisks.at(sysIndex).at(0) == "SLICE")
+ curSlice = sysDisks.at(sysIndex).at(1) + sysDisks.at(sysIndex).at(2);
listZPoolDevices->clear();
- // Start adding / listing our disks / partitions available
+ // Start adding / listing our disks
for (int i=0; i < sysDisks.count(); ++i) {
// Make sure to only add the drives to the comboDiskList
if ( sysDisks.at(i).at(0) == "DRIVE" \
&& diskNoExistingPartition(sysDisks.at(i).at(1)) \
&& curDevice != sysDisks.at(i).at(1) \
) {
- //&& calculateFreeSpace(i) > 0 ) {
availSize.setNum(calculateFreeSpace(i));
desc = sysDisks.at(i).at(3);
desc = desc.remove(0, 1);
desc.truncate(desc.size() -1);
- desc.truncate(20);
+ desc.truncate(25);
- QListWidgetItem *zpoolDev = new QListWidgetItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB (" + availSize + " Avail) " + desc, listZPoolDevices);
+ QListWidgetItem *zpoolDev = new QListWidgetItem(sysDisks.at(i).at(1) + " - " + sysDisks.at(i).at(2) + "MB " + desc, listZPoolDevices);
zpoolDev->setCheckState(Qt::Unchecked);
- if ( calculateFreeSpace(i) == 0 )
- zpoolDev->setHidden(true);
+ if ( calculateFreeSpace(i) <= 0 )
+ zpoolDev->setHidden(TRUE);
+
}
}
+
+ // Start adding our available slices
+ for (int i=0; i < sysDisks.count(); ++i) {
+ // Make sure to only add the drives to the comboDiskList
+ if ( sysDisks.at(i).at(0) == "SLICE" \
+ && curSlice != sysDisks.at(i).at(1) + sysDisks.at(i).at(2) \
+ && curDevice != sysDisks.at(i).at(1) \
+ ) {
+ availSize.setNum(calculateFreeSpace(i));
+ desc = sysDisks.at(i).at(4);
+ desc.truncate(30);
+
+ QListWidgetItem *zpoolDev = new QListWidgetItem(sysDisks.at(i).at(2) + " - " + sysDisks.at(i).at(3) + "MB " + desc, listZPoolDevices);
+ zpoolDev->setCheckState(Qt::Unchecked);
+
+ if ( calculateFreeSpace(i) <= 0 )
+ zpoolDev->setHidden(TRUE);
+ }
+ }
+
+
}
// Public slot which lets us set if we are editing a partition, or creating a new one
@@ -688,6 +734,9 @@
ready = false;
}
+ // Check Zpool Details
+ ready = checkZpoolSanity();
+
} else {
// Mirror sanity checks
QString selDev = comboDiskSelection->currentText();
Modified: pcbsd/stable/SysInstaller/dialogFileSystem.h
===================================================================
--- pcbsd/stable/SysInstaller/dialogFileSystem.h 2010-07-15 09:02:16 UTC (rev 7219)
+++ pcbsd/stable/SysInstaller/dialogFileSystem.h 2010-07-15 14:46:04 UTC (rev 7220)
@@ -50,6 +50,7 @@
bool diskNoZFSMirrorSet(QString Device);
bool sliceNoExistingDiskPartition(QString Device);
bool checkExistingMount();
+ bool checkZpoolSanity();
void addDisksSane();
bool isEditing;
int editIndex;
More information about the Commits
mailing list