Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] r58770 - in /branches/SuSE-Code-11-SP1-Branch/storage: ./ libstorage/examples/ libstorage/src/ libstorage/testsuite-real/ libstorage/testsuite/ package/ storage/src/modules/
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Fri, 25 Sep 2009 10:19:24 -0000
  • Message-id: <E1Mr7td-0004TQ-DB@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Fri Sep 25 12:19:24 2009
New Revision: 58770

URL: http://svn.opensuse.org/viewcvs/yast?rev=58770&view=rev
Log:
- added environment parameter to Storage constructor and factories
- pass instsys flag from YCP to libstorage (bnc #399390)

Removed:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/common.cc
Modified:
branches/SuSE-Code-11-SP1-Branch/storage/VERSION
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDisk.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDiskLog.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLoop.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLvm.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestMd.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestProbing.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestStorage.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.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/StorageInterface.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Volume.cc

branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate1.cc

branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate2.cc

branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend1.cc

branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend2.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/Makefile.am
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/common.h
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/format1.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/fstab1.cc

branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring1.cc

branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring2.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_create.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_extend.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/md_create.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/partition1.cc
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/uuid1.cc
branches/SuSE-Code-11-SP1-Branch/storage/package/yast2-storage.changes
branches/SuSE-Code-11-SP1-Branch/storage/storage/src/modules/Storage.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=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/VERSION (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/VERSION Fri Sep 25 12:19:24 2009
@@ -1 +1 @@
-2.17.75
+2.17.76

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDisk.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDisk.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDisk.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDisk.cc
Fri Sep 25 12:19:24 2009
@@ -14,7 +14,7 @@
{
int ret;
initDefaultLogger();
- StorageInterface* s = createDefaultStorageInterface();
+ StorageInterface* s = createStorageInterface(Environment(false));
string disk = "/dev/hdb";
string dev;
ret = s->destroyPartitionTable( disk, s->defaultDiskLabel() );

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDiskLog.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDiskLog.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDiskLog.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestDiskLog.cc
Fri Sep 25 12:19:24 2009
@@ -15,7 +15,7 @@
{
int ret;
initDefaultLogger();
- StorageInterface* s = createDefaultStorageInterface();
+ StorageInterface* s = createStorageInterface(Environment(false));
string dev;
ret = s->destroyPartitionTable( "/dev/hdb", s->defaultDiskLabel() );
if( ret ) cerr << "retcode:" << ret << endl;

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLoop.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLoop.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLoop.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLoop.cc
Fri Sep 25 12:19:24 2009
@@ -49,8 +49,7 @@
{
int ret = 0;
initDefaultLogger();
- //StorageInterface* s = createStorageInterface(false,true);
- StorageInterface* s = createDefaultStorageInterface();
+ StorageInterface* s = createStorageInterface(Environment(false));
s->setCallbackProgressBar( scrollbarCb );
s->setCallbackShowInstallInfo( installInfoCb );
string disk = "/dev/hdb";

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLvm.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLvm.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLvm.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestLvm.cc Fri
Sep 25 12:19:24 2009
@@ -47,8 +47,7 @@
{
int ret = 0;
initDefaultLogger();
- //StorageInterface* s = createStorageInterface(false,true);
- StorageInterface* s = createDefaultStorageInterface();
+ StorageInterface* s = createStorageInterface(Environment(false));
s->setCallbackProgressBar( scrollbarCb );
s->setCallbackShowInstallInfo( installInfoCb );
string disk = "/dev/hdb";

Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestMd.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestMd.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestMd.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestMd.cc Fri
Sep 25 12:19:24 2009
@@ -49,8 +49,7 @@
{
int ret = 0;
initDefaultLogger();
- //StorageInterface* s = createStorageInterface(false,true);
- StorageInterface* s = createDefaultStorageInterface();
+ StorageInterface* s = createStorageInterface(Environment(false));
s->setCallbackProgressBar( scrollbarCb );
s->setCallbackShowInstallInfo( installInfoCb );
string disk = "/dev/hdb";

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestProbing.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestProbing.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestProbing.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestProbing.cc
Fri Sep 25 12:19:24 2009
@@ -19,7 +19,7 @@
main (int argc, char** argv)
{
initDefaultLogger();
- StorageInterface* s = createStorageInterface (true, false, true);
+ StorageInterface* s = createStorageInterface(Environment(false));

deque<ContainerInfo> containers;
s->getContainers (containers);

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestStorage.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestStorage.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestStorage.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/examples/TestStorage.cc
Fri Sep 25 12:19:24 2009
@@ -55,7 +55,7 @@
main( int argc_iv, char** argv_ppcv )
{
Storage::initDefaultLogger();
- Storage Sto( true, false, true );
+ Storage Sto(Environment(true));
for( Storage::ConstContIterator i=Sto.contBegin(); i!=Sto.contEnd(); ++i )
{
cout << *i << endl;

Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.cc Fri Sep 25
12:19:24 2009
@@ -429,7 +429,7 @@
if( detected_label.empty() )
detected_label = dlabel;
if( dlabel.empty() )
- dlabel = defaultLabel(getStorage(), size_k);
+ dlabel = defaultLabel(getStorage()->efiBoot(), size_k);
setLabelData( dlabel );

if (label == "unsupported")
@@ -992,10 +992,10 @@
#define PB (1024ULL * 1024ULL * 1024ULL * 1024ULL)

string
-Disk::defaultLabel(const Storage& storage, unsigned long long size_k)
+Disk::defaultLabel(bool efiboot, unsigned long long size_k)
{
string ret = "msdos";
- if (storage.efiBoot())
+ if (efiboot)
ret = "gpt";
else if( Storage::arch()=="ia64" )
ret = "gpt";
@@ -1007,7 +1007,7 @@
ret = "amiga";
if( size_k>2*TB )
ret = "gpt";
- y2mil("efiboot:" << storage.efiBoot() << " size_k:" << size_k << " ret:"
<< ret);
+ y2mil("efiboot:" << efiboot << " size_k:" << size_k << " ret:" << ret);
return ret;
}

@@ -2059,7 +2059,7 @@
Disk::getPartedValues( Partition *p )
{
bool ret = false;
- if( getStorage()->test() )
+ if( getStorage()->testmode() )
{
ret = true;
p->setSize( p->sizeK() );
@@ -2107,7 +2107,7 @@
unsigned long long& end )
{
bool ret = false;
- if( getStorage()->test() )
+ if( getStorage()->testmode() )
{
ret = true;
start = p->cylStart()*new_head*new_sector;

Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h (original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Disk.h Fri Sep 25
12:19:24 2009
@@ -202,7 +202,7 @@
void logData( const string& Dir );
void setLabelData( const string& );

- static string defaultLabel( const Storage&, unsigned long long size_k );
+ static string defaultLabel(bool efiboot, unsigned long long size_k);
static label_info labels[];
static string p_disks[];


Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/src/Storage.cc?rev=58770&r1=58769&r2=58770&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 Fri Sep
25 12:19:24 2009
@@ -71,27 +71,33 @@
}


-Storage::Storage( bool ronly, bool tmode, bool autodetec )
- : lock(ronly, tmode), readonly(ronly), testmode(tmode), initialized(false),
- autodetect(autodetec)
+namespace storage
+{
+ std::ostream& operator<<(std::ostream& s, const Environment& env)
+ {
+ return s << "readonly:" << env.readonly << " testmode:" << env.testmode
+ << " autodetect:" << env.autodetect << " instsys:" <<
env.instsys
+ << " logdir:" << env.logdir << " testdir:" << env.testdir;
+ }
+}
+
+
+Storage::Storage(const Environment& env)
+ : env(env), lock(readonly(), testmode()), initialized(false)
{
- y2mil("constructed Storage ronly:" << ronly << " testmode:" << testmode <<
- " autodetect:" << autodetect);
+ y2mil("constructed Storage with " << env);
y2mil("package string \"" PACKAGE_STRING "\"");
char * tenv = getenv( "YAST_IS_RUNNING" );
- inst_sys = tenv!=NULL && strcmp(tenv,"instsys")==0;
- root_mounted = !inst_sys;
+ root_mounted = !instsys();
efiboot = false;
hald_pid = 0;
- if( !testmode )
- testmode = getenv( "YAST2_STORAGE_TMODE" )!=NULL;
+
max_log_num = 5;
tenv = getenv( "Y2MAXLOGNUM" );
- logdir = "/var/log/YaST2";
if( tenv!=0 )
string(tenv) >> max_log_num;
- y2mil("instsys:" << inst_sys << " testmode:" << testmode << " autodetect:"
<< autodetect <<
- " log:" << max_log_num);
+ y2mil("max_log_num:" << max_log_num);
+
progress_bar_cb = NULL;
install_info_cb = NULL;
info_popup_cb = NULL;
@@ -153,24 +159,13 @@
setDefaultMountBy( MOUNTBY_LABEL );
}
}
- if( autodetect )
+
+ if( autodetect() )
{
detectArch();
efiboot = (arch() == "ia64");
}
- if( testmode )
- {
- char * tenv = getenv( "YAST2_STORAGE_TDIR" );
- if( tenv!=NULL && strlen(tenv)>0 )
- {
- logdir = testdir = tenv;
- }
- else
- {
- testdir = logdir;
- }
- }
- y2mil("instsys:" << inst_sys << " testdir:" << testdir);
+
detectObjects();
setCacheChanges( true );
dumpObjectList();
@@ -227,12 +222,12 @@
for( LvmVgIterator i=p.begin(); i!=p.end(); ++i )
i->normalizeDmDevices();

- if( testmode )
+ if( testmode() )
{
SystemCmd::testmode = true;
- rootprefix = testdir;
+ rootprefix = testdir();
fstab = new EtcFstab( rootprefix );
- string t = testdir+"/volume_info";
+ string t = testdir() + "/volume_info";
if( access( t.c_str(), R_OK )==0 )
{
detectFsDataTestMode( t, vBegin(), vEnd() );
@@ -282,10 +277,10 @@
{
if( max_log_num>0 )
{
- logVolumes( logdir );
+ logVolumes( logdir() );
for( CIter i=cont.begin(); i!=cont.end(); ++i )
{
- (*i)->logData( logdir );
+ (*i)->logData( logdir() );
}
}
deleteClist(cont);
@@ -368,11 +363,11 @@
void
Storage::detectDisks( ProcPart& ppart )
{
- if( test() )
+ if( testmode() )
{
glob_t globbuf;

- if( glob( (testdir+"/disk_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
+ if( glob( (testdir()+"/disk_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
&globbuf) == 0)
{
for (char** p = globbuf.gl_pathv; *p != 0; *p++)
@@ -380,7 +375,7 @@
}
globfree (&globbuf);
}
- else if( autodetect )
+ else if( autodetect() )
{
autodetectDisks( ppart );
}
@@ -389,9 +384,9 @@

void Storage::detectMds()
{
- if( test() )
+ if( testmode() )
{
- string file = testdir+"/md";
+ string file = testdir()+"/md";
if( access( file.c_str(), R_OK )==0 )
{
addToList( new MdCo( this, file ) );
@@ -409,9 +404,9 @@

void Storage::detectLoops( ProcPart& ppart )
{
- if( test() )
+ if( testmode() )
{
- string file = testdir+"/loop";
+ string file = testdir()+"/loop";
if( access( file.c_str(), R_OK )==0 )
{
addToList( new LoopCo( this, file ) );
@@ -429,9 +424,9 @@

void Storage::detectNfs( ProcMounts& mounts )
{
- if( test() )
+ if( testmode() )
{
- string file = testdir+"/nfs";
+ string file = testdir()+"/nfs";
if( access( file.c_str(), R_OK )==0 )
{
addToList( new NfsCo( this, file ) );
@@ -450,10 +445,10 @@
void
Storage::detectLvmVgs()
{
- if( test() )
+ if( testmode() )
{
glob_t globbuf;
- if( glob( (testdir+"/lvm_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
+ if( glob( (testdir()+"/lvm_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
&globbuf) == 0)
{
for (char** p = globbuf.gl_pathv; *p != 0; *p++)
@@ -487,10 +482,10 @@
void
Storage::detectDmraid(ProcPart& ppart)
{
- if( test() )
+ if( testmode() )
{
glob_t globbuf;
- if( glob( (testdir+"/dmraid_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
+ if( glob( (testdir()+"/dmraid_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
&globbuf) == 0)
{
// TODO: load test data
@@ -530,10 +525,10 @@
void
Storage::detectDmmultipath(ProcPart& ppart)
{
- if( test() )
+ if( testmode() )
{
glob_t globbuf;
- if( glob( (testdir+"/dmmultipath_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
+ if( glob( (testdir()+"/dmmultipath_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
&globbuf) == 0)
{
// TODO: load test data
@@ -573,10 +568,10 @@
void
Storage::detectDm( ProcPart& ppart )
{
- if( test() )
+ if( testmode() )
{
glob_t globbuf;
- if( glob( (testdir+"/dm_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
+ if( glob( (testdir()+"/dm_*[!~0-9]").c_str(), GLOB_NOSORT, 0,
&globbuf) == 0)
{
// TODO: load test data
@@ -662,7 +657,7 @@
(data.typ==DiskData::XEN||d->detect(pp)))
{
if( max_log_num>0 )
- d->logData( logdir );
+ d->logData( logdir() );
data.d = d;
}
else if( d )
@@ -784,7 +779,7 @@
}
}
if( max_log_num>0 )
- logVolumes( logdir );
+ logVolumes( logdir() );
y2milestone( "detectFsData end" );
}

@@ -961,22 +956,17 @@
Storage::initDefaultLogger ();
}

- StorageInterface* createDefaultStorageInterface ()
- {
- return new Storage ();
- }

- StorageInterface* createStorageInterface (bool ronly, bool testmode, bool
autodetect)
+ StorageInterface* createStorageInterface(const Environment& env)
{
- return new Storage (ronly, testmode, autodetect);
+ return new Storage(env);
}

- StorageInterface* createStorageInterfacePid (bool ronly, bool testmode,
bool autodetect,
- pid_t& locker_pid)
+ StorageInterface* createStorageInterfacePid(const Environment& env, pid_t&
locker_pid)
{
try
{
- return new Storage (ronly, testmode, autodetect);
+ return new Storage(env);
}
catch (const LockException& e)
{
@@ -1001,7 +991,7 @@
assertInit();
y2milestone( "disk:%s type:%d start:%ld size:%ld", disk.c_str(),
type, start, size );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1055,7 +1045,7 @@
assertInit();
y2milestone( "disk:%s type:%d start:%lld sizeK:%lld", disk.c_str(),
type, start, sizeK );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1117,7 +1107,7 @@
bool done = false;
assertInit();
y2milestone( "disk:%s sizeK:%lld", disk.c_str(), sizeK );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1199,7 +1189,7 @@
assertInit();
y2milestone( "disk:%s type:%u", disk.c_str(), type );
DiskIterator i = findDisk( disk );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1299,7 +1289,7 @@
y2milestone( "partition:%s", partition.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1372,7 +1362,7 @@
start, size );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1478,7 +1468,7 @@
y2milestone( "partition:%s id:%x", partition.c_str(), id );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1547,7 +1537,7 @@
sizeCyl, ignoreFs );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1608,7 +1598,7 @@
y2milestone( "partition:%s", partition.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1767,7 +1757,7 @@
assertInit();
y2milestone( "disk:%s label:%s", disk.c_str(), label.c_str() );

- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1809,7 +1799,7 @@
assertInit();
y2milestone( "disk:%s value:%d", disk.c_str(), value );

- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1847,13 +1837,13 @@
string
Storage::defaultDiskLabel() const
{
- return Disk::defaultLabel(this, 0);
+ return Disk::defaultLabel(efiBoot(), 0);
}

string
Storage::defaultDiskLabelSize( unsigned long long size_k ) const
{
- return Disk::defaultLabel(this, size_k);
+ return Disk::defaultLabel(efiBoot(), size_k);
}


@@ -1872,7 +1862,7 @@
Volume::fsTypeString(fs).c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1900,7 +1890,7 @@
y2milestone( "device:%s label:%s", device.c_str(), label.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1928,7 +1918,7 @@
y2milestone( "device:%s", device.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1952,7 +1942,7 @@
y2milestone( "device:%s opts:%s", device.c_str(), opts.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -1980,7 +1970,7 @@
y2milestone( "device:%s opts:%s", device.c_str(), opts.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2008,7 +1998,7 @@
y2milestone( "device:%s txt:%s", device.c_str(), txt.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2036,7 +2026,7 @@
y2milestone( "device:%s mount:%s", device.c_str(), mount.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2085,7 +2075,7 @@
Volume::mbyTypeString(mby).c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2140,7 +2130,7 @@
y2milestone( "device:%s options:%s", device.c_str(), options.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2188,7 +2178,7 @@
y2milestone( "device:%s options:%s", device.c_str(), options.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2223,7 +2213,7 @@
y2milestone( "device:%s options:%s", device.c_str(), options.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2264,7 +2254,7 @@
y2milestone( "device:%s val:%d type:%d", device.c_str(), val, typ );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2315,7 +2305,7 @@
#endif

VolIterator vol;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2343,7 +2333,7 @@
y2milestone( "device:%s", device.c_str() );

VolIterator vol;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2399,7 +2389,7 @@
y2milestone( "device:%s val:%d", device.c_str(), val );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2461,7 +2451,7 @@
newSizeMb, ignoreFs );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2494,7 +2484,7 @@
y2milestone( "device:%s", device.c_str() );
VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2523,7 +2513,7 @@

VolIterator vol;
ContIterator cont;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2561,7 +2551,7 @@
y2mil( "name:" << name << " peSizeK:" << peSizeK << " lvm1:" << lvm1 <<
" devices:" << devs );
LvmVgIterator i = findLvmVg( name );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2606,7 +2596,7 @@
assertInit();
y2milestone( "name:%s", name.c_str() );
LvmVgIterator i = findLvmVg( name );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2635,7 +2625,7 @@
assertInit();
y2mil( "name:" << name << " devices:" << devs );
LvmVgIterator i = findLvmVg( name );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2665,7 +2655,7 @@
assertInit();
y2mil( "name:" << name << " devices:" << devs );
LvmVgIterator i = findLvmVg( name );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2698,7 +2688,7 @@
y2milestone( "vg:%s name:%s sizeM:%llu stripe:%u", vg.c_str(),
name.c_str(), sizeM, stripe );
LvmVgIterator i = findLvmVg( vg );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2745,7 +2735,7 @@
assertInit();
y2milestone( "vg:%s name:%s", vg.c_str(), name.c_str() );
LvmVgIterator i = findLvmVg( vg );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2774,7 +2764,7 @@
y2milestone( "vg:%s name:%s stripe:%lu", vg.c_str(), name.c_str(),
stripe );
LvmVgIterator i = findLvmVg( vg );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2803,7 +2793,7 @@
y2milestone( "vg:%s name:%s stripeSize:%llu", vg.c_str(), name.c_str(),
stripeSize );
LvmVgIterator i = findLvmVg( vg );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2834,7 +2824,7 @@
assertInit();
y2mil("vg:" << vg << " origin:" << origin << " name:" << name << "
cowSizeK:" << cowSizeK);
LvmVgIterator i = findLvmVg(vg);
- if (readonly)
+ if (readonly())
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2862,7 +2852,7 @@
assertInit();
y2mil("vg:" << vg << " name:" << name);
LvmVgIterator i = findLvmVg(vg);
- if (readonly)
+ if (readonly())
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2927,7 +2917,7 @@
y2mil( "name:" << name << " MdType:" << Md::pName(rtype) <<
" devices:" << devs );
unsigned num = 0;
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -2970,7 +2960,7 @@
int ret = 0;
assertInit();
y2mil( "MdType:" << Md::pName(rtype) << " devices:" << devs );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3019,7 +3009,7 @@
int ret = 0;
assertInit();
y2milestone( "name:%s destroySb:%d", name.c_str(), destroySb );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3049,7 +3039,7 @@
int ret = 0;
assertInit();
y2milestone( "name:%s dev:%s", name.c_str(), dev.c_str() );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3079,7 +3069,7 @@
int ret = 0;
assertInit();
y2milestone( "name:%s dev:%s", name.c_str(), dev.c_str() );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3109,7 +3099,7 @@
int ret = 0;
assertInit();
y2milestone( "name:%s rtype:%d", name.c_str(), rtype );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3139,7 +3129,7 @@
int ret = 0;
assertInit();
y2milestone( "name:%s dev:%lu", name.c_str(), chunk );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3169,7 +3159,7 @@
int ret = 0;
assertInit();
y2milestone( "name:%s parity:%d", name.c_str(), ptype );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3317,7 +3307,7 @@
int ret = 0;
assertInit();
y2mil( "name:" << nfsDev << " sizeK:" << sizeK << " mp:" << mp );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3402,7 +3392,7 @@
#ifdef DEBUG_LOOP_CRYPT_PASSWORD
y2milestone( "pwd:%s", pwd.c_str() );
#endif
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3470,7 +3460,7 @@
assertInit();
y2milestone( "device:%s lname:%s reuse:%d sizeK:%lld", device.c_str(),
lname.c_str(), reuseExisting, sizeK );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -3496,7 +3486,7 @@
int ret = 0;
assertInit();
y2milestone( "lname:%s removeFile:%d", lname.c_str(), removeFile );
- if( readonly )
+ if( readonly() )
{
ret = STORAGE_CHANGE_READONLY;
}
@@ -5287,7 +5277,7 @@
assertInit();
y2milestone( "device:%s", device.c_str() );
VolIterator vol;
- if( !readonly && findVolume( device, vol ) )
+ if( !readonly() && findVolume( device, vol ) )
{
if( vol->umount()==0 )
{
@@ -5308,7 +5298,7 @@
y2milestone( "device:%s mp:%s ro:%d opts:%s", device.c_str(), mp.c_str(),
ro, opts.c_str() );
VolIterator vol;
- if( !readonly && findVolume( device, vol ) )
+ if( !readonly() && findVolume( device, vol ) )
{
if( vol->needCrsetup() )
{
@@ -5581,7 +5571,7 @@
int
Storage::createBackupState( const string& name )
{
- int ret = readonly?STORAGE_CHANGE_READONLY:0;
+ int ret = readonly()?STORAGE_CHANGE_READONLY:0;
assertInit();
y2milestone( "name:%s", name.c_str() );
if( ret==0 )
@@ -5605,7 +5595,7 @@
int
Storage::removeBackupState( const string& name )
{
- int ret = readonly?STORAGE_CHANGE_READONLY:0;
+ int ret = readonly()?STORAGE_CHANGE_READONLY:0;
assertInit();
y2milestone( "name:%s", name.c_str() );
if( ret==0 )
@@ -5632,7 +5622,7 @@
int
Storage::restoreBackupState( const string& name )
{
- int ret = readonly?STORAGE_CHANGE_READONLY:0;
+ int ret = readonly()?STORAGE_CHANGE_READONLY:0;
assertInit();
y2milestone( "name:%s", name.c_str() );
if( ret==0 )
@@ -5780,7 +5770,7 @@
const string& vfs, const string& options,
unsigned freq, unsigned passno )
{
- int ret = readonly?STORAGE_CHANGE_READONLY:0;
+ int ret = readonly()?STORAGE_CHANGE_READONLY:0;
assertInit();
y2milestone( "device:%s mount:%s vfs:%s opts:%s freq:%u passno:%u",
device.c_str(), mount.c_str(), vfs.c_str(), options.c_str(),

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=58770&r1=58769&r2=58770&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 Fri Sep
25 12:19:24 2009
@@ -209,15 +209,20 @@

static void initDefaultLogger ();

- Storage( bool ronly=false, bool testmode=false, bool autodetect=true );
- bool test() const { return( testmode ); }
- bool instsys() const { return( inst_sys ); }
+ Storage(const Environment& env);
+
+ bool readonly() const { return env.readonly; }
+ bool testmode() const { return env.testmode; }
+ bool autodetect() const { return env.autodetect; }
+ bool instsys() const { return env.instsys; }
+ string logdir() const { return env.logdir; }
+ string testdir() const { return env.testdir; }
+
void setCacheChanges( bool val=true ) { cache = val; }
bool isCacheChanges() const { return( cache ); }
void assertInit() { if( !initialized ) initialize(); }
void rescanEverything();
int checkCache();
- const string& tDir() const { return( testdir ); }
const string& root() const { return( rootprefix ); }
string prependRoot(const string& mp) const;
const string& tmpDir() const;
@@ -1716,22 +1721,17 @@
bool& resize_ok );

// protected internal member variables
+ const Environment env;
Lock lock;
- bool readonly;
- bool testmode;
- bool inst_sys;
bool cache;
bool initialized;
- bool autodetect;
bool recursiveRemove;
bool zeroNewPartitions;
MountByType defaultMountBy;
bool detectMounted;
bool root_mounted;
- string testdir;
string tempdir;
string rootprefix;
- string logdir;
unsigned hald_pid;
bool efiboot;
static string proc_arch;

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=58770&r1=58769&r2=58770&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
Fri Sep 25 12:19:24 2009
@@ -2172,15 +2172,24 @@
/**
* Initializes default logging.
*/
- void initDefaultLogger ();
+ void initDefaultLogger();


/**
- * Factory for creating a concrete StorageInterface object.
- *
- * Throws an exception when locking fails.
+ * Contains basic environment settings controlling the behaviour of
libstorage.
*/
- StorageInterface* createDefaultStorageInterface ();
+ struct Environment
+ {
+ Environment(bool readonly) : readonly(readonly), testmode(false),
autodetect(true),
+ instsys(false), logdir("/var/log/YaST2"), testdir("") {}
+
+ bool readonly;
+ bool testmode;
+ bool autodetect;
+ bool instsys;
+ string logdir;
+ string testdir;
+ };


/**
@@ -2188,8 +2197,7 @@
*
* Throws an exception when locking fails.
*/
- StorageInterface* createStorageInterface (bool readonly, bool testmode,
- bool autodetect);
+ StorageInterface* createStorageInterface(const Environment& env);


/**
@@ -2199,14 +2207,13 @@
* pid of one process holding a conflicting lock. If the pid cannot be
* determined it is set to 0. The lock holder may run on another system.
*/
- StorageInterface* createStorageInterfacePid (bool readonly, bool testmode,
- bool autodetect, int&
locker_pid);
+ StorageInterface* createStorageInterfacePid(const Environment& env, int&
locker_pid);


/**
* Destroy a StorageInterface object.
*/
- void destroyStorageInterface (StorageInterface*);
+ void destroyStorageInterface(StorageInterface*);

}


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=58770&r1=58769&r2=58770&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 Fri Sep
25 12:19:24 2009
@@ -704,7 +704,7 @@
ret = umount( orig_mp );
needMount = ret==0;
}
- if( ret==0 && !cont->getStorage()->test() )
+ if( ret==0 && !cont->getStorage()->testmode() )
{
ret = checkDevice();
}
@@ -716,7 +716,7 @@
{
ret = cont->getStorage()->zeroDevice(mountDevice(), size_k, true);
}
- if( ret==0 && mountDevice()!=dev && !cont->getStorage()->test() )
+ if( ret==0 && mountDevice()!=dev && !cont->getStorage()->testmode() )
{
ret = checkDevice(mountDevice());
}
@@ -848,7 +848,7 @@
{
format = false;
detected_fs = fs;
- if( fs != SWAP && !cont->getStorage()->test() )
+ if( fs != SWAP && !cont->getStorage()->testmode() )
{
FsType old=fs;
updateFsData();
@@ -1139,7 +1139,7 @@
{
ret = VOLUME_ALREADY_IN_USE;
}
- if( ret==0 && !mp.empty() && !cont->getStorage()->test() )
+ if( ret==0 && !mp.empty() && !cont->getStorage()->testmode() )
{
if( fs!=NFS )
{
@@ -1643,7 +1643,7 @@
{
EncryptType ret = ENC_UNKNOWN;

- if( getContainer()->getStorage()->test() )
+ if( getContainer()->getStorage()->testmode() )
{
ret = encryption = orig_encryption = ENC_TWOFISH;
y2milestone( "ret:%s", encTypeString(ret).c_str() );

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate1.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate1.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
---
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate1.cc
(original)
+++
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate1.cc
Fri Sep 25 12:19:24 2009
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <iostream>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>

using namespace storage;
using namespace std;
@@ -11,7 +11,7 @@
void
doit ()
{
- StorageInterface* s = createDefaultStorageInterface ();
+ StorageInterface* s = createStorageInterface(Environment(false));


cout << s->destroyPartitionTable ("hdb", s->defaultDiskLabel ()) << '\n';

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate2.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate2.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
---
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate2.cc
(original)
+++
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmcreate2.cc
Fri Sep 25 12:19:24 2009
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <iostream>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>

using namespace storage;
using namespace std;
@@ -11,7 +11,7 @@
void
doit ()
{
- StorageInterface* s = createDefaultStorageInterface ();
+ StorageInterface* s = createStorageInterface(Environment(false));


cout << s->destroyPartitionTable ("hdb", s->defaultDiskLabel ()) << '\n';

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend1.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend1.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
---
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend1.cc
(original)
+++
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend1.cc
Fri Sep 25 12:19:24 2009
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <iostream>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>

using namespace storage;
using namespace std;
@@ -11,7 +11,7 @@
void
doit ()
{
- StorageInterface* s = createDefaultStorageInterface ();
+ StorageInterface* s = createStorageInterface(Environment(false));


cout << s->destroyPartitionTable ("hdb", s->defaultDiskLabel ()) << '\n';

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend2.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend2.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
---
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend2.cc
(original)
+++
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite-real/lvmextend2.cc
Fri Sep 25 12:19:24 2009
@@ -2,7 +2,7 @@
#include <stdlib.h>
#include <iostream>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>

using namespace storage;
using namespace std;
@@ -11,7 +11,7 @@
void
doit ()
{
- StorageInterface* s = createDefaultStorageInterface ();
+ StorageInterface* s = createStorageInterface(Environment(false));


cout << s->destroyPartitionTable ("hdb", s->defaultDiskLabel ()) << '\n';
@@ -48,7 +48,7 @@
delete s;


- s = createDefaultStorageInterface ();
+ s = createStorageInterface(Environment(false));


deque <string> pds34;

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/Makefile.am
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/Makefile.am?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/Makefile.am
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/Makefile.am
Fri Sep 25 12:19:24 2009
@@ -3,44 +3,36 @@
#

SUBDIRS = lib config libstorage.test single.out data
+
PACKAGE = libstorage
+
AUTOMAKE_OPTIONS = dejagnu

INCLUDES = -I$(top_srcdir)/libstorage/src

-AM_CPPFLAGS =
-AM_CXXFLAGS =
+LDADD = ../src/liby2storage.la

noinst_PROGRAMS = partition1.single format1.single uuid1.single fstab1.single
\
lvm_create.single lvm_extend.single md_create.single
\
humanstring1.single humanstring2.single

-partition1_single_SOURCES = partition1.cc
-partition1_single_LDADD = ../src/liby2storage.la
+partition1_single_SOURCES = partition1.cc common.h

-format1_single_SOURCES = format1.cc
-format1_single_LDADD = ../src/liby2storage.la
+format1_single_SOURCES = format1.cc common.h

-uuid1_single_SOURCES = uuid1.cc common.cc common.h
-uuid1_single_LDADD = ../src/liby2storage.la
+uuid1_single_SOURCES = uuid1.cc common.h

-fstab1_single_SOURCES = fstab1.cc
-fstab1_single_LDADD = ../src/liby2storage.la
+fstab1_single_SOURCES = fstab1.cc common.h

-lvm_create_single_SOURCES = lvm_create.cc
-lvm_create_single_LDADD = ../src/liby2storage.la
+lvm_create_single_SOURCES = lvm_create.cc common.h

-lvm_extend_single_SOURCES = lvm_extend.cc
-lvm_extend_single_LDADD = ../src/liby2storage.la
+lvm_extend_single_SOURCES = lvm_extend.cc common.h

-md_create_single_SOURCES = md_create.cc
-md_create_single_LDADD = ../src/liby2storage.la
+md_create_single_SOURCES = md_create.cc common.h

humanstring1_single_SOURCES = humanstring1.cc
-humanstring1_single_LDADD = ../src/liby2storage.la

humanstring2_single_SOURCES = humanstring2.cc
-humanstring2_single_LDADD = ../src/liby2storage.la

clean-local:
rm -f tmp.err.* tmp.out.* site.exp site.bak

Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/common.h
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/common.h?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/common.h
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/common.h Fri
Sep 25 12:19:24 2009
@@ -1,13 +1,19 @@

-#include <string>
+#include <StorageInterface.h>

-using namespace std;

+namespace storage
+{

-extern bool testmode;
+ struct TestEnvironment : public Environment
+ {
+ TestEnvironment() : Environment(false)
+ {
+ testmode = true;
+ autodetect = false;
+ logdir = testdir = "tmp";
+ }
+ };

-extern string disk;
-
-void
-parse_command_line (int argc, char* argv[]);
+}


Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/format1.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/format1.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/format1.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/format1.cc
Fri Sep 25 12:19:24 2009
@@ -1,9 +1,13 @@

+#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iterator>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>
+
+#include "common.h"
+

using namespace std;
using namespace storage;
@@ -57,7 +61,7 @@
{
printf ("test\n");

- s = createStorageInterface (false, true, false);
+ s = createStorageInterface(TestEnvironment());

cout << s->changeFormatVolume ("/dev/hda1", true, REISERFS) << '\n';
cout << s->changeFormatVolume ("/dev/hda2", true, EXT2) << '\n';
@@ -76,7 +80,6 @@
main ()
{
system ("mkdir -p tmp");
- setenv ("YAST2_STORAGE_TDIR", "tmp", 1);

system ("cp data/disk_hda tmp/disk_hda");
system ("rm -f tmp/volume_info");

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/fstab1.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/fstab1.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/fstab1.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/fstab1.cc Fri
Sep 25 12:19:24 2009
@@ -3,7 +3,8 @@
#include <iostream>
#include <iterator>

-#include <y2storage/StorageInterface.h>
+#include "common.h"
+

using namespace std;
using namespace storage;
@@ -17,7 +18,7 @@
{
cout << "mountpoint1\n";

- s = createStorageInterface (false, true, false);
+ s = createStorageInterface(TestEnvironment());

string mountpoint;

@@ -38,7 +39,7 @@
{
cout << "mountby1\n";

- s = createStorageInterface (false, true, false);
+ s = createStorageInterface(TestEnvironment());

MountByType mountby;

@@ -63,7 +64,7 @@
{
cout << "options1\n";

- s = createStorageInterface (false, true, false);
+ s = createStorageInterface(TestEnvironment());

string options;

@@ -100,7 +101,7 @@
{
cout << "crypt1\n";

- s = createStorageInterface (false, true, false);
+ s = createStorageInterface(TestEnvironment());

bool val = false;

@@ -127,7 +128,7 @@
{
cout << "combined1\n";

- s = createStorageInterface (false, true, false);
+ s = createStorageInterface(TestEnvironment());

string mountpoint;

@@ -145,7 +146,6 @@
main ()
{
system ("mkdir -p tmp");
- setenv ("YAST2_STORAGE_TDIR", "tmp", 1);

system ("cp data/volume_info tmp");
system ("cp data/disk_hda tmp");

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring1.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring1.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
---
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring1.cc
(original)
+++
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring1.cc
Fri Sep 25 12:19:24 2009
@@ -1,8 +1,11 @@

+#include <stdlib.h>
#include <iostream>
#include <locale>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>
+
+#include "common.h"

using namespace std;
using namespace storage;
@@ -27,7 +30,7 @@
int
main()
{
- s = createStorageInterface(true, true, false);
+ s = createStorageInterface(TestEnvironment());

test("en_GB.UTF-8", 1024, true, 2, true);
test("en_GB.UTF-8", 1024, true, 2, false);

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring2.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring2.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
---
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring2.cc
(original)
+++
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/humanstring2.cc
Fri Sep 25 12:19:24 2009
@@ -1,13 +1,16 @@

+#include <stdlib.h>
#include <iostream>
#include <locale>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>
+
+#include "common.h"

using namespace std;
using namespace storage;

-
+
// Don't bother setting up locale for gettext since we don't have translations
// during package build.

@@ -32,7 +35,7 @@
int
main()
{
- s = createStorageInterface(true, true, false);
+ s = createStorageInterface(TestEnvironment());

test("en_GB.UTF-8", "42", true); // FAILS: classic=true
needs a suffix
test("en_GB.UTF-8", "42B", true);

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_create.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_create.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_create.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_create.cc
Fri Sep 25 12:19:24 2009
@@ -1,17 +1,22 @@

+#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iterator>
#include <sstream>

-#include <y2storage/StorageInterface.h>
+#include "common.h"
+

using namespace storage;
using namespace std;

+
StorageInterface *s = 0;

-void print_num_lvs(const string& disk, const string& vg) {
+
+void print_num_lvs(const string& disk, const string& vg)
+{
deque<LvmLvInfo> plist;
s->getLvmLvInfo( vg, plist );

@@ -24,7 +29,7 @@
*/
deque<string> getDevs( deque<string> disks )
{
- StorageInterface *siface = createStorageInterface( false, true, false );
+ StorageInterface *siface = createStorageInterface(TestEnvironment());

deque<string> devs;
deque<PartitionInfo> pInfos;
@@ -61,7 +66,7 @@
{
printf("createLvs\n");

- s = createStorageInterface( false, true, false );
+ s = createStorageInterface(TestEnvironment());

/* create volume group with the above disks */
cout << s->createLvmVg( vg, 4, false, getDevs(disks) ) << endl;
@@ -95,7 +100,7 @@
{
printf("createExtendedLv\n");

- s = createStorageInterface( false, true, false );
+ s = createStorageInterface(TestEnvironment());

deque<string> devs;
devs.push_back(dev); // add extended partition
@@ -110,7 +115,6 @@
int main( int argc_iv, char** argv_ppcv )
{
system ("mkdir -p tmp");
- setenv ("YAST2_STORAGE_TDIR", "tmp", 1);

system ("rm -rf tmp/*");


Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_extend.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_extend.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_extend.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/lvm_extend.cc
Fri Sep 25 12:19:24 2009
@@ -1,17 +1,21 @@

+#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iterator>
#include <sstream>

-#include <y2storage/StorageInterface.h>
+#include "common.h"
+

using namespace storage;
using namespace std;

+
StorageInterface *s = 0;

-void print_num_pvs( const string& vg) {
+void print_num_pvs( const string& vg)
+{
deque<string> disks;
disks.push_back( "/dev/hda" );
disks.push_back( "/dev/hdb" );
@@ -28,7 +32,7 @@
for ( deque<PartitionInfo>::iterator p = pinfos.begin();
p != pinfos.end(); p++ )
{
- if ( p->v.usedByName == vg )
+ if ( p->v.usedByDevice == "/dev/" + vg )
count++;
}
}
@@ -40,8 +44,8 @@
{
printf("extendVg\n");

- s = createStorageInterface( false, true, false );
-
+ s = createStorageInterface(TestEnvironment());
+
deque<string> devs;
devs.push_back( "/dev/hda1" );
/* create volume group with the above disk */
@@ -61,7 +65,6 @@
int main( int argc_iv, char** argv_ppcv )
{
system ("mkdir -p tmp");
- setenv ("YAST2_STORAGE_TDIR", "tmp", 1);

system ("rm -rf tmp/*");

@@ -98,5 +101,4 @@
devs.push_back("/dev/sdb1");
extendVg( "system", devs );
devs.clear();
-
}

Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/md_create.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/md_create.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/md_create.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/md_create.cc
Fri Sep 25 12:19:24 2009
@@ -3,11 +3,13 @@
#include <iostream>
#include <iterator>

-#include <y2storage/StorageInterface.h>
+#include "common.h"
+

using namespace storage;
using namespace std;

+
StorageInterface *s = 0;


@@ -31,7 +33,7 @@

void createMD( MdType type, deque<string> devs )
{
- s = createStorageInterface( false, true, false );
+ s = createStorageInterface(TestEnvironment());

int ret = s->createMd( "/dev/md0", type, devs );
if( ret==0 )
@@ -49,7 +51,6 @@
int main( int argc_iv, char** argv_ppcv )
{
system ("mkdir -p tmp");
- setenv ("YAST2_STORAGE_TDIR", "tmp", 1);

system ("rm -rf tmp/*");


Modified:
branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/partition1.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/partition1.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/partition1.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/partition1.cc
Fri Sep 25 12:19:24 2009
@@ -1,9 +1,13 @@

+#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iterator>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>
+
+#include "common.h"
+

using namespace std;
using namespace storage;
@@ -40,7 +44,7 @@
{
printf ("msdos %s %d\n", disk.c_str(), n);

- s = createStorageInterface (false, true, false);
+ s = createStorageInterface(TestEnvironment());

s->destroyPartitionTable (disk, "msdos");

@@ -69,7 +73,7 @@
{
printf ("gpt %s %d\n", disk.c_str(), n);

- s = createStorageInterface (false, true, false);
+ s = createStorageInterface(TestEnvironment());

s->destroyPartitionTable (disk, "gpt");

@@ -91,7 +95,6 @@
main ()
{
system ("mkdir -p tmp");
- setenv ("YAST2_STORAGE_TDIR", "tmp", 1);

/*
* Check that we can create 3 primary, 1 extended and 59 logical partitions

Modified: branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/uuid1.cc
URL:
http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/uuid1.cc?rev=58770&r1=58769&r2=58770&view=diff
==============================================================================
--- branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/uuid1.cc
(original)
+++ branches/SuSE-Code-11-SP1-Branch/storage/libstorage/testsuite/uuid1.cc Fri
Sep 25 12:19:24 2009
@@ -4,7 +4,7 @@
#include <fstream>
#include <iterator>

-#include <y2storage/StorageInterface.h>
+#include <StorageInterface.h>

#include "common.h"

@@ -19,7 +19,7 @@
void
print_fstab ()
{
- ifstream fstab (testmode ? "tmp/fstab" : "/etc/fstab");
+ ifstream fstab ("tmp/fstab");
string line;

while (getline (fstab, line))
@@ -32,7 +32,9 @@
{
cout << "run1\n";

- s = createStorageInterface (false, testmode, true);
+ s = createStorageInterface(TestEnvironment());
+
+ string disk = "/dev/hdb";

s->destroyPartitionTable (disk, "msdos");

@@ -58,9 +60,10 @@
{
cout << "run2\n";

- s = createStorageInterface (false, testmode, true);
+ s = createStorageInterface(TestEnvironment());
+
+ string name = "/dev/hdb1";

- string name = disk + "1";
cout << name << '\n';

cout << s->changeMountBy (name, MOUNTBY_DEVICE) << '\n';
@@ -74,16 +77,10 @@
int
main (int argc, char* argv[])
{
- parse_command_line (argc, argv);
-
system ("mkdir -p tmp");
- setenv ("YAST2_STORAGE_TDIR", "tmp", 1);

- if (testmode)
- {
- system ("rm -f tmp/fstab tmp/volume_info");
- system ("cp data/disk_hdb tmp/disk_hdb");
- }
+ system ("rm -f tmp/fstab tmp/volume_info");
+ system ("cp data/disk_hdb tmp/disk_hdb");

run1 ();
print_fstab ();

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=58770&r1=58769&r2=58770&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 Fri
Sep 25 12:19:24 2009
@@ -1,7 +1,10 @@
-------------------------------------------------------------------
-Fri Sep 25 10:29:26 CEST 2009 - aschnell@xxxxxxx
+Fri Sep 25 12:04:20 CEST 2009 - aschnell@xxxxxxx

+- added environment parameter to Storage constructor and factories
+- pass instsys flag from YCP to libstorage (bnc #399390)
- fixed handling of efiboot parameter (bnc #490782)
+- 2.17.76

-------------------------------------------------------------------
Tue Sep 22 15:12:29 CEST 2009 - jsrain@xxxxxxx

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=58770&r1=58769&r2=58770&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
Fri Sep 25 12:19:24 2009
@@ -67,6 +67,7 @@
import "LibStorage::DmmultipathCoInfo";
import "LibStorage::PartitionSlotInfo";
import "LibStorage::CommitInfo";
+ import "LibStorage::Environment";


global void UpdateClassified(string key, string pwd);
@@ -292,8 +293,13 @@
{
while (sint == nil)
{
+ any env = LibStorage::Environment::new("LibStorage::Environment",
readonly);
+ LibStorage::Environment::swig_testmode_set(env, Mode::test());
+ LibStorage::Environment::swig_autodetect_set(env, true);
+ LibStorage::Environment::swig_instsys_set(env, Mode::installation() ||
Mode::repair());
+
integer locker_pid = 0;
- sint = LibStorage::createStorageInterfacePid(readonly, Mode::test(),
true, locker_pid);
+ sint = LibStorage::createStorageInterfacePid(env, locker_pid);

if (sint == nil)
{

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages