Author: aschnell
Date: Tue Oct 13 18:06:01 2009
New Revision: 59009
URL: http://svn.opensuse.org/viewcvs/yast?rev=59009&view=rev
Log:
- backported support for encrypted physical volumes (fate #305633)
Modified:
branches/SuSE-Code-11-SP1-Branch/storage/VERSION
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Dasd.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Nfs.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Partition.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageInterface.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h
branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/auto_part_ui.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_dialogs.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-all.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dialogs.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dm.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-hd.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm-dialogs.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid-dialogs.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-settings.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/lvm_pv_lib.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/raid_lib.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_disk_proposal.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_target_part.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/Storage.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageClients.ycp
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageFields.ycp
Modified: branches/SuSE-Code-11-SP1-Branch/storage/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/VERSION?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/VERSION (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/VERSION Tue Oct 13 18:06:01 2009
@@ -1 +1 @@
-2.17.78
+2.17.79
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.cc Tue Oct 13 18:06:01 2009
@@ -69,10 +69,26 @@
return( p.empty() );
}
-static bool stageFormat( const Volume& v )
- { return( v.getFormat()||v.needCrsetup()||v.needLabel()); }
-static bool stageMount( const Volume& v )
- { return( v.needRemount()||v.needFstabUpdate()); }
+
+ bool Container::stageDecrease(const Volume& v)
+ {
+ return v.deleted() || v.needShrink();
+ }
+
+ bool Container::stageIncrease(const Volume& v)
+ {
+ return v.created() || v.needExtend() || v.needCrsetup();
+ }
+
+ bool Container::stageFormat(const Volume& v)
+ {
+ return v.getFormat() || v.needLabel();
+ }
+
+ bool Container::stageMount(const Volume& v)
+ {
+ return v.needRemount() || v.needFstabUpdate();
+ }
int Container::getToCommit( CommitStage stage, list& col,
list& vol )
@@ -93,7 +109,7 @@
break;
case INCREASE:
{
- VolPair p = volPair( stageCreate );
+ VolPair p = volPair(stageIncrease);
for( VolIterator i=p.begin(); i!=p.end(); ++i )
vol.push_back( &(*i) );
if( created() )
@@ -132,24 +148,31 @@
{
case DECREASE:
if( vol->deleted() )
+ {
+ if (vol->getEncryption() != ENC_NONE)
+ vol->doFstabUpdate();
ret = doRemove( vol );
+ }
else if( vol->needShrink() )
ret = doResize( vol );
break;
+
case INCREASE:
if( vol->created() )
ret = doCreate( vol );
else if( vol->needExtend() )
ret = doResize( vol );
+ if (vol->needCrsetup())
+ ret = vol->doCrsetup();
break;
+
case FORMAT:
- if( vol->needCrsetup() )
- ret = vol->doCrsetup();
if( ret==0 && vol->getFormat() )
ret = vol->doFormat();
if( ret==0 && vol->needLabel() )
ret = vol->doSetLabel();
break;
+
case MOUNT:
if( vol->needRemount() )
ret = vol->doMount();
@@ -160,6 +183,7 @@
vol->fstabUpdateDone();
}
break;
+
default:
ret = VOLUME_COMMIT_UNKNOWN_STAGE;
}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Container.h Tue Oct 13 18:06:01 2009
@@ -202,10 +202,11 @@
virtual int doResize( Volume * v );
virtual void logData( const string& Dir ) {}
Container& operator=( const Container& );
- static bool stageDecrease( const Volume& v )
- { return( v.deleted()||v.needShrink()); }
- static bool stageCreate( const Volume& v )
- { return( v.created()||v.needExtend()); }
+
+ static bool stageDecrease(const Volume& v);
+ static bool stageIncrease(const Volume& v);
+ static bool stageFormat(const Volume& v);
+ static bool stageMount(const Volume& v);
static const string type_names[COTYPE_LAST_ENTRY];
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Dasd.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Dasd.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Dasd.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Dasd.cc Tue Oct 13 18:06:01 2009
@@ -518,7 +518,7 @@
}
else if( stage==INCREASE )
{
- VolPair p = volPair( stageCreate );
+ VolPair p = volPair(stageIncrease);
if( !p.empty() )
vol.push_back( &(*(p.begin())) );
}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.cc Tue Oct 13 18:06:01 2009
@@ -37,15 +37,25 @@
using namespace std;
using namespace storage;
-DmCo::DmCo( Storage * const s, bool detect, ProcPart& ppart ) :
- PeContainer(s,staticType())
+ DmCo::DmCo(Storage * const s, bool detect, ProcPart& ppart, bool only_crypt)
+ : PeContainer(s, staticType())
{
- y2deb("constructing DmCo detect:" << detect);
- init();
- if( detect )
- getDmData( ppart );
+ y2deb("constructing DmCo detect:" << detect);
+ init();
+ if (detect)
+ getDmData(ppart, only_crypt);
+ }
+
+
+ void
+ DmCo::second(bool detect, ProcPart& ppart, bool only_crypt)
+ {
+ y2deb("second DmCo detect:" << detect);
+ if (detect)
+ getDmData(ppart, only_crypt);
}
+
DmCo::DmCo( Storage * const s, const string& file ) :
PeContainer(s,staticType())
{
@@ -128,7 +138,7 @@
void
-DmCo::getDmData( ProcPart& ppart )
+DmCo::getDmData(ProcPart& ppart, bool only_crypt)
{
Storage::ConstLvmLvPair lv = getStorage()->lvmLvPair();
Storage::ConstDmraidCoPair dmrco = getStorage()->dmraidCoPair();
@@ -226,9 +236,11 @@
skip = true;
getStorage()->setDmcryptData( it->first, m->device(), min_num,
m->sizeK(), detectEncryption (m->device()) );
- getStorage()->clearUsedBy(it->first);
+ if (getStorage()->usedBy(it->first) == UB_DM)
+ getStorage()->clearUsedBy(it->first);
}
- if( !skip && m->sizeK()>0 )
+ if (!skip && m->sizeK() > 0 && ((only_crypt && m->getTargetName() == "crypt") ||
+ (!only_crypt && m->getTargetName() != "crypt")))
addDm( m );
else
delete( m );
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/DmCo.h Tue Oct 13 18:06:01 2009
@@ -35,9 +35,13 @@
friend class Storage;
public:
- DmCo( Storage * const s, bool detect, ProcPart& ppart );
+ DmCo(Storage * const s, bool detect, ProcPart& ppart, bool only_crypt);
DmCo( const DmCo& rhs );
+
+ void second(bool detect, ProcPart& ppart, bool only_crypt);
+
virtual ~DmCo();
+
static storage::CType staticType() { return storage::DM; }
friend std::ostream& operator<< (std::ostream&, const DmCo& );
bool equalContent( const Container& rhs ) const;
@@ -50,7 +54,7 @@
protected:
DmCo( Storage * const s, const string& File );
- void getDmData( ProcPart& ppart );
+ void getDmData(ProcPart& ppart, bool only_crypt);
bool findDm( unsigned num, DmIter& i );
bool findDm( unsigned num );
bool findDm( const string& dev, DmIter& i );
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.cc Tue Oct 13 18:06:01 2009
@@ -49,12 +49,6 @@
void
EtcFstab::readFiles()
{
- string file = prefix+"/fstab";
- ifstream mounts( file.c_str() );
- classic(mounts);
- string line;
- unsigned lineno = 0;
- getline( mounts, line );
list<Entry>::iterator i = co.begin();
while( i!=co.end() )
{
@@ -63,11 +57,16 @@
else
++i;
}
- y2milestone( "entries:%zd", co.size() );
+ y2mil("entries:" << co.size());
+
+ string file = prefix+"/fstab";
+ ifstream mounts( file.c_str() );
+ classic(mounts);
+ string line;
+ getline( mounts, line );
while( mounts.good() )
{
y2mil( "line:\"" << line << "\"" );
- lineno++;
list<string> l = splitString( line );
list<string>::const_iterator i = l.begin();
if( l.begin()!=l.end() && i->find( '#' )!=0 )
@@ -102,8 +101,7 @@
getline( mounts, line );
}
mounts.close();
- y2milestone( "file:%s lines:%u", file.c_str(), lineno );
- lineno=0;
+
file = prefix+"/cryptotab";
mounts.clear();
mounts.open( file.c_str() );
@@ -111,12 +109,11 @@
while( mounts.good() )
{
y2mil( "line:\"" << line << "\"" );
- lineno++;
list<string> l = splitString( line );
list<string>::const_iterator i = l.begin();
Entry *p = new Entry;
- p->old.loop = p->old.crypto = true;
+ p->old.loop = p->old.cryptotab = true;
if( i!=l.end() )
p->old.loop_dev = *i++;
if( i!=l.end() )
@@ -140,8 +137,7 @@
getline( mounts, line );
}
mounts.close();
- y2milestone( "file:%s lines:%u", file.c_str(), lineno );
- lineno=0;
+
file = prefix+"/crypttab";
mounts.clear();
mounts.open( file.c_str() );
@@ -149,7 +145,6 @@
while( mounts.good() )
{
y2mil( "line:\"" << line << "\"" );
- lineno++;
list<string> l = splitString( line );
if( l.size()>=3 )
{
@@ -165,10 +160,11 @@
{
co.push_back( Entry() );
p = &(co.back());
+ p->old.dentry = *i;
}
else
p = &(*e);
- p->old.dmcrypt = p->old.cryptt = true;
+ p->old.dmcrypt = p->old.crypttab = true;
p->old.noauto = false;
p->old.encr = ENC_LUKS;
p->old.device = *i;
@@ -196,7 +192,7 @@
getline( mounts, line );
}
mounts.close();
- y2milestone( "file:%s lines:%u", file.c_str(), lineno );
+
y2milestone( "entries:%zd", co.size() );
}
@@ -246,8 +242,8 @@
mount_by = MOUNTBY_PATH;
}
dmcrypt = encr==ENC_LUKS;
- crypto = !noauto && encr!=ENC_NONE && !dmcrypt;
- cryptt = !noauto && dmcrypt;
+ cryptotab = !noauto && encr!=ENC_NONE && !dmcrypt;
+ crypttab = !noauto && dmcrypt;
}
bool
@@ -336,8 +332,8 @@
}
if( i!=co.end())
entry = i->nnew;
- y2milestone( "ret:%d", i!=co.end() );
- return( i!=co.end() );
+ y2mil("ret:" << (i != co.end()));
+ return i != co.end();
}
bool
@@ -362,13 +358,13 @@
}
if( i!=co.end())
entry = i->nnew;
- y2milestone( "ret:%d", i!=co.end() );
+ y2mil("ret:" << (i != co.end()));
return( i!=co.end() );
}
int EtcFstab::removeEntry( const FstabEntry& entry )
{
- y2milestone( "dev:%s mp:%s", entry.dentry.c_str(), entry.mount.c_str() );
+ y2mil("dentry:" << entry.dentry << " mount:" << entry.mount);
list<Entry>::iterator i = co.begin();
while( i != co.end() &&
(i->op==Entry::REMOVE || i->nnew.device != entry.device) )
@@ -385,7 +381,7 @@
int EtcFstab::updateEntry( const FstabChange& entry )
{
- y2milestone( "dev:%s mp:%s", entry.dentry.c_str(), entry.mount.c_str() );
+ y2mil("dentry:" << entry.dentry << " mount:" << entry.mount);
list<Entry>::iterator i = co.begin();
bool found = false;
while( i != co.end() && !found )
@@ -410,7 +406,7 @@
int EtcFstab::addEntry( const FstabChange& entry )
{
- y2milestone( "dev:%s mp:%s", entry.dentry.c_str(), entry.mount.c_str() );
+ y2mil("dentry:" << entry.dentry << " mount:" << entry.mount);
Entry e;
e.op = Entry::ADD;
e.nnew = entry;
@@ -420,13 +416,13 @@
}
AsciiFile* EtcFstab::findFile( const FstabEntry& e, AsciiFile*& fstab,
- AsciiFile*& cryptotab, int& lineno )
+ AsciiFile*& cryptotab, int& lineno ) const
{
- y2milestone( "device:%s mp:%s fstab:%p cryptotab:%p", e.dentry.c_str(),
- e.mount.c_str(), fstab, cryptotab );
+ y2mil("dentry:" << e.dentry << " mount:" << e.mount << " fstab:" << fstab <<
+ " cryptotab:" << cryptotab);
AsciiFile* ret=NULL;
Regex *fi = NULL;
- if( e.crypto )
+ if( e.cryptotab )
{
if( cryptotab==NULL )
cryptotab = new AsciiFile( prefix + "/cryptotab" );
@@ -446,11 +442,10 @@
return( ret );
}
-int EtcFstab::findPrefix( const AsciiFile& tab, const string& mount )
+int EtcFstab::findPrefix( const AsciiFile& tab, const string& mount ) const
{
bool crypto = tab.fileName().find( "/cryptotab" )>=0;
- y2mil( "file:" << tab.fileName() << " mp:" << mount <<
- " crypto:" << crypto );
+ y2mil("file:" << tab.fileName() << " mount:" << mount << " crypto:" << crypto);
string reg = "^[ \t]*[^ \t]+";
if( crypto )
reg += "[ \t]+[^ \t]+";
@@ -465,7 +460,7 @@
}
bool EtcFstab::findCrtab( const FstabEntry& e, const AsciiFile& tab,
- int& lineno )
+ int& lineno ) const
{
y2milestone( "dev:%s", e.device.c_str() );
string reg = "^[ \t]*[^ \t]+[ \t]+" + e.device + "[ \t]";
@@ -482,7 +477,7 @@
}
bool EtcFstab::findCrtab( const string& dev, const AsciiFile& tab,
- int& lineno )
+ int& lineno ) const
{
y2milestone( "dev:%s", dev.c_str() );
string reg = "^[ \t]*[^ \t]+[ \t]+" + dev + "[ \t]";
@@ -492,10 +487,10 @@
return( lineno>=0 );
}
-void EtcFstab::makeStringList( const FstabEntry& e, list<string>& ls )
+list<string> EtcFstab::makeStringList(const FstabEntry& e) const
{
- ls.clear();
- if( e.crypto )
+ list<string> ls;
+ if( e.cryptotab )
{
ls.push_back( e.loop_dev );
}
@@ -507,7 +502,7 @@
{
ls.push_back( (e.fs!="ntfs")?e.fs:"ntfs-3g" );
}
- if( e.crypto )
+ if( e.cryptotab )
{
ls.push_back( Volume::encTypeString(e.encr) );
}
@@ -520,15 +515,16 @@
else
ls.back() += ",noauto";
}
- if( !e.crypto )
+ if( !e.cryptotab )
{
ls.push_back( decString(e.freq) );
ls.push_back( decString(e.passno) );
}
+ return ls;
}
string EtcFstab::createLine( const list<string>& ls, unsigned fields,
- unsigned* flen )
+ unsigned* flen ) const
{
string ret;
unsigned count=0;
@@ -547,22 +543,21 @@
return( ret );
}
-string EtcFstab::createTabLine( const FstabEntry& e )
+string EtcFstab::createTabLine( const FstabEntry& e ) const
{
- y2milestone( "device:%s mp:%s", e.dentry.c_str(), e.mount.c_str() );
+ y2mil("dentry:" << e.dentry << " mount:" << e.mount << "device:" << e.device);
y2mil( "entry:" << e );
- list<string> ls;
- makeStringList( e, ls );
+ const list<string> ls = makeStringList(e);
y2mil( "list:" << ls );
- unsigned max_fields = e.crypto ? lengthof(cryptotabFields)
+ unsigned max_fields = e.cryptotab ? lengthof(cryptotabFields)
: lengthof(fstabFields);
- unsigned* fields = e.crypto ? cryptotabFields : fstabFields;
- return( createLine( ls, max_fields, fields ));
+ unsigned* fields = e.cryptotab ? cryptotabFields : fstabFields;
+ return createLine(ls, max_fields, fields);
}
-void EtcFstab::makeCrStringList( const FstabEntry& e, list<string>& ls )
+list<string> EtcFstab::makeCrStringList(const FstabEntry& e) const
{
- ls.clear();
+ list<string> ls;
ls.push_back( e.dentry.substr(e.dentry.rfind( '/' )+1) );
string tmp = e.device;
ls.push_back( tmp );
@@ -586,21 +581,20 @@
tls.erase(i);
tmp = mergeString( tls, "," );
ls.push_back( tmp.empty()?"none":tmp );
+ return ls;
}
-string EtcFstab::createCrtabLine( const FstabEntry& e )
+string EtcFstab::createCrtabLine( const FstabEntry& e ) const
{
- y2milestone( "device:%s mp:%s device:%s", e.dentry.c_str(), e.mount.c_str(),
- e.device.c_str() );
- list<string> ls;
- makeCrStringList( e, ls );
- return( createLine( ls, lengthof(crypttabFields), crypttabFields ));
+ y2mil("dentry:" << e.dentry << " mount:" << e.mount << " device:" << e.device);
+ const list<string> ls = makeCrStringList(e);
+ return createLine(ls, lengthof(crypttabFields), crypttabFields);
}
-void EtcFstab::getFileBasedLoops( const string& prefix, list<FstabEntry>& l )
+void EtcFstab::getFileBasedLoops( const string& prefix, list<FstabEntry>& l ) const
{
l.clear();
- list<Entry>::iterator i = co.begin();
+ list<Entry>::const_iterator i = co.begin();
while( i!=co.end() )
{
if( i->op==Entry::NONE )
@@ -613,10 +607,10 @@
}
}
-void EtcFstab::getEntries( list<FstabEntry>& l )
+void EtcFstab::getEntries( list<FstabEntry>& l ) const
{
l.clear();
- list<Entry>::iterator i = co.begin();
+ list<Entry>::const_iterator i = co.begin();
while( i!=co.end() )
{
if( i->op==Entry::NONE )
@@ -628,7 +622,7 @@
}
string EtcFstab::updateLine( const list<string>& ol,
- const list<string>& nl, const string& oldline )
+ const list<string>& nl, const string& oldline ) const
{
string line( oldline );
list<string>::const_iterator oi = ol.begin();
@@ -706,14 +700,20 @@
case Entry::REMOVE:
cur = findFile( i->old, fstab, cryptotab, lineno );
if( lineno>=0 )
- {
+ {
cur->remove( lineno, 1 );
- if( cur==fstab && i->old.cryptt &&
+ if( cur==fstab && i->old.crypttab &&
findCrtab( i->old, crypttab, lineno ))
crypttab.remove( lineno, 1 );
- }
+ }
+ else if (i->old.crypttab && findCrtab(i->old, crypttab, lineno))
+ {
+ crypttab.remove( lineno, 1 );
+ }
else
+ {
ret = FSTAB_REMOVE_ENTRY_NOT_FOUND;
+ }
i = co.erase( i );
break;
case Entry::UPDATE:
@@ -723,7 +723,7 @@
if( lineno>=0 )
{
string line;
- if( i->old.crypto != i->nnew.crypto )
+ if( i->old.cryptotab != i->nnew.cryptotab )
{
cur->remove( lineno, 1 );
cur = findFile( i->nnew, fstab, cryptotab, lineno );
@@ -733,25 +733,23 @@
else
{
line = (*cur)[lineno];
- list<string> ol, nl;
- makeStringList( i->nnew, nl );
- makeStringList( i->old, ol );
+ const list<string> nl = makeStringList(i->nnew);
+ const list<string> ol = makeStringList(i->old);
line = updateLine( ol, nl, line );
(*cur)[lineno] = line;
}
- if( i->old.cryptt > i->nnew.cryptt &&
+ if( i->old.crypttab > i->nnew.crypttab &&
findCrtab( i->old, crypttab, lineno ))
crypttab.remove( lineno, 1 );
- if( i->nnew.cryptt )
+ if( i->nnew.crypttab )
{
line = createCrtabLine( i->nnew );
if( findCrtab( i->old, crypttab, lineno ) ||
findCrtab( i->nnew, crypttab, lineno ))
{
line = crypttab[lineno];
- list<string> ol, nl;
- makeCrStringList( i->nnew, nl );
- makeCrStringList( i->old, ol );
+ const list<string> nl = makeCrStringList(i->nnew);
+ const list<string> ol = makeCrStringList(i->old);
line = updateLine( ol, nl, line );
crypttab[lineno] = line;
}
@@ -775,17 +773,21 @@
if( lineno>=0 )
{
before_dev = extractNthWord( 0, (*cur)[lineno] );
- cur->insert( lineno, line );
+ if (!i->nnew.mount.empty())
+ cur->insert( lineno, line );
}
else
- cur->append( line );
+ {
+ if (!i->nnew.mount.empty())
+ cur->append( line );
+ }
}
else
{
y2war( "replacing line:" << (*cur)[lineno] );
(*cur)[lineno] = line;
}
- if( i->nnew.cryptt )
+ if( i->nnew.crypttab )
{
line = createCrtabLine( i->nnew );
if( findCrtab( i->nnew, crypttab, lineno ))
@@ -831,7 +833,7 @@
return( ret );
}
-string EtcFstab::addText( bool doing, bool crypto, const string& mp )
+string EtcFstab::addText( bool doing, bool crypto, const string& mp ) const
{
const char* file = crypto?"/etc/cryptotab":"/etc/fstab";
string txt;
@@ -852,7 +854,7 @@
return( txt );
}
-string EtcFstab::updateText( bool doing, bool crypto, const string& mp )
+string EtcFstab::updateText( bool doing, bool crypto, const string& mp ) const
{
const char* file = crypto?"/etc/cryptotab":"/etc/fstab";
string txt;
@@ -873,7 +875,7 @@
return( txt );
}
-string EtcFstab::removeText( bool doing, bool crypto, const string& mp )
+string EtcFstab::removeText( bool doing, bool crypto, const string& mp ) const
{
const char* file = crypto?"/etc/cryptotab":"/etc/fstab";
string txt;
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/EtcFstab.h Tue Oct 13 18:06:01 2009
@@ -37,10 +37,12 @@
struct FstabEntry
{
- FstabEntry() { freq=passno=0;
- crypto=cryptt=loop=noauto=dmcrypt=tmpcrypt=false;
- encr=storage::ENC_NONE; mount_by=storage::MOUNTBY_DEVICE; }
+ FstabEntry() : freq(0), passno(0), loop(false), dmcrypt(false), noauto(false),
+ cryptotab(false), crypttab(false), tmpcrypt(false), encr(ENC_NONE),
+ mount_by(MOUNTBY_DEVICE) {}
+
FstabEntry& operator=( const FstabChange& rhs );
+
friend std::ostream& operator<< (std::ostream& s, const FstabEntry &v );
string device;
@@ -53,8 +55,8 @@
bool loop;
bool dmcrypt;
bool noauto;
- bool crypto;
- bool cryptt;
+ bool cryptotab;
+ bool crypttab;
bool tmpcrypt;
string loop_dev;
string cr_opts;
@@ -73,10 +75,10 @@
<< " freq:" << v.freq << " passno:" << v.passno;
if( v.noauto )
s << " noauto";
- if( v.crypto )
- s << " crypto";
- if( v.cryptt )
- s << " cryptt";
+ if( v.cryptotab )
+ s << " cryptotab";
+ if( v.crypttab )
+ s << " crypttab";
if( v.tmpcrypt )
s << " tmpcrypt";
if( v.loop )
@@ -96,8 +98,10 @@
struct FstabChange
{
- FstabChange() { freq=passno=0; encr=storage::ENC_NONE; tmpcrypt=false; }
+ FstabChange() : freq(0), passno(0), encr(ENC_NONE), tmpcrypt(false) {}
+
FstabChange( const FstabEntry& e ) { *this = e; }
+
FstabChange& operator=( const FstabEntry& rhs )
{
device = rhs.device;
@@ -107,7 +111,9 @@
tmpcrypt = rhs.tmpcrypt;
return( *this );
}
+
friend std::ostream& operator<< (std::ostream& s, const FstabChange &v );
+
string device;
string dentry;
string mount;
@@ -164,40 +170,43 @@
int addEntry( const FstabChange& entry );
int removeEntry( const FstabEntry& entry );
int changeRootPrefix( const string& prfix );
- void getFileBasedLoops( const string& prefix, std::list<FstabEntry>& l );
- void getEntries( std::list<FstabEntry>& l );
- string addText( bool doing, bool crypto, const string& mp );
- string updateText( bool doing, bool crypto, const string& mp );
- string removeText( bool doing, bool crypto, const string& mp );
+ void getFileBasedLoops( const string& prefix, std::list<FstabEntry>& l ) const;
+ void getEntries( std::list<FstabEntry>& l ) const;
+ string addText( bool doing, bool crypto, const string& mp ) const;
+ string updateText( bool doing, bool crypto, const string& mp ) const;
+ string removeText( bool doing, bool crypto, const string& mp ) const;
int flush();
- int findPrefix( const AsciiFile& tab, const string& mount );
+ int findPrefix( const AsciiFile& tab, const string& mount ) const;
protected:
struct Entry
{
enum operation { NONE, ADD, REMOVE, UPDATE };
- Entry() { op=NONE; }
+ Entry() : op(NONE) {}
operation op;
FstabEntry nnew;
FstabEntry old;
};
void readFiles();
+
AsciiFile* findFile( const FstabEntry& e, AsciiFile*& fstab,
- AsciiFile*& cryptotab, int& lineno );
+ AsciiFile*& cryptotab, int& lineno ) const;
bool findCrtab( const FstabEntry& e, const AsciiFile& crtab,
- int& lineno );
+ int& lineno ) const;
bool findCrtab( const string& device, const AsciiFile& crtab,
- int& lineno );
- void makeStringList( const FstabEntry& e, std::list<string>& ls );
- void makeCrtabStringList( const FstabEntry& e, std::list<string>& ls );
+ int& lineno ) const;
+
+ list<string> makeStringList(const FstabEntry& e) const;
+ list<string> makeCrStringList(const FstabEntry& e) const;
+
string updateLine( const std::list<string>& ol,
- const std::list<string>& nl, const string& line );
+ const std::list<string>& nl, const string& line ) const;
string createLine( const std::list<string>& ls, unsigned fields,
- unsigned* flen );
- string createTabLine( const FstabEntry& e );
- void makeCrStringList( const FstabEntry& e, std::list<string>& ls );
- string createCrtabLine( const FstabEntry& e );
+ unsigned* flen ) const;
+
+ string createTabLine( const FstabEntry& e ) const;
+ string createCrtabLine( const FstabEntry& e ) const;
static unsigned fstabFields[6];
static unsigned cryptotabFields[6];
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.cc Tue Oct 13 18:06:01 2009
@@ -171,6 +171,11 @@
pe = (s - 500)/pe_size;
pvn.num_pe = pvn.free_pe = pe;
pvn.device = d;
+
+ const Volume* v;
+ if (getStorage()->findVolume(d, v) && v->dmcrypt())
+ pvn.dmcryptDevice = v->dmcryptDevice();
+
pv_add.push_back( pvn );
if( !getStorage()->isDisk(d))
getStorage()->changeFormatVolume( d, false, FSNONE );
@@ -197,16 +202,17 @@
return( reduceVg( l ) );
}
+
int
LvmVg::reduceVg( const list<string>& devs )
{
int ret = 0;
- y2mil( "name:" << name() << " devices:" << devs );
- y2mil( "this:" << *this );
+ y2mil("name:" << name() << " devices:" << devs);
+ y2mil("this:" << *this);
+ y2mil("add:" << pv_add.size() << " pv:" << pv.size() << " remove:" << pv_remove.size());
checkConsistency();
- list<string>::const_iterator i=devs.begin();
- list<Pv>::iterator p;
+
list<Pv> pl = pv;
list<Pv> pladd = pv_add;
list<Pv> plrem = pv_remove;
@@ -215,13 +221,15 @@
{
ret = LVM_CHANGE_READONLY;
}
+
+ list<string>::const_iterator i = devs.begin();
while( ret==0 && i!=devs.end() )
{
string d = normalizeDevice( *i );
ret = tryUnusePe( d, pl, pladd, plrem, rem_pe );
++i;
}
- y2mil( "add:" << pv_add.size() << " pv:" << pv.size() << " remove:" << pv_remove.size() );
+
if( ret==0 && pv_add.size()+pv.size()-devs.size()<=0 )
ret = LVM_VG_HAS_NONE_PV;
if( ret == 0 )
@@ -234,9 +242,11 @@
}
if( ret==0 )
checkConsistency();
- y2mil( "this:" << *this );
+
+ y2mil("this:" << *this);
+ y2mil("add:" << pv_add.size() << " pv:" << pv.size() << " remove:" << pv_remove.size());
y2mil("ret:" << ret);
- return( ret );
+ return ret;
}
@@ -785,6 +795,14 @@
addPv( p );
}
p->device = extractNthWord( 2, line );
+
+ const Volume* v;
+ if (getStorage()->findVolume(p->device, v))
+ {
+ p->device = v->device();
+ p->dmcryptDevice = v->dmcryptDevice();
+ }
+
}
else if( line.find( "PV UUID" ) == 0 )
{
@@ -1173,13 +1191,13 @@
string devices;
if( pv_add.size()+pv.size()-pv_remove.size()<=0 )
ret = LVM_VG_HAS_NONE_PV;
- list<Pv>::iterator p = pv_add.begin();
+ list<Pv>::const_iterator p = pv_add.begin();
while( ret==0 && p!=pv_add.end() )
{
if( !devices.empty() )
devices += " ";
- devices += quote(p->device);
- ret = doCreatePv( p->device );
+ devices += quote(p->realDevice());
+ ret = doCreatePv(*p);
++p;
}
if( ret==0 )
@@ -1252,24 +1270,21 @@
y2milestone( "Vg:%s", name().c_str() );
y2mil( "this:" << *this );
int ret = 0;
- list<string> devs;
if( !active )
activate(true);
- list<Pv>::iterator p;
- for( p=pv_add.begin(); p!=pv_add.end(); ++p )
- devs.push_back( p->device );
- list<string>::iterator d = devs.begin();
+ list<Pv> devs = pv_add;
+ list<Pv>::const_iterator d = devs.begin();
while( ret==0 && d!=devs.end() )
{
checkConsistency();
if( !silent )
{
- getStorage()->showInfoCb( extendVgText(true,*d) );
+ getStorage()->showInfoCb(extendVgText(true, d->device));
}
- ret = doCreatePv( *d );
+ ret = doCreatePv(*d);
if( ret==0 )
{
- string cmd = VGEXTENDBIN " " + instSysString() + quote(name()) + " " + quote(*d);
+ string cmd = VGEXTENDBIN " " + instSysString() + quote(name()) + " " + quote(d->realDevice());
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -1282,7 +1297,7 @@
getVgData( name() );
checkConsistency();
}
- p = find( pv_add.begin(), pv_add.end(), *d );
+ list<Pv>::iterator p = find(pv_add.begin(), pv_add.end(), d->device);
if( p!=pv_add.end() )
{
pv_add.erase( p );
@@ -1295,7 +1310,7 @@
checkCreateConstraints();
y2mil( "this:" << *this );
y2mil("ret:" << ret);
- return( ret );
+ return ret;
}
int
@@ -1306,19 +1321,16 @@
int ret = 0;
if( !active )
activate(true);
- list<string> devs;
- list<Pv>::iterator p;
- for( p=pv_remove.begin(); p!=pv_remove.end(); ++p )
- devs.push_back( p->device );
- list<string>::iterator d = devs.begin();
+ list<Pv> devs = pv_remove;
+ list<Pv>::const_iterator d = devs.begin();
while( ret==0 && d!=devs.end() )
{
checkConsistency();
if( !silent )
{
- getStorage()->showInfoCb( reduceVgText(true,*d) );
+ getStorage()->showInfoCb(reduceVgText(true, d->device));
}
- string cmd = VGREDUCEBIN " " + instSysString() + quote(name()) + " " + quote(*d);
+ string cmd = VGREDUCEBIN " " + instSysString() + quote(name()) + " " + quote(d->realDevice());
SystemCmd c( cmd );
if( c.retcode()!=0 )
{
@@ -1330,7 +1342,7 @@
getVgData( name() );
checkConsistency();
}
- p = find( pv_remove.begin(), pv_remove.end(), *d );
+ list<Pv>::iterator p = find(pv_remove.begin(), pv_remove.end(), d->device);
if( p!=pv_remove.end() )
pv_remove.erase( p );
else if( ret==0 )
@@ -1339,7 +1351,7 @@
}
y2mil( "this:" << *this );
y2mil("ret:" << ret);
- return( ret );
+ return ret;
}
int
@@ -1508,7 +1520,7 @@
return( ret );
}
-string LvmVg::metaString()
+string LvmVg::metaString() const
{
return( (lvm1)?"-M1 ":"-M2 " );
}
@@ -1521,20 +1533,22 @@
return( ret );
}
-int LvmVg::doCreatePv( const string& device )
+
+ int
+ LvmVg::doCreatePv(const Pv& pv) const
{
int ret = 0;
- y2milestone( "dev:%s", device.c_str() );
+ y2mil("device:" << pv.device << " realDevice:" << pv.realDevice());
SystemCmd c;
- string cmd = MDADMBIN " --zero-superblock " + quote(device);
+ string cmd = MDADMBIN " --zero-superblock " + quote(pv.realDevice());
c.execute( cmd );
- getStorage()->removeDmTableTo( device );
- if( getStorage()->isDisk(device) )
+ getStorage()->removeDmTableTo(pv.realDevice());
+ if (getStorage()->isDisk(pv.realDevice()))
{
- cmd = PARTEDCMD + quote(device) + " mklabel msdos";
+ cmd = PARTEDCMD + quote(pv.realDevice()) + " mklabel msdos";
c.execute( cmd );
}
- cmd = "echo y | " PVCREATEBIN " -ff " + metaString() + quote(device);
+ cmd = "echo y | " PVCREATEBIN " -ff " + metaString() + quote(pv.realDevice());
c.execute( cmd );
if( c.retcode()!=0 )
{
@@ -1542,9 +1556,10 @@
setExtError( c );
}
y2mil("ret:" << ret);
- return( ret );
+ return ret;
}
+
void LvmVg::normalizeDmDevices()
{
string dm = decString(Dm::dmMajor());
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/LvmVg.h Tue Oct 13 18:06:01 2009
@@ -148,8 +148,9 @@
int doCreate( Volume* v );
int doRemove( Volume* v );
int doResize( Volume* v );
- int doCreatePv( const string& device );
- string metaString();
+ int doCreatePv(const Pv& pv) const;
+
+ string metaString() const;
string instSysString();
void logData( const string& Dir );
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Nfs.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Nfs.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Nfs.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Nfs.cc Tue Oct 13 18:06:01 2009
@@ -32,7 +32,7 @@
#include "y2storage/Container.h"
#include "y2storage/AppUtil.h"
#include "y2storage/Storage.h"
-#include "y2storage/SystemCmd.h"
+
using namespace storage;
using namespace std;
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Partition.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Partition.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Partition.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Partition.cc Tue Oct 13 18:06:01 2009
@@ -452,22 +452,42 @@
}
}
else if( idt != ID_SWAP && idt != ID_LINUX && idt<256 )
+ {
+ if (encryption == ENC_NONE)
{
- // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1
- // %2$s is replaced by size (e.g. 623.5 MB)
- // %3$s is replaced by hexadecimal number (e.g. 8E)
- txt = sformat( _("Create partition %1$s (%2$s) with id=%3$X"),
- d.c_str(), sizeString().c_str(), idt );
+ // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ // %3$s is replaced by hexadecimal number (e.g. 8E)
+ txt = sformat(_("Create partition %1$s (%2$s) with id=%3$X"), d.c_str(),
+ sizeString().c_str(), idt);
}
+ else
+ {
+ // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ // %3$s is replaced by hexadecimal number (e.g. 8E)
+ txt = sformat(_("Create encrypted partition %1$s (%2$s) with id=%3$X"), d.c_str(),
+ sizeString().c_str(), idt);
+ }
+ }
else
+ {
+ if (encryption == ENC_NONE)
{
- // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1
- // %2$s is replaced by size (e.g. 623.5 MB)
- txt = sformat( _("Create partition %1$s (%2$s)"),
- d.c_str(), sizeString().c_str() );
+ // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat(_("Create partition %1$s (%2$s)"), d.c_str(), sizeString().c_str());
+ }
+ else
+ {
+ // displayed text before action, %1$s is replaced by device name e.g. /dev/hda1
+ // %2$s is replaced by size (e.g. 623.5 MB)
+ txt = sformat(_("Create encrypted partition %1$s (%2$s)"), d.c_str(),
+ sizeString().c_str());
}
}
- return( txt );
+ }
+ return txt;
}
string Partition::formatText( bool doing ) const
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.cc Tue Oct 13 18:06:01 2009
@@ -625,17 +625,20 @@
s << " pv_remove:";
printDevList( s, d.pv_remove );
}
- return( s );
+ return s;
}
-std::ostream& operator<< (std::ostream& s, const PeContainer::Pv& v )
+
+ std::ostream& operator<<(std::ostream& s, const PeContainer::Pv& v)
{
- s << "device:" << v.device
- << " PE:" << v.num_pe
- << " Free:" << v.free_pe
- << " Status:" << v.status
- << " UUID:" << v.uuid;
- return( s );
+ s << "device:" << v.device;
+ if (!v.dmcryptDevice.empty())
+ s << " dmcryptDevice:" << v.dmcryptDevice;
+ s << " PE:" << v.num_pe
+ << " Free:" << v.free_pe
+ << " Status:" << v.status
+ << " UUID:" << v.uuid;
+ return s;
}
}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/PeContainer.h Tue Oct 13 18:06:01 2009
@@ -57,12 +57,17 @@
protected:
struct Pv
{
+ Pv() : num_pe(0), free_pe(0) {}
+
string device;
+ string dmcryptDevice;
string uuid;
string status;
unsigned long num_pe;
unsigned long free_pe;
+ string realDevice() const { return dmcryptDevice.empty() ? device : dmcryptDevice; }
+
static bool comp_le( const Pv& a, const Pv& b )
{ return( a.free_pehttp://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc Tue Oct 13 18:06:01 2009
@@ -123,6 +123,8 @@
install_info_cb = NULL;
info_popup_cb = NULL;
yesno_popup_cb = NULL;
+ password_popup_cb = NULL;
+
recursiveRemove = false;
zeroNewPartitions = false;
defaultMountBy = MOUNTBY_ID;
@@ -232,11 +234,12 @@
delete ppart;
ppart = new ProcPart;
}
- detectMds();
detectDmraid( *ppart );
detectDmmultipath( *ppart );
+ detectMds();
+ detectDm(*ppart, true);
detectLvmVgs();
- detectDm( *ppart );
+ detectDm(*ppart, false);
LvmVgPair p = lvgPair();
y2mil( "p length:" << p.length() );
@@ -587,7 +590,7 @@
void
-Storage::detectDm( ProcPart& ppart )
+Storage::detectDm(ProcPart& ppart, bool only_crypt)
{
if( testmode() )
{
@@ -601,14 +604,22 @@
}
else if( getenv( "YAST2_STORAGE_NO_DM" )==NULL )
{
- DmCo * v = new DmCo( this, true, ppart );
- if( !v->isEmpty() )
+ DmCo* v = NULL;
+ if (haveDm(v))
{
- addToList( v );
- v->updateDmMaps();
+ v->second(true, ppart, only_crypt);
+ }
+ else
+ {
+ v = new DmCo(this, true, ppart, only_crypt);
+ if (!v->isEmpty() )
+ {
+ addToList( v );
+ v->updateDmMaps();
+ }
+ else
+ delete v;
}
- else
- delete v;
}
}
@@ -2266,7 +2277,7 @@
}
else if( findVolume( device, cont, vol ) )
{
- ret = vol->setEncryption( val, typ );
+ ret = vol->setEncryption(val, typ, true);
}
else
{
@@ -3294,6 +3305,21 @@
return( i != p.end() );
}
+
+ bool
+ Storage::haveDm(DmCo*& dm)
+ {
+ dm = NULL;
+ CPair p = cPair();
+ ContIterator i = p.begin();
+ while (i != p.end() && i->type() != DM)
+ ++i;
+ if (i != p.end())
+ dm = static_cast(&(*i));
+ return i != p.end();
+ }
+
+
bool Storage::haveNfs( NfsCo*& co )
{
co = NULL;
@@ -4909,7 +4935,8 @@
return( ub.type() );
}
-void Storage::progressBarCb( const string& id, unsigned cur, unsigned max )
+
+void Storage::progressBarCb(const string& id, unsigned cur, unsigned max) const
{
y2milestone( "id:%s cur:%d max:%d", id.c_str(), cur, max );
CallbackProgressBar cb = getCallbackProgressBarTheOne();
@@ -4917,7 +4944,7 @@
(*cb)( id, cur, max );
}
-void Storage::showInfoCb( const string& info )
+void Storage::showInfoCb(const string& info)
{
y2milestone( "INSTALL INFO:%s", info.c_str() );
CallbackShowInstallInfo cb = getCallbackShowInstallInfoTheOne();
@@ -4926,7 +4953,7 @@
(*cb)( info );
}
-void Storage::infoPopupCb( const string& info )
+void Storage::infoPopupCb(const string& info) const
{
y2milestone( "INFO POPUP:%s", info.c_str() );
CallbackInfoPopup cb = getCallbackInfoPopupTheOne();
@@ -4934,13 +4961,13 @@
(*cb)( info );
}
-void Storage::addInfoPopupText( const string& disk, const string txt )
+void Storage::addInfoPopupText(const string& disk, const string& txt)
{
y2mil( "d:" << disk << " txt:" << txt );
infoPopupTxts.push_back( make_pair(disk,txt) );
}
-bool Storage::yesnoPopupCb( const string& info )
+bool Storage::yesnoPopupCb(const string& info) const
{
y2milestone( "YESNO POPUP:%s", info.c_str() );
CallbackYesNoPopup cb = getCallbackYesNoPopupTheOne();
@@ -4950,6 +4977,18 @@
return( true );
}
+bool
+Storage::passwordPopupCb(const string& device, int attempts, string& password) const
+{
+ y2mil("PASSWORD POPUP device:" << device << " attempts:" << attempts);
+ CallbackPasswordPopup cb = getCallbackPasswordPopupTheOne();
+ if (cb)
+ return (*cb)(device, attempts, password);
+ else
+ return false;
+}
+
+
Storage::DiskIterator Storage::findDisk( const string& disk )
{
assertInit();
@@ -5930,7 +5969,12 @@
Storage::SkipDeleted Storage::SkipDel;
-storage::CallbackProgressBar Storage::progress_bar_cb_ycp;
-storage::CallbackShowInstallInfo Storage::install_info_cb_ycp;
-storage::CallbackInfoPopup Storage::info_popup_cb_ycp;
-storage::CallbackYesNoPopup Storage::yesno_popup_cb_ycp;
+namespace storage
+{
+ // workaround for broken YCP bindings
+ CallbackProgressBar progress_bar_cb_ycp = NULL;
+ CallbackShowInstallInfo install_info_cb_ycp = NULL;
+ CallbackInfoPopup info_popup_cb_ycp = NULL;
+ CallbackYesNoPopup yesno_popup_cb_ycp = NULL;
+ CallbackPasswordPopup password_popup_cb_ycp = NULL;
+}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.h Tue Oct 13 18:06:01 2009
@@ -55,6 +55,13 @@
namespace storage
{
+ // workaround for broken YCP bindings
+ extern CallbackProgressBar progress_bar_cb_ycp;
+ extern CallbackShowInstallInfo install_info_cb_ycp;
+ extern CallbackInfoPopup info_popup_cb_ycp;
+ extern CallbackYesNoPopup yesno_popup_cb_ycp;
+ extern CallbackPasswordPopup password_popup_cb_ycp;
+
template <int Value>
class CheckType
{
@@ -503,54 +510,35 @@
string byteToHumanString(unsigned long long size, bool classic, int precision, bool omit_zeroes) const;
bool humanStringToByte(const string& str, bool classic, unsigned long long& size) const;
- void setCallbackProgressBar( storage::CallbackProgressBar pfnc )
- { progress_bar_cb=pfnc; }
- storage::CallbackProgressBar getCallbackProgressBar() const
- { return progress_bar_cb; }
- void setCallbackShowInstallInfo( storage::CallbackShowInstallInfo pfnc )
- { install_info_cb=pfnc; }
- storage::CallbackShowInstallInfo getCallbackShowInstallInfo() const
- { return install_info_cb; }
- void setCallbackInfoPopup( storage::CallbackInfoPopup pfnc )
- { info_popup_cb=pfnc; }
- storage::CallbackInfoPopup getCallbackInfoPopup() const
- { return info_popup_cb; }
- void setCallbackYesNoPopup( storage::CallbackYesNoPopup pfnc )
- { yesno_popup_cb=pfnc; }
- storage::CallbackYesNoPopup getCallbackYesNoPopup() const
- { return yesno_popup_cb; }
- void addInfoPopupText( const string& disk, const string txt );
-
- static void setCallbackProgressBarYcp( storage::CallbackProgressBar pfnc )
- { progress_bar_cb_ycp=pfnc; }
- static storage::CallbackProgressBar getCallbackProgressBarYcp()
- { return progress_bar_cb_ycp; }
- static void setCallbackShowInstallInfoYcp( storage::CallbackShowInstallInfo pfnc )
- { install_info_cb_ycp=pfnc; }
- static storage::CallbackShowInstallInfo getCallbackShowInstallInfoYcp()
- { return install_info_cb_ycp; }
- static void setCallbackInfoPopupYcp( storage::CallbackInfoPopup pfnc )
- { info_popup_cb_ycp=pfnc; }
- static storage::CallbackInfoPopup getCallbackInfoPopupYcp()
- { return info_popup_cb_ycp; }
- static void setCallbackYesNoPopupYcp( storage::CallbackYesNoPopup pfnc )
- { yesno_popup_cb_ycp=pfnc; }
- static storage::CallbackYesNoPopup getCallbackYesNoPopupYcp()
- { return yesno_popup_cb_ycp; }
-
- storage::CallbackProgressBar getCallbackProgressBarTheOne() const
- { return progress_bar_cb ? progress_bar_cb : progress_bar_cb_ycp; }
- storage::CallbackShowInstallInfo getCallbackShowInstallInfoTheOne() const
- { return install_info_cb ? install_info_cb : install_info_cb_ycp; }
- storage::CallbackInfoPopup getCallbackInfoPopupTheOne() const
- { return info_popup_cb ? info_popup_cb : info_popup_cb_ycp; }
- storage::CallbackYesNoPopup getCallbackYesNoPopupTheOne() const
- { return yesno_popup_cb ? yesno_popup_cb : yesno_popup_cb_ycp; }
-
- void progressBarCb( const string& id, unsigned cur, unsigned max );
- void showInfoCb( const string& info );
- void infoPopupCb( const string& info );
- bool yesnoPopupCb( const string& info );
+ void setCallbackProgressBar(CallbackProgressBar pfnc) { progress_bar_cb = pfnc; }
+ CallbackProgressBar getCallbackProgressBar() const { return progress_bar_cb; }
+ void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) { install_info_cb = pfnc; }
+ CallbackShowInstallInfo getCallbackShowInstallInfo() const { return install_info_cb; }
+ void setCallbackInfoPopup(CallbackInfoPopup pfnc) { info_popup_cb = pfnc; }
+ CallbackInfoPopup getCallbackInfoPopup() const { return info_popup_cb; }
+ void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) { yesno_popup_cb = pfnc; }
+ CallbackYesNoPopup getCallbackYesNoPopup() const { return yesno_popup_cb; }
+ void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) { password_popup_cb = pfnc; }
+ CallbackPasswordPopup getCallbackPasswordPopup() const { return password_popup_cb; }
+
+ void addInfoPopupText( const string& disk, const string& txt );
+
+ CallbackProgressBar getCallbackProgressBarTheOne() const
+ { return progress_bar_cb ? progress_bar_cb : progress_bar_cb_ycp; }
+ CallbackShowInstallInfo getCallbackShowInstallInfoTheOne() const
+ { return install_info_cb ? install_info_cb : install_info_cb_ycp; }
+ CallbackInfoPopup getCallbackInfoPopupTheOne() const
+ { return info_popup_cb ? info_popup_cb : info_popup_cb_ycp; }
+ CallbackYesNoPopup getCallbackYesNoPopupTheOne() const
+ { return yesno_popup_cb ? yesno_popup_cb : yesno_popup_cb_ycp; }
+ CallbackPasswordPopup getCallbackPasswordPopupTheOne() const
+ { return password_popup_cb ? password_popup_cb : password_popup_cb_ycp; }
+
+ void progressBarCb(const string& id, unsigned cur, unsigned max) const;
+ void showInfoCb(const string& info);
+ void infoPopupCb(const string& info) const;
+ bool yesnoPopupCb(const string& info) const;
+ bool passwordPopupCb(const string& device, int attempts, string& password) const;
// iterators over container
protected:
@@ -1690,7 +1678,7 @@
void detectLvmVgs();
void detectDmraid( ProcPart& ppart );
void detectDmmultipath( ProcPart& ppart );
- void detectDm( ProcPart& ppart );
+ void detectDm(ProcPart& ppart, bool only_crypt);
void initDisk( DiskData& data, ProcPart& pp );
void detectFsData( const VolIterator& begin, const VolIterator& end,
ProcMounts& mounts );
@@ -1718,6 +1706,7 @@
bool findContainer( const string& device, ContIterator& c );
bool haveMd( MdCo*& md );
+ bool haveDm(DmCo*& dm);
bool haveNfs( NfsCo*& co );
bool haveLoop( LoopCo*& loop );
int removeContainer( Container* val, bool call_del=true );
@@ -1762,14 +1751,12 @@
CCont cont;
EtcFstab *fstab;
- storage::CallbackProgressBar progress_bar_cb;
- storage::CallbackShowInstallInfo install_info_cb;
- storage::CallbackInfoPopup info_popup_cb;
- storage::CallbackYesNoPopup yesno_popup_cb;
- static storage::CallbackProgressBar progress_bar_cb_ycp;
- static storage::CallbackShowInstallInfo install_info_cb_ycp;
- static storage::CallbackInfoPopup info_popup_cb_ycp;
- static storage::CallbackYesNoPopup yesno_popup_cb_ycp;
+ CallbackProgressBar progress_bar_cb;
+ CallbackShowInstallInfo install_info_cb;
+ CallbackInfoPopup info_popup_cb;
+ CallbackYesNoPopup yesno_popup_cb;
+ CallbackPasswordPopup password_popup_cb;
+
friend std::ostream& operator<< (std::ostream& s, Storage &v );
unsigned max_log_num;
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.cc Tue Oct 13 18:06:01 2009
@@ -66,6 +66,16 @@
using namespace storage;
+namespace storage
+{
+ // workaround for broken YCP bindings
+ extern CallbackProgressBar progress_bar_cb_ycp;
+ extern CallbackShowInstallInfo install_info_cb_ycp;
+ extern CallbackInfoPopup info_popup_cb_ycp;
+ extern CallbackYesNoPopup yesno_popup_cb_ycp;
+ extern CallbackPasswordPopup password_popup_cb_ycp;
+}
+
class Y2StorageCallbackFunction : public Y2Function
{
unsigned int m_position;
@@ -226,6 +236,7 @@
static Y2Function* show_install_info = NULL;
static Y2Function* info_popup = NULL;
static Y2Function* yesno_popup = NULL;
+static Y2Function* password_popup = NULL;
void progress_bar_callback( const string& id, unsigned cur, unsigned max )
{
@@ -280,6 +291,28 @@
return ret;
}
+bool password_popup_callback(const string& device, int attempts, string& password)
+{
+ bool ret = false;
+
+ if (password_popup)
+ {
+ password_popup->reset();
+ password_popup->appendParameter(YCPString(device));
+ password_popup->appendParameter(YCPInteger(attempts));
+ password_popup->appendParameter(YCPString(password));
+ password_popup->finishParameters();
+
+ YCPValue tmp1 = password_popup->evaluateCall();
+ YCPList tmp2 = tmp1->asList();
+
+ ret = tmp2->value(0)->asBoolean()->value();
+ password = tmp2->value(1)->asString()->value();
+ }
+
+ return ret;
+}
+
YCPValue
StorageCallbacks::ProgressBar (const YCPString & callback)
@@ -322,7 +355,7 @@
return YCPVoid ();
}
- Storage::setCallbackProgressBarYcp (progress_bar_callback);
+ storage::progress_bar_cb_ycp = progress_bar_callback;
return YCPVoid ();
}
@@ -368,7 +401,7 @@
return YCPVoid ();
}
- Storage::setCallbackShowInstallInfoYcp (show_install_info_callback);
+ storage::install_info_cb_ycp = show_install_info_callback;
return YCPVoid ();
}
@@ -414,7 +447,7 @@
return YCPVoid ();
}
- Storage::setCallbackInfoPopupYcp (info_popup_callback);
+ storage::info_popup_cb_ycp = info_popup_callback;
return YCPVoid ();
}
@@ -460,7 +493,54 @@
return YCPVoid ();
}
- Storage::setCallbackYesNoPopupYcp (yesno_popup_callback);
+ storage::yesno_popup_cb_ycp = yesno_popup_callback;
+
+ return YCPVoid ();
+}
+
+
+YCPValue
+StorageCallbacks::PasswordPopup (const YCPString & callback)
+{
+ string name_r = callback->value ();
+
+ y2debug ("Registering callback %s", name_r.c_str ());
+ string::size_type colonpos = name_r.find("::");
+
+ if ( colonpos == string::npos )
+ {
+ ycp2error ("Specify namespace and the fuction name for a callback");
+ return YCPVoid ();
+ }
+
+ string module = name_r.substr ( 0, colonpos );
+ string name = name_r.substr ( colonpos + 2 );
+
+ Y2Component *c = Y2ComponentBroker::getNamespaceComponent (module.c_str ());
+ if (c == NULL)
+ {
+ ycp2error ("No component can provide namespace %s for a callback of %s",
+ module.c_str (), name.c_str ());
+ return YCPVoid ();
+ }
+
+ Y2Namespace *ns = c->import (module.c_str ());
+ if (ns == NULL)
+ {
+ y2error ("No namespace %s for a callback of %s", module.c_str (),
+ name.c_str ());
+ return YCPVoid ();
+ }
+
+ password_popup = ns->createFunctionCall (name, Type::Unspec);
+ if (password_popup == NULL)
+ {
+ ycp2error ("Cannot find function %s in module %s as a callback",
+ name.c_str(), module.c_str () );
+ return YCPVoid ();
+ }
+
+ storage::password_popup_cb_ycp = password_popup_callback;
return YCPVoid ();
}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageCallbacks.h Tue Oct 13 18:06:01 2009
@@ -79,6 +79,8 @@
YCPValue InfoPopup (const YCPString& func);
/* TYPEINFO: void(string) */
YCPValue YesNoPopup (const YCPString& func);
+ /* TYPEINFO: void(string) */
+ YCPValue PasswordPopup (const YCPString& func);
/**
* Constructor.
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageInterface.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageInterface.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageInterface.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/StorageInterface.h Tue Oct 13 18:06:01 2009
@@ -142,27 +142,34 @@
/**
* typedef for a pointer to a function that is called on progress bar events
*/
- typedef void (*CallbackProgressBar)( const string& id, unsigned cur, unsigned max );
+ typedef void (*CallbackProgressBar)(const string& id, unsigned cur, unsigned max);
/**
* typedef for a pointer to a function that is called with strings
* telling the user what is currently going on
*/
- typedef void (*CallbackShowInstallInfo)( const string& id );
+ typedef void (*CallbackShowInstallInfo)(const string& id);
/**
* typedef for a pointer to a function that displays a popup with
* the given text and waits for user confirmation
*/
- typedef void (*CallbackInfoPopup)( const string& text );
+ typedef void (*CallbackInfoPopup)(const string& text);
/**
- * typedef for a pointer to a function that displays a popup with
- * the given text and two buttons labels "Yes" and "No". The user
- * has to press on of these buttons. If he presses "Yes" true is
- * returned, false otherwise.
+ * typedef for a pointer to a function that displays a popup with the
+ * given text and two buttons labels "Yes" and "No". The user has to press
+ * on of these buttons. If the user presses "Yes" true is returned, false
+ * otherwise.
+ */
+ typedef bool (*CallbackYesNoPopup)(const string& text);
+
+ /**
+ * typedef for a pointer to a function that ask for the password of the
+ * given device. If the user does not want to decrypt the device false is
+ * returned, true otherwise.
*/
- typedef bool (*CallbackYesNoPopup)( const string& text );
+ typedef bool (*CallbackPasswordPopup)(const string& device, int attempts, string& password);
/**
@@ -1898,7 +1905,7 @@
*
* @param pfnc pointer to function
*/
- virtual void setCallbackProgressBar( CallbackProgressBar pfnc ) = 0;
+ virtual void setCallbackProgressBar(CallbackProgressBar pfnc) = 0;
/**
* Query the callback function called on progress bar events
@@ -1913,7 +1920,7 @@
*
* @param pfnc pointer to function
*/
- virtual void setCallbackShowInstallInfo( CallbackShowInstallInfo pfnc ) = 0;
+ virtual void setCallbackShowInstallInfo(CallbackShowInstallInfo pfnc) = 0;
/**
* Query the callback function called to display install info
@@ -1929,7 +1936,7 @@
*
* @param pfnc pointer to function
*/
- virtual void setCallbackInfoPopup( CallbackInfoPopup pfnc ) = 0;
+ virtual void setCallbackInfoPopup(CallbackInfoPopup pfnc) = 0;
/**
* Query the callback function called to display info popup to the
@@ -1946,7 +1953,7 @@
*
* @param pfnc pointer to function
*/
- virtual void setCallbackYesNoPopup( CallbackYesNoPopup pfnc ) = 0;
+ virtual void setCallbackYesNoPopup(CallbackYesNoPopup pfnc) = 0;
/**
* Query the callback function called to get a Yes/No decision by
@@ -1956,6 +1963,22 @@
*/
virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
+
+ /**
+ * Sets the callback function called to query a password by the user.
+ *
+ * @param pfnc pointer to function.
+ */
+ virtual void setCallbackPasswordPopup(CallbackPasswordPopup pfnc) = 0;
+
+ /**
+ * Query the callback function called to query a password from the
+ * user.
+ *
+ * @return pointer to function currently called for password queries.
+ */
+ virtual CallbackPasswordPopup getCallbackPasswordPopup() const = 0;
+
#endif
/**
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc Tue Oct 13 18:06:01 2009
@@ -1326,7 +1326,9 @@
return( ret );
}
-int Volume::setEncryption( bool val, EncryptType typ )
+
+ int
+ Volume::setEncryption(bool val, EncryptType typ, bool force)
{
int ret = 0;
y2milestone( "val:%d typ:%d", val, typ );
@@ -1340,6 +1342,7 @@
{
is_loop = false;
encryption = ENC_NONE;
+ dmcrypt_dev.clear();
crypt_pwd.erase();
}
else
@@ -1348,15 +1351,22 @@
ret = VOLUME_CRYPT_NO_PWD;
if( ret == 0 && cType()==NFSC )
ret = VOLUME_CRYPT_NFS_IMPOSSIBLE;
- if( ret==0 && (format||loop_active) )
+ if (ret == 0 && (create || format || loop_active))
{
encryption = typ;
is_loop = cont->type()==LOOP;
+ dmcrypt_dev = getDmcryptName();
}
- if( ret==0 && !format && !loop_active )
- {
- if( detectEncryption()==ENC_UNKNOWN )
+ if (ret == 0 && !create && !format && !loop_active)
+ {
+ if( detectEncryption()==ENC_UNKNOWN && !force)
ret = VOLUME_CRYPT_NOT_DETECTED;
+ else if (force)
+ {
+ encryption = typ;
+ is_loop = cont->type()==LOOP;
+ dmcrypt_dev = getDmcryptName();
+ }
}
}
}
@@ -1906,7 +1916,7 @@
pwdfile << crypt_pwd;
pwdfile.close();
SystemCmd cmd;
- if( format || (isTmpCryptMp(mp)&&crypt_pwd.empty()) )
+ if( (encryption != orig_encryption) || format || (isTmpCryptMp(mp)&&crypt_pwd.empty()) )
{
string cmdline = getCryptsetupCmd( encryption, dmcrypt_dev, mp, fname, true,
crypt_pwd.empty() );
@@ -1944,7 +1954,11 @@
replaceAltName( "/dev/dm-", Dm::dmDeviceName(mnr) );
}
else
+ {
getMajorMinor( dmcrypt_dev, dummy, minor );
+ replaceAltName("/dev/dm-", Dm::dmDeviceName(minor));
+ }
+
ProcPart p;
unsigned long long sz;
if( p.getSize( Dm::dmDeviceName(minor), sz ))
@@ -1975,10 +1989,16 @@
if( ret!=0 && losetup_done )
loUnsetup();
}
- if( ret==0 )
- updateFsData();
+ if (ret == 0)
+ {
+ updateFsData();
+ }
+ if (ret == 0 && encryption != ENC_NONE)
+ {
+ doFstabUpdate();
+ }
y2mil("ret:" << ret);
- return( ret );
+ return ret;
}
string Volume::labelText( bool doing ) const
@@ -2285,6 +2305,10 @@
l.push_back( new commitAction( FORMAT, cont->type(),
formatText(false), this, true ));
}
+ else if (encryption != orig_encryption)
+ {
+ l.push_back(new commitAction(FORMAT, cont->type(), crsetupText(false), this, true));
+ }
else if( mp != orig_mp ||
(cont->getStorage()->instsys()&&mp=="swap") )
{
@@ -2420,22 +2444,23 @@
{
EtcFstab* fstab = cont->getStorage()->getFstab();
FstabEntry entry;
- if( !orig_mp.empty() && (deleted()||mp.empty()) &&
- (fstab->findDevice( dev, entry ) ||
- fstab->findDevice( alt_names, entry ) ||
- (cType()==LOOP && fstab->findMount( orig_mp, entry )) ||
- (cType()==LOOP && fstab->findMount( mp, entry )) ))
+ if ((!orig_mp.empty() || orig_encryption != ENC_NONE) &&
+ (deleted() || (mp.empty() && encryption == ENC_NONE)) &&
+ (fstab->findDevice( dev, entry ) ||
+ fstab->findDevice( alt_names, entry ) ||
+ (cType()==LOOP && fstab->findMount( orig_mp, entry )) ||
+ (cType()==LOOP && fstab->findMount( mp, entry )) ))
{
changed = true;
if( !silent() )
{
cont->getStorage()->showInfoCb(
- fstab->removeText( true, entry.crypto, entry.mount ));
+ fstab->removeText(true, entry.cryptotab, entry.mount));
}
y2milestone( "before removeEntry" );
ret = fstab->removeEntry( entry );
}
- else if( !mp.empty() && !deleted() )
+ else if ((!mp.empty() || encryption != ENC_NONE) && !deleted())
{
string fname;
if( fstab->findDevice( dev, entry ) ||
Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.h Tue Oct 13 18:06:01 2009
@@ -101,7 +101,8 @@
storage::EncryptType getEncryption() const { return encryption; }
void setEncryption( storage::EncryptType val=storage::ENC_LUKS )
{ encryption=orig_encryption=val; }
- virtual int setEncryption( bool val, storage::EncryptType typ=storage::ENC_LUKS );
+ virtual int setEncryption(bool val, storage::EncryptType typ = storage::ENC_LUKS,
+ bool force = false);
const string& getCryptPwd() const { return crypt_pwd; }
int setCryptPwd( const string& val );
void clearCryptPwd() { crypt_pwd.erase(); }
Modified: branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes Tue Oct 13 18:06:01 2009
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Tue Oct 13 16:56:16 CEST 2009 - aschnell@suse.de
+
+- implemented support for encrypted physical volumes (fate #305633)
+- 2.17.79
+
+-------------------------------------------------------------------
Mon Oct 12 17:46:12 CEST 2009 - aschnell@suse.de
- do not abort if device cannot be zeroed (bnc #502967)
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/auto_part_ui.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/auto_part_ui.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/auto_part_ui.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/auto_part_ui.ycp Tue Oct 13 18:06:01 2009
@@ -280,6 +280,9 @@
`Left(`HBox(`HSpacing(3), `CheckBox(`id(`lvm), `opt(`notify),
// Label text
_("Create &LVM Based Proposal"), cfg["prop_lvm"]:false ))));
+ vb = add(vb,
+ `Left(`HBox(`HSpacing(7), `CheckBox(`id(`encrypt), `opt(`notify),
+ _("Encrypt Volume Group")))));
vbox = add (vbox, `VSpacing(1.5) );
term frame = `HVCenter(`Frame( _("Proposal type"), `HVCenter(vb) ));
vbox = add (vbox, frame );
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_dialogs.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_dialogs.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_dialogs.ycp Tue Oct 13 18:06:01 2009
@@ -33,12 +33,12 @@
include "partitioning/partition_defines.ycp";
include "partitioning/custom_part_helptexts.ycp";
+ include "partitioning/custom_part_check_generated.ycp";
// TODO: cleanup
boolean check_unique_label( map targetMap, map part );
boolean CheckFstabOptions( map part );
- symbol check_devices_used( list<map> partitions, boolean not_cr );
define string DlgCreateCryptFs( string device, integer minpwlen, boolean format,
@@ -100,10 +100,8 @@
`HSpacing(4)
),
`VSpacing(3),
- `HBox(
- // Ok button
+ `ButtonBox(
`PushButton(`id("ok"), `opt(`default), Label::OKButton()),
- // Cancel button
`PushButton(`id("cancel"), Label::CancelButton())
),
`VSpacing(0.5)
@@ -111,75 +109,114 @@
)
));
- string ret = "";
- boolean input_is_ok = false;
- string pw1 = "";
- string pw2 = "";
+ string password = "";
+ symbol widget = nil;
repeat
{
// Clear password fields on every round.
- UI::ChangeWidget(`id("pw1"), `Value, "");
- UI::ChangeWidget(`id("pw2"), `Value, "");
+ UI::ChangeWidget(`id(`pw1), `Value, "");
+ UI::ChangeWidget(`id(`pw2), `Value, "");
- UI::SetFocus(`id("pw1"));
+ UI::SetFocus(`id(`pw1));
- ret = (string) UI::UserInput();
+ widget = (symbol) UI::UserInput();
-
- if (ret != "cancel")
+ switch (widget)
{
- pw1 = (string)UI::QueryWidget(`id("pw1"), `Value);
- pw2 = (string)UI::QueryWidget(`id("pw2"), `Value);
+ case `ok:
- if ( pw1 != pw2 )
- {
- // popup text
- Popup::Message(_("The first and the second version\nof the password do not match!\nPlease try again."));
+ password = (string) UI::QueryWidget(`id(`pw1), `Value);
+ string tmp = (string) UI::QueryWidget(`id(`pw2), `Value);
+
+ if (!Storage::CheckEncryptionPasswords(password, tmp, minpwlen, tmpcrypt))
+ widget = `again;
+
+ break;
}
- else if( pw1=="" && !tmpcrypt )
+
+ } until (widget == `cancel || widget == `ok);
+
+ UI::CloseDialog();
+
+ if (widget == `ok)
{
- // popup text
- Popup::Message(_("You did not enter a password.
-Try again.
-"));
+ return password;
}
- else if( size(pw1) < minpwlen && !tmpcrypt )
+ else
{
- // popup text
- Popup::Message(sformat(_("The password must have at least %1 characters.
-Try again.
-"),minpwlen));
+ return "";
}
- else if( size(pw1)>=minpwlen || tmpcrypt )
- {
- any ret2 = findfirstnotof( pw1, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#* ,.;:._-+!$%&/|\?{[()]}@^\\<>" );
- if ( ret2 != nil && size(pw1)>0 )
+ }
+
+
+ boolean QueryProposalPassword()
+ {
+ if (size(Storage::ProposalPassword()) != 0)
+ return true;
+
+ UI::OpenDialog(`VBox(
+ `Label(_("Enter your password for the proposal encryption.")),
+ `MinWidth(40,
+ `Password(`id(`pw1),
+ // Label: get password for user root
+ // Please use newline if label is longer than 40 characters
+ _("Password:"), "")),
+ `VSpacing(0.5),
+ `MinWidth(40,
+ `Password(`id(`pw2),
+ // Label: get same password again for verification
+ // Please use newline if label is longer than 40 characters
+ _("Reenter the password for verification:"), "")),
+ `Label(_("Don't forget what you enter here!")),
+ `ButtonBox(
+ `PushButton(`id(`ok), `opt(`default), Label::OKButton()),
+ `PushButton(`id(`cancel), Label::CancelButton())
+ )
+ ));
+
+ string password = "";
+ symbol widget = nil;
+
+ repeat
{
- // popup text
- Popup::Message(_("The password may only contain the following characters:
- 0..9, a..z, A..Z, and any of \"@#* ,.;:._-+!$%&/|\?{[()]}^\\<>\".
-Try again."));
- }
- else
+ // Clear password fields on every round.
+ UI::ChangeWidget(`id(`pw1), `Value, "");
+ UI::ChangeWidget(`id(`pw2), `Value, "");
+
+ UI::SetFocus(`id(`pw1));
+
+ widget = (symbol) UI::UserInput();
+
+ switch (widget)
{
- input_is_ok = true;
+ case `ok:
+
+ password = (string) UI::QueryWidget(`id(`pw1), `Value);
+ string tmp = (string) UI::QueryWidget(`id(`pw2), `Value);
+
+ if (!Storage::CheckEncryptionPasswords(password, tmp, 8, false))
+ widget = `again;
+
+ break;
}
- }
- }
- } until ( input_is_ok || ret == "cancel" );
+ } until (widget == `cancel || widget == `ok);
UI::CloseDialog();
- if (ret == "cancel")
+ if (widget == `ok)
{
- pw1 = "";
+ Storage::SetProposalPassword(password);
+ return true;
}
- y2milestone( "DlgCreateCryptFs size(ret):%1", size(pw1) );
- return( pw1 );
+ else
+ {
+ return false;
}
+ }
+
//////////////////////////////////////////////////////////////////////////////
// Dialog Password for Crypted FS Update
@@ -903,27 +940,31 @@
fs_sel[`swap,"selected"]:false ));
}
- term CryptWidget = `Empty();
- if( !Arch::s390 () )
- {
+ return `VBox(
+ `ComboBox(`id(`fs), `opt(`hstretch, `notify),
+ // label text
+ _("File &system"), filesystems),
+ `PushButton(`id(`fs_options), `opt(`hstretch),
+ // button text
+ _("O&ptions..."))
+ );
+ }
+
+
+ term CryptButton(map new_val)
+ {
+ if (Arch::s390())
+ return `Empty();
+
boolean cr = new_val["enc_type"]:`none != `none;
- CryptWidget = `VBox( // `VSpacing(0.7),
- `Left(`CheckBox(`id(`crypt_fs), `opt(`notify),
- // button text
- _("&Encrypt file system"), cr )));
- }
- return `VBox(
- `ReplacePoint( `id(`type_dlg_rp),
- `ComboBox(`id(`fs), `opt(`hstretch, `notify),
- // label text
- _("File &system"), filesystems )),
- `PushButton( `id(`fs_options ), `opt(`hstretch),
- // button text
- _("O&ptions...") ),
- CryptWidget );
+ return `VBox(
+ `Left(`CheckBox(`id(`crypt_fs), `opt(`notify),
+ // button text
+ _("&Encrypt device"), cr)));
}
+
/**
* Dialogpart: Filesystem ID
* @parm new_val map that contains a partition
@@ -980,6 +1021,7 @@
};
+// used by autoyast
define term FormatDlg( map new_val, map file_systems )
``{
y2debug( "FormatDlg val:%1", new_val );
@@ -1006,7 +1048,7 @@
}
// label text
- return `Frame (substring(_("2:Format"),2),
+ return `Frame (_("Format"),
`RadioButtonGroup(`id(`format),
`VBox(
`VSpacing(1),
@@ -1020,7 +1062,8 @@
`HBox(
`HSpacing(2),
FileSystemsComboBox( new_val, file_systems )),
- `VSpacing(0.5)
+ CryptButton(new_val),
+ `VSpacing(0.5)
)));
@@ -1492,5 +1535,4 @@
return(go_on);
};
-
}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/custom_part_lib.ycp Tue Oct 13 18:06:01 2009
@@ -994,10 +994,6 @@
if( no_fs )
{
UI::ChangeWidget( `id(`do_not_mount), `Value, true);
- if( UI::WidgetExists( `id(`crypt_fs) ))
- {
- UI::ChangeWidget( `id(`crypt_fs), `Enabled, false );
- }
ChangeExistingSymbolsState( [ `fs_options, `fs ], false );
}
else if( fs_int == Partitions::fsid_native )
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/do_proposal_flexible.ycp Tue Oct 13 18:06:01 2009
@@ -166,6 +166,36 @@
return( tc );
}
+
+map EncryptDevices(map target, string vg)
+{
+ if (!Storage::ProposalLvm() || !Storage::ProposalEncrypt())
+ return target;
+
+ list<string> devices = target[vg, "devices_add"]:[];
+ y2milestone("devices:%1", devices);
+
+ // go through target map and set enc_type and password for all devices used by
+ // our volume group
+ target = mapmap(string disk_device, map data, target, {
+ list<map> partitions = data["partitions"]:[];
+ partitions = maplist(map partition, partitions, {
+ string part_device = partition["device"]:"";
+ if (contains(devices, part_device))
+ {
+ partition["enc_type"] = `luks;
+ Storage::UpdateClassified(part_device, Storage::ProposalPassword());
+ }
+ return partition;
+ });
+ data["partitions"] = partitions;
+ return $[ disk_device : data ];
+ });
+
+ return target;
+}
+
+
define map do_flexible_disk( map disk )
``{
string dev = disk["device"]:"";
@@ -3702,6 +3732,7 @@
y2milestone( "get_proposal_vm vkey %1", vg );
ret["target",vg_key] = modify_vm( vg, opts, size(r)==0 );
ret["target",ddev] = disk;
+ ret["target"] = EncryptDevices(ret["target"]:$[], vg_key);
ret["target"] = Storage::SpecialBootHandling( ret["target"]:$[] );
y2milestone( "get_proposal_vm sol:%1", disk );
}
@@ -3713,9 +3744,8 @@
{
map ret = $[];
string vg = Storage::ProposalVM();
- y2milestone( "get_inst_prop vg:%1 evms:%2 lvm:%3 home:%4", vg,
- Storage::ProposalEvms(), Storage::ProposalLvm(),
- Storage::ProposalHome() );
+ y2milestone("get_inst_prop vg:%1 home:%2 lvm:%3 encypt:%4", vg,
+ Storage::ProposalHome(), Storage::ProposalLvm(), Storage::ProposalEncrypt());
if( size(vg)==0 )
{
if( has_flex_proposal() )
@@ -3727,6 +3757,7 @@
{
y2milestone( "target:%1", target );
ret = get_inst_prop_vm( target, vg );
+ ret["target"] = EncryptDevices(ret["target"]:$[], "/dev/" + vg);
}
return( ret );
}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-all.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-all.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-all.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-all.ycp Tue Oct 13 18:06:01 2009
@@ -12,8 +12,8 @@
{
string short_hostname = Hostname::CurrentHostname();
- list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size,
- `format, `type, `fs_type, `label,
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size, `format,
+ `encrypted, `type, `fs_type, `label,
`mount_point, `mount_by, `used_by ]);
map target_map = Storage::GetTargetMap();
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dialogs.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dialogs.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dialogs.ycp Tue Oct 13 18:06:01 2009
@@ -16,6 +16,10 @@
formatted and the desired file system type.</p>");
// helptext
+ helptext = helptext + _("<p>Changing the encryption on an existing
+volume will delete all data on it.</p>");
+
+ // helptext
helptext = helptext + _("<p>Then, choose whether the partition should
be mounted and enter the mount point (/, /boot, /usr, /var, etc.).</p>");
@@ -61,13 +65,7 @@
// returns true also when password can be omitted (e.g. encrypted swap)
boolean NeedPassword()
{
- if (!crypt_fs)
- return false;
-
- if (data["create"]:false && !do_format)
- return false;
-
- return true;
+ return crypt_fs;
}
@@ -146,7 +144,9 @@
`VSpacing(0.45),
`LeftRadioButtonWithAttachment(`id(`do_not_format), `opt(`notify),
_("Do not format partition"),
- tmp1)
+ tmp1),
+ `VSpacing(0.45),
+ CryptButton(data)
)
)
),
@@ -481,9 +481,7 @@
MiniWorkflow::SetContents(Greasemonkey::Transform(contents), MiniWorkflowStepPasswordHelptext(data));
MiniWorkflow::SetLastStep(true);
- string pw1 = "";
- string pw2 = "";
-
+ string password = "";
symbol widget = nil;
//don't put those inside the loop - they'd be reset after each unsuccesful try
@@ -496,57 +494,24 @@
if (widget == `next)
{
- pw1 = (string) UI::QueryWidget(`id(`pw1), `Value);
- pw2 = (string) UI::QueryWidget(`id(`pw2), `Value);
+ password = (string) UI::QueryWidget(`id(`pw1), `Value);
+ string tmp = (string) UI::QueryWidget(`id(`pw2), `Value);
- if ( pw1 != pw2 )
- {
- // popup text
- Popup::Message(_("The first and the second version\nof the password do not match!\nPlease try again."));
- UI::SetFocus(`id(`pw1) );
- widget = `again;
- }
- else if (pw1 == "" && !empty_pw_allowed)
+ if (!Storage::CheckEncryptionPasswords(password, tmp, min_pw_len, empty_pw_allowed))
{
- // popup text
- Popup::Message(_("You did not enter a password.
-Try again.
-"));
UI::SetFocus(`id(`pw1) );
widget = `again;
}
- else if (size(pw1) < min_pw_len && !empty_pw_allowed)
- {
- // popup text
- Popup::Message(sformat(_("The password must have at least %1 characters.
-Try again.
-"), min_pw_len));
- UI::SetFocus(`id(`pw1) );
- widget = `again;
}
- else if (size(pw1) >= min_pw_len || empty_pw_allowed)
- {
- any ret2 = findfirstnotof( pw1, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#* ,.;:._-+!$%&/|\?{[()]}@^\\<>" );
- if ( ret2 != nil && size(pw1)>0 )
- {
- // popup text
- Popup::Message(_("The password may only contain the following characters:
-0..9, a..z, A..Z, and any of \"@#* ,.;:._-+!$%&/|\?{[()]}^\\<>\".
-Try again."));
- UI::SetFocus(`id(`pw1) );
- widget = `again;
- }
}
- }
- }
until (widget == `abort || widget == `back || widget == `next);
if (widget == `next)
{
if (data["type"]:`unknown != `loop)
- Storage::UpdateClassified(data["device"]:"", pw1);
+ Storage::UpdateClassified(data["device"]:"", password);
else
- Storage::UpdateClassified(data["fpath"]:"", pw1);
+ Storage::UpdateClassified(data["fpath"]:"", password);
widget = `finish;
}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dm.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dm.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dm.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-dm.ycp Tue Oct 13 18:06:01 2009
@@ -19,8 +19,9 @@
return StorageFields::PredicateDiskType(disk, partition, [`CT_DM]);
}
- list<symbol> fields = StorageSettings::FilterTable([ `device, `size, `format, `type, `fs_type,
- `label, `mount_point, `mount_by, `used_by ]);
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `size, `format, `encrypted, `type,
+ `fs_type, `label, `mount_point, `mount_by,
+ `used_by ]);
map target_map = Storage::GetTargetMap();
@@ -102,7 +103,7 @@
}
list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size,
- `format, `type, `used_by ]);
+ `format, `encrypted, `type, `used_by ]);
map target_map = Storage::GetTargetMap();
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-hd.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-hd.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-hd.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-hd.ycp Tue Oct 13 18:06:01 2009
@@ -36,8 +36,8 @@
}
list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size, `format,
- `type, `fs_type, `label, `mount_point, `mount_by,
- `start_cyl, `end_cyl, `used_by ]);
+ `encrypted, `type, `fs_type, `label, `mount_point,
+ `mount_by, `start_cyl, `end_cyl, `used_by ]);
map target_map = Storage::GetTargetMap();
@@ -273,8 +273,8 @@
}
list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size, `format,
- `type, `fs_type, `label, `mount_point, `mount_by,
- `start_cyl, `end_cyl, `used_by ]);
+ `encrypted, `type, `fs_type, `label, `mount_point,
+ `mount_by, `start_cyl, `end_cyl, `used_by ]);
map target_map = Storage::GetTargetMap();
@@ -369,7 +369,7 @@
}
list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size,
- `format, `type, `used_by ]);
+ `format, `encrypted, `type, `used_by ]);
map target_map = Storage::GetTargetMap();
@@ -441,10 +441,10 @@
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageSettings::FilterOverview([ `heading_device, `device, `size, `udev_path,
- `udev_id, `used_by, `fs_id, `heading_filesystem,
- `fs_type, `mount_point, `mount_by, `uuid,
- `label, `encrypted ]);
+ list<symbol> fields = StorageSettings::FilterOverview([ `heading_device, `device, `size, `encrypted,
+ `udev_path, `udev_id, `used_by, `fs_id,
+ `heading_filesystem, `fs_type, `mount_point,
+ `mount_by, `uuid, `label ]);
UI::ReplaceWidget(`tree_panel,
Greasemonkey::Transform(
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm-dialogs.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm-dialogs.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm-dialogs.ycp Tue Oct 13 18:06:01 2009
@@ -185,7 +185,7 @@
integer pesize = 4*1024*1024;
list<string> pvs = [];
- list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size ]);
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size, `encrypted, `type ]);
list<map> unused_pvs = filter(map pv, get_possible_pvs(target_map), { return pv["used_by"]:"" == ""; });
@@ -273,7 +273,7 @@
string vgname = data["name"]:"error";
list<string> pvs_new = [];
- list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size ]);
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size, `encrypted, `type ]);
map target_map = Storage::GetTargetMap();
list<map> unused_pvs = filter(map pv, get_possible_pvs(target_map), { return pv["used_by_device"]:"" == ""; });
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-lvm.ycp Tue Oct 13 18:06:01 2009
@@ -19,9 +19,9 @@
return StorageFields::PredicateDiskType(disk, partition, [`CT_LVM]);
}
- list<symbol> fields = StorageSettings::FilterTable([ `device, `size, `format, `type, `fs_type,
- `label, `mount_point, `mount_by, `used_by,
- `lvm_metadata, `pe_size, `stripes ]);
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `size, `format, `encrypted, `type,
+ `fs_type, `label, `mount_point, `mount_by,
+ `used_by, `lvm_metadata, `pe_size, `stripes ]);
map target_map = Storage::GetTargetMap();
@@ -122,9 +122,9 @@
return StorageFields::PredicateDiskDevice(disk, partition, [ device ]);
}
- list<symbol> fields = StorageSettings::FilterTable([ `device, `size, `format, `type, `fs_type,
- `label, `mount_point, `mount_by, `used_by,
- `stripes ]);
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `size, `format, `encrypted, `type,
+ `fs_type, `label, `mount_point, `mount_by,
+ `used_by, `stripes ]);
map target_map = Storage::GetTargetMap();
@@ -194,7 +194,7 @@
}
list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size,
- `format, `type, `used_by ]);
+ `format, `encrypted, `type, `used_by ]);
map target_map = Storage::GetTargetMap();
@@ -257,10 +257,10 @@
string device = (string) user_data;
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageSettings::FilterOverview([ `heading_device, `device, `size, `used_by,
- `heading_lvm, `stripes, `heading_filesystem,
- `fs_type, `mount_point, `mount_by, `uuid,
- `label, `encrypted ]);
+ list<symbol> fields = StorageSettings::FilterOverview([ `heading_device, `device, `size, `encrypted,
+ `used_by, `heading_lvm, `stripes,
+ `heading_filesystem, `fs_type, `mount_point,
+ `mount_by, `uuid, `label ]);
UI::ReplaceWidget(`tree_panel,
Greasemonkey::Transform(
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid-dialogs.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid-dialogs.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid-dialogs.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid-dialogs.ycp Tue Oct 13 18:06:01 2009
@@ -96,7 +96,7 @@
return sizeK;
}
- list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size ]);
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size, `encrypted, `type ]);
map target_map = Storage::GetTargetMap();
list<map> unused_devices = filter(map dev, get_possible_rds(target_map), { return dev["used_by"]:"" == "" &&
@@ -297,7 +297,7 @@
return sizeK;
}
- list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size ]);
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size, `encrypted, `type ]);
map target_map = Storage::GetTargetMap();
list<map> unused_devices = filter(map dev, get_possible_rds(target_map), { return dev["used_by_device"]:"" == ""; });
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-raid.ycp Tue Oct 13 18:06:01 2009
@@ -19,9 +19,9 @@
return StorageFields::PredicateDiskType(disk, partition, [`CT_MD]);
}
- list<symbol> fields = StorageSettings::FilterTable([ `device, `size, `format, `type, `fs_type, `label,
- `mount_point, `mount_by, `used_by, `raid_type,
- `chunk_size ]);
+ list<symbol> fields = StorageSettings::FilterTable([ `device, `size, `format, `encrypted, `type,
+ `fs_type, `label, `mount_point, `mount_by,
+ `used_by, `raid_type, `chunk_size ]);
map target_map = Storage::GetTargetMap();
@@ -70,11 +70,11 @@
map target_map = Storage::GetTargetMap();
- list<symbol> fields = StorageSettings::FilterOverview([ `heading_device, `device, `size, `used_by,
- `heading_md, `raid_type, `chunk_size,
+ list<symbol> fields = StorageSettings::FilterOverview([ `heading_device, `device, `size, `encrypted,
+ `used_by, `heading_md, `raid_type, `chunk_size,
`parity_algorithm, `heading_filesystem,
`fs_type, `mount_point, `mount_by, `uuid,
- `label, `encrypted ]);
+ `label ]);
UI::ReplaceWidget(`tab_panel,
`VBox(
@@ -132,7 +132,7 @@
}
list<symbol> fields = StorageSettings::FilterTable([ `device, `udev_path, `udev_id, `size,
- `format, `type, `used_by ]);
+ `format, `encrypted, `type, `used_by ]);
map target_map = Storage::GetTargetMap();
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-settings.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-settings.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-settings.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/ep-settings.ycp Tue Oct 13 18:06:01 2009
@@ -22,7 +22,9 @@
// list entry
$[ `label : _("Cylinder information"), `fields : toset([ `start_cyl, `end_cyl, `num_cyl, `cyl_size ]) ],
// list entry
- $[ `label : _("Fibre Channel information"), `fields : toset([ `fc_wwpn, `fc_fcp_lun, `fc_port_id ]) ]
+ $[ `label : _("Fibre Channel information"), `fields : toset([ `fc_wwpn, `fc_fcp_lun, `fc_port_id ]) ],
+ // list entry
+ $[ `label : _("Encryption"), `fields : [ `encrypted ] ]
];
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/lvm_pv_lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/lvm_pv_lib.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/lvm_pv_lib.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/lvm_pv_lib.ycp Tue Oct 13 18:06:01 2009
@@ -193,6 +193,7 @@
list fsids = [ Partitions::fsid_lvm, Partitions::fsid_raid,
Partitions::fsid_native ];
list ubs = [ `UB_NONE, `UB_LVM, `UB_EVMS ];
+ list allowed_enc_types = [ `none, `luks ];
foreach( string dev, map devmap, targetMap,
``{
@@ -201,6 +202,7 @@
filter( map part, devmap["partitions"]:[],
``( size(part["mount"]:"")==0 &&
!contains( types_no, part["type"]:`primary ) &&
+ contains(allowed_enc_types, part["enc_type"]:`none) &&
contains( ubs, part["used_by_type"]:`UB_NONE ) &&
(part["type"]:`primary==`sw_raid||
part["type"]:`primary==`dm||
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/raid_lib.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/raid_lib.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/raid_lib.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/include/raid_lib.ycp Tue Oct 13 18:06:01 2009
@@ -57,11 +57,14 @@
list fsids = [ Partitions::fsid_lvm, Partitions::fsid_raid,
Partitions::fsid_native ];
list ubs = [ `UB_NONE, `UB_MD ];
+ list allowed_enc_types = [ `none ];
+
foreach( string dev, map devmap, targetMap,
``{
ret = filter( map p, devmap["partitions"]:[],
``( size(p["mount"]:"")==0 &&
!contains( types_no, p["type"]:`primary ) &&
+ contains(allowed_enc_types, p["enc_type"]:`none) &&
contains( ubs, p["used_by_type"]:`UB_NONE ) &&
(!haskey(p,"fsid")||contains( fsids, p["fsid"]:0 ))));
allret = (list<map>)merge(allret, ret );
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_disk_proposal.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_disk_proposal.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_disk_proposal.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_disk_proposal.ycp Tue Oct 13 18:06:01 2009
@@ -32,6 +32,8 @@
include "wizard/sequencer.ycp";
include "partitioning/custom_part_check_generated.ycp";
include "partitioning/do_proposal_flexible.ycp";
+ include "partitioning/custom_part_dialogs.ycp";
+
define boolean AskOverwriteChanges()
``{
@@ -115,22 +117,18 @@
return Storage::GetExitKey();
}
-string title = "";
-string modify_str = "";
-string detailed_str = "";
-string lvm_str = "";
-string part_str = "";
-
// Title for dialogue
-title = _("Suggested Partitioning");
+string title = _("Suggested Partitioning");
// Radiobutton for partition dialog
-modify_str = _("&Edit Partition Setup...");
+string modify_str = _("&Edit Partition Setup...");
// Radiobutton for partition dialog
-detailed_str = _("&Create Partition Setup...");
+string detailed_str = _("&Create Partition Setup...");
// Radiobutton for partition dialog
-part_str = _("&Partition Based");
+string part_str = _("&Partition Based");
// Radiobutton for partition dialog
-lvm_str = _("&LVM Based");
+string lvm_str = _("&LVM Based");
+// Checkbox for partition dialog
+string encrypt_str = _("Encrypt Volume Group");
string target_is = "";
@@ -175,11 +173,13 @@
term rframe =
`HBox(
`HSpacing(3),
- `MinWidth(20,`Left( `RadioButton( `id(`part), `opt(`notify), part_str,
- !Storage::ProposalLvm() ))),
+ `Top(`MinWidth(20,`Left( `RadioButton( `id(`part), `opt(`notify), part_str,
+ !Storage::ProposalLvm() )))),
`HSpacing(3),
- `MinWidth(20,`Left( `RadioButton( `id(`lvm), `opt(`notify), lvm_str,
- Storage::ProposalLvm() ))),
+ `Top(`MinWidth(20, `VBox(`Left(`RadioButton(`id(`lvm), `opt(`notify), lvm_str,
+ Storage::ProposalLvm())),
+ `HBox(`HSpacing(4), `CheckBox(`id(`encrypt), `opt(`notify), encrypt_str,
+ Storage::ProposalEncrypt()))))),
`HSpacing(3)
);
@@ -259,10 +259,11 @@
any r = nil;
+ UI::ChangeWidget(`id(`encrypt), `Enabled, Storage::ProposalLvm());
+
repeat
{
- symbol old_mode = (symbol)UI::QueryWidget( `id("prop_mode"),
- `CurrentButton );
+ symbol old_mode = (symbol) UI::QueryWidget(`id("prop_mode"), `CurrentButton);
y2milestone( "old_mode %1", old_mode );
Wizard::SetFocusToNextButton();
ret = (symbol)Wizard::UserInput();
@@ -271,15 +272,45 @@
if( ret == `abort && Popup::ReallyAbort(true) )
return `abort;
- if( contains( [ `lvm, `part ], ret ) )
+ if( contains( [ `lvm, `part, `encrypt ], ret ) )
{
if( AskOverwriteChanges() )
{
target_is = "SUGGESTION";
- if( ret==`lvm )
- Storage::SetProposalLvm(true);
- else
- Storage::SetProposalLvm(false);
+
+ switch (ret)
+ {
+ case `part:
+ Storage::SetProposalLvm(false);
+ UI::ChangeWidget(`id(`encrypt), `Enabled, false);
+ break;
+
+ case `lvm:
+ Storage::SetProposalLvm(true);
+ UI::ChangeWidget(`id(`encrypt), `Enabled, true);
+ break;
+
+ case `encrypt:
+
+ if ((boolean) UI::QueryWidget(`id(`encrypt), `Value))
+ {
+ if (QueryProposalPassword())
+ {
+ Storage::SetProposalEncrypt(true);
+ }
+ else
+ {
+ UI::ChangeWidget(`id(`encrypt), `Value, false);
+ continue;
+ }
+ }
+ else
+ {
+ Storage::SetProposalEncrypt(false);
+ }
+ break;
+ }
+
Storage::ResetOndiskTarget();
Storage::AddMountPointsForWin(Storage::GetTargetMap());
map prop = get_inst_prop( Storage::GetTargetMap());
@@ -332,10 +363,10 @@
UI::ChangeWidget( `id("richtext"), `Value, changes );
if( ret==`detailed )
{
- if( Storage::ProposalLvm() )
- UI::ChangeWidget( `id("prop_mode"), `CurrentButton, `lvm );
- else
- UI::ChangeWidget( `id("prop_mode"), `CurrentButton, `part );
+ UI::ChangeWidget(`id(`part), `Value, !Storage::ProposalLvm());
+ UI::ChangeWidget(`id(`lvm), `Value, Storage::ProposalLvm());
+ UI::ChangeWidget(`id(`encrypt), `Enabled, Storage::ProposalLvm());
+ UI::ChangeWidget(`id(`encrypt), `Value, Storage::ProposalEncrypt());
}
}
} until ( ret == `next || ret == `back || ret == `cancel );
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_target_part.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_target_part.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_target_part.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/inst_target_part.ycp Tue Oct 13 18:06:01 2009
@@ -14,13 +14,11 @@
{
textdomain "storage";
- import "Arch";
import "Mode";
import "Popup";
import "Storage";
import "Partitions";
import "Product";
- import "FileSystems";
import "Label";
import "Popup";
@@ -58,6 +56,7 @@
include "partitioning/auto_part_prepare.ycp";
include "partitioning/auto_part_ui.ycp";
include "partitioning/auto_part_create.ycp";
+ include "partitioning/custom_part_dialogs.ycp";
// Displays a popup with the message (can be dismissed with OK).
// After that only `abort or `back is allowed
@@ -215,6 +214,8 @@
if( disable_full && UI::WidgetExists( `id(`full) ))
UI::ChangeWidget( `id(`full), `Enabled, false );
+ UI::ChangeWidget(`id(`encrypt), `Enabled, (boolean) UI::QueryWidget(`id(`lvm), `Value));
+
// Event handling
symbol ret = nil;
@@ -229,6 +230,18 @@
{
break;
}
+ else if (ret == `lvm)
+ {
+ UI::ChangeWidget(`id(`encrypt), `Enabled, (boolean) UI::QueryWidget(`id(`lvm), `Value));
+ }
+ else if (ret == `encrypt)
+ {
+ if ((boolean) UI::QueryWidget(`id(`encrypt), `Value))
+ {
+ if (!QueryProposalPassword())
+ UI::ChangeWidget(`id(`encrypt), `Value, false);
+ }
+ }
else if (ret == `full)
{
// Set all checkboxes
@@ -394,17 +407,15 @@
y2milestone ("partitions '%1'", partitions);
// Check selection for plausability
- string reason = nil;
Storage::SetProposalHome( (boolean)UI::QueryWidget( `id(`home), `Value ));
- if( (boolean)UI::QueryWidget( `id(`lvm), `Value )==true )
- Storage::SetProposalLvm(true);
- else
- Storage::SetProposalLvm(false);
+ Storage::SetProposalLvm((boolean) UI::QueryWidget(`id(`lvm), `Value));
+ Storage::SetProposalEncrypt((boolean) UI::QueryWidget(`id(`encrypt), `Value));
+
ok = create_partitions( targetMap, target, partitions );
Storage::SetProposalDefault(true);
if( !ok )
{
- reason = _("Too few partitions are marked for removal
+ string reason = _("Too few partitions are marked for removal
or the disk is too small.
To install Linux, select more partitions to
remove or select a larger disk.");
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/Storage.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/Storage.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/Storage.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/Storage.ycp Tue Oct 13 18:06:01 2009
@@ -170,8 +170,12 @@
`CT_LOOP : 4, `CT_DM : 5, `CT_LVM : 6, `CT_NFS : 7 ];
list<string> hw_packages = [];
list<string> no_propose_disks = nil;
-boolean proposal_lvm = false;
+
boolean proposal_home = false;
+boolean proposal_lvm = false;
+boolean proposal_encrypt = false;
+string proposal_password = "";
+
map cfg_xml = $[];
string part_insts = "";
@@ -6276,31 +6280,55 @@
global boolean ProposalHome()
- {
+{
return( proposal_home );
- }
+}
global void SetProposalHome(boolean val)
- {
+{
proposal_home = val;
y2milestone( "SetProposalHome val:%1", proposal_home );
- }
+}
+
+global boolean ProposalLvm()
+{
+ return proposal_lvm;
+}
global void SetProposalLvm(boolean val)
- {
+{
proposal_lvm = val;
- y2milestone("SetProposalLvm val:%1 lvm:%2", val, proposal_lvm);
- }
+ y2milestone("SetProposalLvm val:%1", proposal_lvm);
+}
+
+global boolean ProposalEncrypt()
+{
+ return proposal_encrypt;
+}
+
+global void SetProposalEncrypt(boolean val)
+{
+ proposal_encrypt = val;
+ y2milestone("SetProposalEncrypt val:%1", val);
+}
+
+global string ProposalPassword()
+{
+ return proposal_password;
+}
+
+global void SetProposalPassword(string val)
+{
+ proposal_password = val;
+ y2milestone("SetProposalPassword");
+}
+
global boolean ProposalEvms()
{
return false;
}
-global boolean ProposalLvm()
- {
- return( proposal_lvm );
- }
global void SetProposalDefault( boolean home_only )
{
@@ -6310,14 +6338,16 @@
if( cfg_xml["prop_lvm"]:false )
{
SetProposalLvm(true);
+ SetProposalEncrypt(false);
+ SetProposalPassword("");
}
else
{
SetProposalLvm(false);
}
}
- y2milestone("SetProposalDefault lvm:%1 home:%2 home_only:%3",
- proposal_lvm, proposal_home, home_only);
+ y2milestone("SetProposalDefault home:%1 lvm:%2 encypt:%3 home_only:%4", proposal_home,
+ proposal_lvm, proposal_encrypt, home_only);
}
@@ -6558,5 +6588,49 @@
return size(LibStorage::StorageInterface::getCommitActions( sint, true ));
}
+ global boolean CheckEncryptionPasswords(string pw1, string pw2, integer min_length, boolean empty_allowed)
+ {
+ if (pw1 != pw2)
+ {
+ // popup text
+ Popup::Message(_("The first and the second version\nof the password do not match.
+Try again."));
+ return false;
+}
+
+ if (size(pw1) == 0 && !empty_allowed)
+ {
+ // popup text
+ Popup::Message(_("You did not enter a password.
+Try again.
+"));
+ return false;
+ }
+
+ if (size(pw1) < min_length && !empty_allowed)
+ {
+ // popup text
+ Popup::Message(sformat(_("The password must have at least %1 characters.
+Try again.
+"), min_length));
+ return false;
+ }
+
+ if (size(pw1) >= min_length || empty_allowed)
+ {
+ any tmp = findfirstnotof( pw1, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ#* ,.;:._-+!$%&/|\?{[()]}@^\\<>" );
+ if (tmp != nil && size(pw1) > 0)
+ {
+ // popup text
+ Popup::Message(_("The password may only contain the following characters:
+ 0..9, a..z, A..Z, and any of \"@#* ,.;:._-+!$%&/|\?{[()]}^\\<>\".
+Try again."));
+ return false;
+ }
+ }
+
+ return true;
+ }
+
}
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageClients.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageClients.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageClients.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageClients.ycp Tue Oct 13 18:06:01 2009
@@ -79,6 +79,42 @@
`yes );
}
+
+global list<any> PasswordPopup(string device, integer attempts, string password)
+{
+ y2milestone("PasswordPopup device:%1 attempts:%2", device, attempts);
+
+ password = "";
+
+ UI::OpenDialog(
+ `opt(`decorated),
+ `VBox(
+ `Password(`id(`password),
+ // Label: get password for device
+ // Please use newline if label is longer than 40 characters
+ sformat(_("&Enter password for device %1:"), device), password),
+ `ButtonBox(
+ // Ok button
+ `PushButton(`id(`ok), `opt(`default), Label::OKButton()),
+ // Cancel button
+ `PushButton(`id(`cancel), Label::CancelButton())
+ )
+ )
+ );
+
+ UI::SetFocus(`id(`password));
+
+ symbol ret = (symbol) UI::UserInput();
+
+ if (ret == `ok)
+ password = (string) UI::QueryWidget(`id(`password), `Value);
+
+ UI::CloseDialog();
+
+ return [ ret == `ok, password ];
+}
+
+
global define void InstallCallbacks()
{
y2milestone( "InstallCallbacks" );
@@ -86,6 +122,7 @@
StorageCallbacks::ShowInstallInfo ("StorageClients::ShowInstallInfo");
StorageCallbacks::InfoPopup ("StorageClients::InfoPopup");
StorageCallbacks::YesNoPopup ("StorageClients::YesNoPopup");
+ StorageCallbacks::PasswordPopup("StorageClients::PasswordPopup");
}
} // module StorageClients
Modified: branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageFields.ycp
URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageFields.ycp?rev=59009&r1=59008&r2=59009&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageFields.ycp (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/StorageFields.ycp Tue Oct 13 18:06:01 2009
@@ -98,7 +98,12 @@
case `format:
// Column header, abbreviation for "format" (to format a partition)
- header = add(header, `Right(_("F")));
+ header = add(header, `Center(_("F")));
+ break;
+
+ case `encrypted:
+ // Column header, , abbreviation for "encrypted" (an encrypted device)
+ header = add(header, `Center(_("Enc")));
break;
case `fs_type:
@@ -252,8 +257,8 @@
case `encrypted:
// helptext for table column and overview entry
- ret = ret + _("<b>Encrypted</b> shows whether the file system
-is encrypted.");
+ ret = ret + _("<b>Encrypted</b> shows whether the device is
+encrypted.");
break;
case `end_cyl:
@@ -288,9 +293,8 @@
case `format:
// helptext for table column and overview entry
- ret = ret + _("<b>Format</b> shows some flags: <tt>C</tt>
-means the partition is encrypted. <tt>F</tt> means the partition is selected
-to be formatted.");
+ ret = ret + _("<b>Format</b> shows some flags: <tt>F</tt>
+means the device is selected to be formatted.");
break;
case `fs_id:
@@ -511,8 +515,6 @@
if (disk["dasdfmt"]:false)
value = value + "X";
} else {
- if (part["enc_type"]:`none != `none)
- value = value + "C";
if (part["format"]:false)
value = value + "F";
}
@@ -525,12 +527,21 @@
case `encrypted:
{
- string value = BooleanToHumanString(data["enc_type"]:`none != `none);
+ boolean value = data["enc_type"]:`none != `none;
if (style == `table)
- return value;
+ {
+ if (value)
+ {
+ return "E";
+ }
+ else
+ return "";
+ }
else
+ {
// row label, %1 is replace by "Yes" or "No"
- return sformat(_("Encrypted: %1"), value);
+ return sformat(_("Encrypted: %1"), BooleanToHumanString(value));
+ }
}
case `fs_type:
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org