00001 #ifndef STORAGEINTERFACE_H
00002 #define STORAGEINTERFACE_H
00003
00004
00005 #include <string>
00006 #include <deque>
00007 #include <ostream>
00008
00009 using std::string;
00010 using std::deque;
00011
00012
00081 namespace storage
00082 {
00083 enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, VFAT, XFS, JFS, HFS, NTFS, SWAP, FSNONE };
00084
00085 enum PartitionType { PRIMARY, EXTENDED, LOGICAL, PTYPE_ANY };
00086
00087 enum MountByType { MOUNTBY_DEVICE, MOUNTBY_UUID, MOUNTBY_LABEL, MOUNTBY_ID, MOUNTBY_PATH };
00088
00089 enum EncryptType { ENC_NONE, ENC_TWOFISH, ENC_TWOFISH_OLD,
00090 ENC_TWOFISH256_OLD, ENC_UNKNOWN };
00091
00092 enum MdType { RAID_UNK, RAID0, RAID1, RAID5, RAID6, RAID10, MULTIPATH };
00093
00094 enum MdParity { PAR_NONE, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
00095 RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC };
00096
00097 enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_EVMS, UB_DM };
00098
00099 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, EVMS };
00100
00101
00105 typedef void (*CallbackProgressBar)( const string& id, unsigned cur, unsigned max );
00106
00111 typedef void (*CallbackShowInstallInfo)( const string& id );
00112
00117 typedef void (*CallbackInfoPopup)( const string& text );
00118
00125 typedef bool (*CallbackYesNoPopup)( const string& text );
00126
00127
00131 struct FsCapabilities
00132 {
00133 FsCapabilities () {}
00134 bool isExtendable;
00135 bool isExtendableWhileMounted;
00136 bool isReduceable;
00137 bool isReduceableWhileMounted;
00138 bool supportsUuid;
00139 bool supportsLabel;
00140 bool labelWhileMounted;
00141 unsigned int labelLength;
00142 unsigned long long minimalFsSizeK;
00143 };
00144
00148 struct ContainerInfo
00149 {
00150 ContainerInfo() {};
00151 CType type;
00152 unsigned volcnt;
00153 string device;
00154 string name;
00155 UsedByType usedBy;
00156 string usedByName;
00157 bool readonly;
00158 };
00159
00163 struct DiskInfo
00164 {
00165 DiskInfo() {};
00166 unsigned long long sizeK;
00167 unsigned long long cylSizeB;
00168 unsigned long cyl;
00169 unsigned long heads;
00170 unsigned long sectors;
00171 string disklabel;
00172 string udevPath;
00173 string udevId;
00174 unsigned maxLogical;
00175 unsigned maxPrimary;
00176 bool initDisk;
00177 };
00178
00182 struct LvmVgInfo
00183 {
00184 LvmVgInfo() {};
00185 unsigned long long sizeK;
00186 unsigned long long peSize;
00187 unsigned long peCount;
00188 unsigned long peFree;
00189 string uuid;
00190 bool lvm2;
00191 bool create;
00192 string devices;
00193 string devices_add;
00194 string devices_rem;
00195 };
00196
00200 struct EvmsCoInfo
00201 {
00202 EvmsCoInfo() {};
00203 unsigned long long sizeK;
00204 unsigned long long peSize;
00205 unsigned long peCount;
00206 unsigned long peFree;
00207 string uuid;
00208 bool lvm2;
00209 bool create;
00210 bool realContainer;
00211 string devices;
00212 string devices_add;
00213 string devices_rem;
00214 };
00215
00219 struct VolumeInfo
00220 {
00221 VolumeInfo() {};
00222 unsigned long long sizeK;
00223 unsigned long major;
00224 unsigned long minor;
00225 string name;
00226 string device;
00227 string mount;
00228 MountByType mount_by;
00229 UsedByType usedBy;
00230 string usedByName;
00231 string fstab_options;
00232 string uuid;
00233 string label;
00234 string mkfs_options;
00235 string loop;
00236 EncryptType encryption;
00237 string crypt_pwd;
00238 FsType fs;
00239 bool format;
00240 bool create;
00241 bool is_mounted;
00242 bool resize;
00243 unsigned long long OrigSizeK;
00244 };
00245
00249 struct PartitionInfo
00250 {
00251 PartitionInfo() {};
00252 VolumeInfo v;
00253 unsigned nr;
00254 unsigned long cylStart;
00255 unsigned long cylSize;
00256 PartitionType partitionType;
00257 unsigned id;
00258 bool boot;
00259 string udevPath;
00260 string udevId;
00261 };
00262
00266 struct LvmLvInfo
00267 {
00268 LvmLvInfo() {};
00269 VolumeInfo v;
00270 unsigned stripe;
00271 unsigned stripe_size;
00272 string uuid;
00273 string status;
00274 string allocation;
00275 string dm_table;
00276 string dm_target;
00277 };
00278
00282 struct EvmsInfo
00283 {
00284 EvmsInfo() {};
00285 VolumeInfo v;
00286 unsigned stripe;
00287 unsigned stripe_size;
00288 bool compatible;
00289 string dm_table;
00290 string dm_target;
00291 };
00292
00297 struct MdInfo
00298 {
00299 MdInfo() {};
00300 VolumeInfo v;
00301 unsigned nr;
00302 unsigned type;
00303 unsigned parity;
00304 string uuid;
00305 unsigned long chunk;
00306 string devices;
00307 };
00308
00312 struct LoopInfo
00313 {
00314 LoopInfo() {};
00315 VolumeInfo v;
00316 bool reuseFile;
00317 unsigned nr;
00318 string file;
00319 };
00320
00324 struct DmInfo
00325 {
00326 DmInfo() {};
00327 VolumeInfo v;
00328 unsigned nr;
00329 string table;
00330 string target;
00331 };
00332
00336 enum ErrorCodes
00337 {
00338 DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00339 DISK_PARTITION_EXCEEDS_DISK = -1001,
00340 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00341 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00342 DISK_PARTITION_NO_FREE_NUMBER = -1004,
00343 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00344 DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00345 DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00346 DISK_PARTITION_NOT_FOUND = -1008,
00347 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00348 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00349 DISK_SET_TYPE_INVALID_VOLUME = -1011,
00350 DISK_SET_TYPE_PARTED_FAILED = -1012,
00351 DISK_SET_LABEL_PARTED_FAILED = -1013,
00352 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00353 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00354 DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00355 DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00356 DISK_PARTITION_ZERO_SIZE = -1018,
00357 DISK_CHANGE_READONLY = -1019,
00358 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00359 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00360 DISK_RESIZE_NO_SPACE = -1022,
00361 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00362 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00363 DISK_COMMIT_NOTHING_TODO = -1025,
00364 DISK_CREATE_PARTITION_NO_SPACE = -1026,
00365 DISK_REMOVE_USED_BY = -1027,
00366 DISK_INIT_NOT_POSSIBLE = -1028,
00367
00368 STORAGE_DISK_NOT_FOUND = -2000,
00369 STORAGE_VOLUME_NOT_FOUND = -2001,
00370 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00371 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00372 STORAGE_CHANGE_READONLY = -2004,
00373 STORAGE_DISK_USED_BY = -2005,
00374 STORAGE_LVM_VG_EXISTS = -2006,
00375 STORAGE_LVM_VG_NOT_FOUND = -2007,
00376 STORAGE_LVM_INVALID_DEVICE = -2008,
00377 STORAGE_CONTAINER_NOT_FOUND = -2009,
00378 STORAGE_VG_INVALID_NAME = -2010,
00379 STORAGE_REMOVE_USED_VOLUME = -2011,
00380 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00381 STORAGE_NOT_YET_IMPLEMENTED = -2013,
00382 STORAGE_MD_INVALID_NAME = -2014,
00383 STORAGE_MD_NOT_FOUND = -2015,
00384 STORAGE_MEMORY_EXHAUSTED = -2016,
00385 STORAGE_LOOP_NOT_FOUND = -2017,
00386 STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00387 STORAGE_EVMS_INVALID_NAME = -2019,
00388 STORAGE_EVMS_CO_EXISTS = -2020,
00389 STORAGE_EVMS_CO_NOT_FOUND = -2021,
00390 STORAGE_EVMS_INVALID_DEVICE = -2022,
00391 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00392 STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00393 STORAGE_INVALID_FSTAB_VALUE = -2025,
00394 STORAGE_NO_FSTAB_PTR = -2026,
00395 STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00396
00397 VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00398 VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00399 VOLUME_UMOUNT_FAILED = -3002,
00400 VOLUME_MOUNT_FAILED = -3003,
00401 VOLUME_FORMAT_DD_FAILED = -3004,
00402 VOLUME_FORMAT_UNKNOWN_FS = -3005,
00403 VOLUME_FORMAT_FS_UNDETECTED = -3006,
00404 VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00405 VOLUME_FORMAT_FAILED = -3008,
00406 VOLUME_TUNE2FS_FAILED = -3009,
00407 VOLUME_MKLABEL_FS_UNABLE = -3010,
00408 VOLUME_MKLABEL_FAILED = -3011,
00409 VOLUME_LOSETUP_NO_LOOP = -3012,
00410 VOLUME_LOSETUP_FAILED = -3013,
00411 VOLUME_CRYPT_NO_PWD = -3014,
00412 VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00413 VOLUME_CRYPT_NOT_DETECTED = -3016,
00414 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00415 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00416 VOLUME_MOUNT_POINT_INVALID = -3019,
00417 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00418 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00419 VOLUME_LABEL_NOT_SUPPORTED = -3022,
00420 VOLUME_LABEL_TOO_LONG = -3023,
00421 VOLUME_LABEL_WHILE_MOUNTED = -3024,
00422 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00423 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00424 VOLUME_RESIZE_FAILED = -3027,
00425 VOLUME_ALREADY_IN_USE = -3028,
00426 VOLUME_LOUNSETUP_FAILED = -3029,
00427 VOLUME_DEVICE_NOT_PRESENT = -3030,
00428 VOLUME_DEVICE_NOT_BLOCK = -3031,
00429 VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
00430
00431 LVM_CREATE_PV_FAILED = -4000,
00432 LVM_PV_ALREADY_CONTAINED = -4001,
00433 LVM_PV_DEVICE_UNKNOWN = -4002,
00434 LVM_PV_DEVICE_USED = -4003,
00435 LVM_VG_HAS_NONE_PV = -4004,
00436 LVM_LV_INVALID_NAME = -4005,
00437 LVM_LV_DUPLICATE_NAME = -4006,
00438 LVM_LV_NO_SPACE = -4007,
00439 LVM_LV_UNKNOWN_NAME = -4008,
00440 LVM_LV_NOT_IN_LIST = -4009,
00441 LVM_VG_CREATE_FAILED = -4010,
00442 LVM_VG_EXTEND_FAILED = -4011,
00443 LVM_VG_REDUCE_FAILED = -4012,
00444 LVM_VG_REMOVE_FAILED = -4013,
00445 LVM_LV_CREATE_FAILED = -4014,
00446 LVM_LV_REMOVE_FAILED = -4015,
00447 LVM_LV_RESIZE_FAILED = -4016,
00448 LVM_PV_STILL_ADDED = -4017,
00449 LVM_PV_REMOVE_NOT_FOUND = -4018,
00450 LVM_CREATE_LV_INVALID_VOLUME = -4019,
00451 LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00452 LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00453 LVM_CHANGE_READONLY = -4022,
00454 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00455 LVM_COMMIT_NOTHING_TODO = -4024,
00456 LVM_LV_REMOVE_USED_BY = -4025,
00457 LVM_LV_ALREADY_ON_DISK = -4026,
00458 LVM_LV_NO_STRIPE_SIZE = -4027,
00459
00460 FSTAB_ENTRY_NOT_FOUND = -5000,
00461 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00462 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00463 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00464 FSTAB_ADD_ENTRY_FOUND = -5004,
00465
00466 MD_CHANGE_READONLY = -6000,
00467 MD_DUPLICATE_NUMBER = -6001,
00468 MD_TOO_FEW_DEVICES = -6002,
00469 MD_DEVICE_UNKNOWN = -6003,
00470 MD_DEVICE_USED = -6004,
00471 MD_CREATE_INVALID_VOLUME = -6005,
00472 MD_REMOVE_FAILED = -6006,
00473 MD_NOT_IN_LIST = -6007,
00474 MD_CREATE_FAILED = -6008,
00475 MD_UNKNOWN_NUMBER = -6009,
00476 MD_REMOVE_USED_BY = -6010,
00477 MD_NUMBER_TOO_LARGE = -6011,
00478 MD_REMOVE_INVALID_VOLUME = -6012,
00479 MD_REMOVE_CREATE_NOT_FOUND = -6013,
00480 MD_NO_RESIZE_ON_DISK = -6014,
00481 MD_ADD_DUPLICATE = -6015,
00482 MD_REMOVE_NONEXISTENT = -6016,
00483 MD_NO_CHANGE_ON_DISK = -6017,
00484 MD_NO_CREATE_UNKNOWN = -6018,
00485
00486 LOOP_CHANGE_READONLY = -7000,
00487 LOOP_DUPLICATE_FILE = -7001,
00488 LOOP_UNKNOWN_FILE = -7002,
00489 LOOP_REMOVE_USED_BY = -7003,
00490 LOOP_FILE_CREATE_FAILED = -7004,
00491 LOOP_CREATE_INVALID_VOLUME = -7005,
00492 LOOP_REMOVE_FILE_FAILED = -7006,
00493 LOOP_REMOVE_INVALID_VOLUME = -7007,
00494 LOOP_NOT_IN_LIST = -7008,
00495 LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00496 LOOP_MODIFY_EXISTING = -7010,
00497
00498 EVMS_HELPER_UNKNOWN_CMD = -8000,
00499 EVMS_UNSUPPORTED_CONTAINER_TYPE = -8001,
00500 EVMS_MALLOC_FAILED = -8002,
00501 EVMS_INVALID_PHYSICAL_VOLUME = -8003,
00502 EVMS_PHYSICAL_VOLUME_IN_USE = -8004,
00503 EVMS_PLUGIN_NOT_FOUND = -8005,
00504 EVMS_CREATE_CONTAINER_FAILED = -8006,
00505 EVMS_RESIZE_VOLUME_NOT_FOUND = -8007,
00506 EVMS_RESIZE_CONTAINER_NOT_FOUND = -8008,
00507 EVMS_RESIZE_EXPAND_FAILED = -8009,
00508 EVMS_RESIZE_SHRINK_FAILED = -8010,
00509 EVMS_COMMIT_FAILED = -8011,
00510 EVMS_CREATE_VOLUME_FREESPACE_NOT_FOUND = -8012,
00511 EVMS_CREATE_VOLUME_FAILED = -8013,
00512 EVMS_CREATE_COMPAT_VOLUME_FAILED = -8014,
00513 EVMS_SEGMENT_NOT_FOUND = -8015,
00514 EVMS_REMOVE_VOLUME_NOT_FOUND = -8016,
00515 EVMS_REMOVE_REGION_FAILED = -8017,
00516 EVMS_CONTAINER_NOT_FOUND = -8018,
00517 EVMS_CONTAINER_EXPAND_FAILED = -8019,
00518 EVMS_CONTAINER_SHRINK_INVALID_SEGMENT = -8020,
00519 EVMS_CONTAINER_SHRINK_FAILED = -8021,
00520 EVMS_CONTAINER_REMOVE_FAILED = -8022,
00521 EVMS_PV_ALREADY_CONTAINED = -8023,
00522 EVMS_PV_DEVICE_UNKNOWN = -8024,
00523 EVMS_PV_DEVICE_USED = -8025,
00524 EVMS_CO_HAS_NONE_PV = -8026,
00525 EVMS_LV_INVALID_NAME = -8027,
00526 EVMS_LV_DUPLICATE_NAME = -8028,
00527 EVMS_LV_NO_SPACE = -8029,
00528 EVMS_LV_UNKNOWN_NAME = -8030,
00529 EVMS_LV_NOT_IN_LIST = -8031,
00530 EVMS_PV_STILL_ADDED = -8032,
00531 EVMS_PV_REMOVE_NOT_FOUND = -8033,
00532 EVMS_CREATE_LV_INVALID_VOLUME = -8034,
00533 EVMS_REMOVE_LV_INVALID_VOLUME = -8035,
00534 EVMS_RESIZE_LV_INVALID_VOLUME = -8036,
00535 EVMS_CHANGE_READONLY = -8037,
00536 EVMS_CHECK_RESIZE_INVALID_VOLUME = -8038,
00537 EVMS_COMMIT_NOTHING_TODO = -8039,
00538 EVMS_LV_REMOVE_USED_BY = -8040,
00539 EVMS_COMMUNICATION_FAILED = -8041,
00540 EVMS_LV_ALREADY_ON_DISK = -8042,
00541 EVMS_LV_NO_STRIPE_SIZE = -8043,
00542 EVMS_ACTIVATE_FAILED = -8044,
00543 EVMS_CONTAINER_NOT_CREATED = -8045,
00544
00545 PEC_PE_SIZE_INVALID = -9000,
00546 PEC_PV_NOT_FOUND = -9001,
00547 PEC_REMOVE_PV_IN_USE = -9002,
00548 PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00549 PEC_LV_NO_SPACE_STRIPED = -9004,
00550 PEC_LV_NO_SPACE_SINGLE = -9005,
00551 PEC_LV_PE_DEV_NOT_FOUND = -9006,
00552
00553 DM_CHANGE_READONLY = -10000,
00554 DM_UNKNOWN_TABLE = -10001,
00555 DM_REMOVE_USED_BY = -10002,
00556 DM_REMOVE_CREATE_NOT_FOUND = -10003,
00557 DM_REMOVE_INVALID_VOLUME = -10004,
00558 DM_REMOVE_FAILED = -10005,
00559 DM_NOT_IN_LIST = -10006,
00560
00561 DASD_NOT_POSSIBLE = -11000,
00562 DASD_FDASD_FAILED = -11001,
00563 DASD_DASDFMT_FAILED = -11002,
00564
00565 CONTAINER_INTERNAL_ERROR = -99000,
00566 CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00567
00568 };
00569
00570
00574 class StorageInterface
00575 {
00576 public:
00577
00578 StorageInterface () {}
00579 virtual ~StorageInterface () {}
00580
00584 virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00585
00593 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
00594
00603 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
00604 DiskInfo& info ) = 0;
00605
00613 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
00614
00623 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
00624 LvmVgInfo& info) = 0;
00625
00633 virtual int getEvmsCoInfo( const string& name, EvmsCoInfo& info) = 0;
00634
00643 virtual int getContEvmsCoInfo( const string& name, ContainerInfo& cinfo,
00644 EvmsCoInfo& info) = 0;
00645
00651 virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
00652
00660 virtual int getVolume( const string& device, VolumeInfo& info) = 0;
00661
00669 virtual int getPartitionInfo( const string& disk,
00670 deque<PartitionInfo>& plist ) = 0;
00671
00679 virtual int getLvmLvInfo( const string& name,
00680 deque<LvmLvInfo>& plist ) = 0;
00681
00689 virtual int getEvmsInfo( const string& name,
00690 deque<EvmsInfo>& plist ) = 0;
00691
00698 virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
00699
00706 virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
00707
00714 virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
00715
00719 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
00720
00728 virtual void printInfo( std::ostream& str ) = 0;
00729
00742 virtual int createPartition( const string& disk, PartitionType type,
00743 unsigned long start,
00744 unsigned long sizeCyl,
00745 string& device ) = 0;
00746
00754 virtual int resizePartition( const string& device,
00755 unsigned long sizeCyl ) = 0;
00756
00767 virtual int updatePartitionArea( const string& device,
00768 unsigned long start,
00769 unsigned long sizeCyl ) = 0;
00770
00771
00781 virtual int nextFreePartition( const string& disk, PartitionType type,
00782 unsigned &nr, string& device ) = 0;
00783
00796 virtual int createPartitionKb( const string& disk, PartitionType type,
00797 unsigned long long start,
00798 unsigned long long size,
00799 string& device ) = 0;
00800
00811 virtual int createPartitionAny( const string& disk,
00812 unsigned long long size,
00813 string& device ) = 0;
00814
00825 virtual int createPartitionMax( const string& disk, PartitionType type,
00826 string& device ) = 0;
00827
00835 virtual unsigned long long cylinderToKb( const string& disk,
00836 unsigned long size ) = 0;
00837
00845 virtual unsigned long kbToCylinder( const string& disk,
00846 unsigned long long size ) = 0;
00847
00854 virtual int removePartition (const string& partition) = 0;
00855
00863 virtual int changePartitionId (const string& partition, unsigned id) = 0;
00864
00871 virtual int forgetChangePartitionId (const string& partition ) = 0;
00872
00881 virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
00882
00893 virtual int initializeDisk( const string& disk, bool value ) = 0;
00894
00901 virtual string defaultDiskLabel() const = 0;
00902
00911 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
00912
00920 virtual int changeLabelVolume( const string& device, const string& label ) = 0;
00921
00929 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
00930
00939 virtual int changeMountPoint( const string& device, const string& mount ) = 0;
00940
00948 virtual int getMountPoint( const string& device, string& mount ) = 0;
00949
00957 virtual int changeMountBy( const string& device, MountByType mby ) = 0;
00958
00966 #ifndef SWIG
00967 virtual int getMountBy( const string& device, MountByType& mby ) = 0;
00968 #else
00969 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0;
00970 #endif
00971
00981 virtual int changeFstabOptions( const string& device, const string& options ) = 0;
00982
00991 virtual int getFstabOptions( const string& device, string& options ) = 0;
00992
01001 virtual int addFstabOptions( const string& device, const string& options ) = 0;
01002
01012 virtual int removeFstabOptions( const string& device, const string& options ) = 0;
01013
01021 virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
01022
01029 virtual int forgetCryptPassword( const string& device ) = 0;
01030
01038 virtual int getCryptPassword( const string& device, string& pwd ) = 0;
01039
01047 virtual int setCrypt( const string& device, bool val ) = 0;
01048
01056 #ifndef SWIG
01057 virtual int getCrypt( const string& device, bool& val ) = 0;
01058 #else
01059 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0;
01060 #endif
01061
01071 virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01072
01080 #ifndef SWIG
01081 virtual int getIgnoreFstab( const string& device, bool& val ) = 0;
01082 #else
01083 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0;
01084 #endif
01085
01097 virtual int addFstabEntry( const string& device, const string& mount,
01098 const string& vfs, const string& options,
01099 unsigned freq, unsigned passno ) = 0;
01100
01101
01109 virtual int resizeVolume( const string& device, unsigned long long newSizeMb ) = 0;
01110
01117 virtual int forgetResizeVolume( const string& device ) = 0;
01118
01133 virtual void setRecursiveRemoval( bool val ) = 0;
01134
01140 virtual bool getRecursiveRemoval() const = 0;
01141
01155 virtual void setZeroNewPartitions( bool val ) = 0;
01156
01162 virtual bool getZeroNewPartitions() const = 0;
01163
01167 virtual void setDefaultMountBy( MountByType val ) = 0;
01168
01172 virtual MountByType getDefaultMountBy() const = 0;
01173
01183 virtual void setRootPrefix( const string& root ) = 0;
01184
01190 virtual void setDetectMountedVolumes( bool val ) = 0;
01191
01197 virtual bool getDetectMountedVolumes() const = 0;
01198
01206 virtual int removeVolume( const string& device ) = 0;
01207
01218 virtual int createLvmVg( const string& name,
01219 unsigned long long peSizeK, bool lvm1,
01220 const deque<string>& devs ) = 0;
01221
01229 virtual int removeLvmVg( const string& name ) = 0;
01230
01238 virtual int extendLvmVg( const string& name,
01239 const deque<string>& devs ) = 0;
01240
01248 virtual int shrinkLvmVg( const string& name,
01249 const deque<string>& devs ) = 0;
01250
01262 virtual int createLvmLv( const string& vg, const string& name,
01263 unsigned long long sizeM, unsigned stripe,
01264 string& device ) = 0;
01265
01272 virtual int removeLvmLvByDevice( const string& device ) = 0;
01273
01281 virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01282
01292 virtual int changeLvStripeSize( const string& vg, const string& name,
01293 unsigned long long stripeSize ) = 0;
01294
01305 virtual int createEvmsContainer( const string& name,
01306 unsigned long long peSizeK, bool lvm1,
01307 const deque<string>& devs ) = 0;
01308
01323 virtual int modifyEvmsContainer( const string& old_name,
01324 const string& new_name,
01325 unsigned long long peSizeK,
01326 bool lvm1 ) = 0;
01327
01335 virtual int removeEvmsContainer( const string& name ) = 0;
01336
01344 virtual int extendEvmsContainer( const string& name,
01345 const deque<string>& devs ) = 0;
01346
01354 virtual int shrinkEvmsContainer( const string& name,
01355 const deque<string>& devs ) = 0;
01356
01368 virtual int createEvmsVolume( const string& coname, const string& name,
01369 unsigned long long sizeM, unsigned stripe,
01370 string& device ) = 0;
01371
01378 virtual int removeEvmsVolumeByDevice( const string& device ) = 0;
01379
01387 virtual int removeEvmsVolume( const string& coname, const string& name ) = 0;
01388
01398 virtual int changeEvmsStripeSize( const string& coname,
01399 const string& name,
01400 unsigned long long stripeSize ) = 0;
01401
01410 virtual int evmsActivate() = 0;
01411
01420 virtual int createMd( const string& name, MdType rtype,
01421 const deque<string>& devs ) = 0;
01422
01431 virtual int createMdAny( MdType rtype, const deque<string>& devs,
01432 string& device ) = 0;
01433
01442 virtual int removeMd( const string& name, bool destroySb ) = 0;
01443
01452 virtual int extendMd( const string& name, const string& dev ) = 0;
01453
01462 virtual int shrinkMd( const string& name, const string& dev ) = 0;
01463
01472 virtual int changeMdType( const string& name, MdType rtype ) = 0;
01473
01482 virtual int changeMdChunk( const string& name, unsigned long chunk ) = 0;
01483
01492 virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
01493
01500 virtual int checkMd( const string& name ) = 0;
01501
01518 virtual int createFileLoop( const string& lname, bool reuseExisting,
01519 unsigned long long sizeK,
01520 const string& mp, const string& pwd,
01521 string& device ) = 0;
01522
01540 virtual int modifyFileLoop( const string& device, const string& lname,
01541 bool reuseExisting,
01542 unsigned long long sizeK ) = 0;
01543
01552 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
01553
01562 virtual deque<string> getCommitActions( bool mark_destructive ) = 0;
01563
01569 virtual const string& getLastAction() const = 0;
01570
01577 virtual const string& getExtendedErrorMessage() const = 0;
01578
01579
01580 #ifndef SWIG
01581
01587 virtual void setCallbackProgressBar( CallbackProgressBar pfnc ) = 0;
01588
01594 virtual CallbackProgressBar getCallbackProgressBar() const = 0;
01595
01596
01602 virtual void setCallbackShowInstallInfo( CallbackShowInstallInfo pfnc ) = 0;
01603
01609 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
01610
01611
01618 virtual void setCallbackInfoPopup( CallbackInfoPopup pfnc ) = 0;
01619
01626 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
01627
01628
01635 virtual void setCallbackYesNoPopup( CallbackYesNoPopup pfnc ) = 0;
01636
01643 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
01644
01645 #endif
01646
01652 virtual void setCacheChanges (bool cache) = 0;
01653
01657 virtual bool isCacheChanges () const = 0;
01658
01663 virtual int commit() = 0;
01664
01671 virtual int createBackupState( const string& name ) = 0;
01672
01679 virtual int restoreBackupState( const string& name ) = 0;
01680
01687 virtual bool checkBackupState( const string& name ) = 0;
01688
01697 virtual bool equalBackupStates( const string& lhs,
01698 const string& rhs,
01699 bool verbose_log ) const = 0;
01700
01708 virtual int removeBackupState( const string& name ) = 0;
01709
01717 virtual bool checkDeviceMounted( const string& device, string& mp ) = 0;
01718
01727 virtual bool umountDevice( const string& device ) = 0;
01728
01738 virtual bool mountDevice( const string& device, const string& mp ) = 0;
01739
01746 virtual bool checkDmMapsTo( const string& device ) = 0;
01747
01755 virtual bool removeDmMapsTo( const string& device, bool also_evms ) = 0;
01756
01768 virtual bool getFreeInfo( const string& device,
01769 unsigned long long& resize_free,
01770 unsigned long long& df_free,
01771 unsigned long long& used,
01772 bool& win, bool use_cache ) = 0;
01773
01781 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
01782
01789 virtual void activateHld( bool val ) = 0;
01790
01800 virtual void rescanEverything() = 0;
01801
01806 virtual void dumpObjectList() = 0;
01807
01808 };
01809
01810
01814 void initDefaultLogger ();
01815
01816
01820 StorageInterface* createDefaultStorageInterface ();
01821
01822
01826 StorageInterface* createStorageInterface (bool readonly, bool testmode,
01827 bool autodetect);
01828
01829
01833 void destroyStorageInterface (StorageInterface*);
01834
01835 }
01836
01837
01838 #endif