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, HFSPLUS, NFS, 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_LUKS, 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, UB_DMRAID };
00098
00099 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, EVMS, DMRAID, NFSC,
00100 COTYPE_LAST_ENTRY };
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 bool iscsi;
00178 };
00179
00183 struct LvmVgInfo
00184 {
00185 LvmVgInfo() {};
00186 unsigned long long sizeK;
00187 unsigned long long peSize;
00188 unsigned long peCount;
00189 unsigned long peFree;
00190 string uuid;
00191 bool lvm2;
00192 bool create;
00193 string devices;
00194 string devices_add;
00195 string devices_rem;
00196 };
00197
00201 struct EvmsCoInfo
00202 {
00203 EvmsCoInfo() {};
00204 unsigned long long sizeK;
00205 unsigned long long peSize;
00206 unsigned long peCount;
00207 unsigned long peFree;
00208 string uuid;
00209 bool lvm2;
00210 bool create;
00211 bool realContainer;
00212 string devices;
00213 string devices_add;
00214 string devices_rem;
00215 };
00216
00220 struct DmPartCoInfo
00221 {
00222 DmPartCoInfo() {};
00223 DiskInfo d;
00224 string devices;
00225 unsigned long minor;
00226 };
00227
00228 struct DmraidCoInfo
00229 {
00230 DmraidCoInfo() {};
00231 DmPartCoInfo p;
00232 };
00233
00237 struct VolumeInfo
00238 {
00239 VolumeInfo() {};
00240 unsigned long long sizeK;
00241 unsigned long major;
00242 unsigned long minor;
00243 string name;
00244 string device;
00245 string mount;
00246 MountByType mount_by;
00247 UsedByType usedBy;
00248 string usedByName;
00249 string fstab_options;
00250 string uuid;
00251 string label;
00252 string mkfs_options;
00253 string tunefs_options;
00254 string loop;
00255 string dtxt;
00256 EncryptType encryption;
00257 string crypt_pwd;
00258 FsType fs;
00259 bool format;
00260 bool create;
00261 bool is_mounted;
00262 bool resize;
00263 bool ignore_fs;
00264 unsigned long long OrigSizeK;
00265 };
00266
00267 struct PartitionAddInfo
00268 {
00269 PartitionAddInfo() {};
00270 unsigned nr;
00271 unsigned long cylStart;
00272 unsigned long cylSize;
00273 PartitionType partitionType;
00274 unsigned id;
00275 bool boot;
00276 string udevPath;
00277 string udevId;
00278 };
00279
00283 struct PartitionInfo
00284 {
00285 PartitionInfo() {};
00286 PartitionInfo& operator=( const PartitionAddInfo& rhs );
00287 VolumeInfo v;
00288 unsigned nr;
00289 unsigned long cylStart;
00290 unsigned long cylSize;
00291 PartitionType partitionType;
00292 unsigned id;
00293 bool boot;
00294 string udevPath;
00295 string udevId;
00296 };
00297
00301 struct LvmLvInfo
00302 {
00303 LvmLvInfo() {};
00304 VolumeInfo v;
00305 unsigned stripe;
00306 unsigned stripe_size;
00307 string uuid;
00308 string status;
00309 string allocation;
00310 string dm_table;
00311 string dm_target;
00312 };
00313
00317 struct EvmsInfo
00318 {
00319 EvmsInfo() {};
00320 VolumeInfo v;
00321 unsigned stripe;
00322 unsigned stripe_size;
00323 bool compatible;
00324 string dm_table;
00325 string dm_target;
00326 };
00327
00331 struct MdInfo
00332 {
00333 MdInfo() {};
00334 VolumeInfo v;
00335 unsigned nr;
00336 unsigned type;
00337 unsigned parity;
00338 string uuid;
00339 string sb_ver;
00340 unsigned long chunk;
00341 string devices;
00342 };
00343
00347 struct NfsInfo
00348 {
00349 NfsInfo() {};
00350 VolumeInfo v;
00351 };
00352
00356 struct LoopInfo
00357 {
00358 LoopInfo() {};
00359 VolumeInfo v;
00360 bool reuseFile;
00361 unsigned nr;
00362 string file;
00363 };
00364
00368 struct DmInfo
00369 {
00370 DmInfo() {};
00371 VolumeInfo v;
00372 unsigned nr;
00373 string table;
00374 string target;
00375 };
00376
00380 struct DmPartInfo
00381 {
00382 DmPartInfo() {};
00383 VolumeInfo v;
00384 PartitionAddInfo p;
00385 bool part;
00386 string table;
00387 string target;
00388 };
00389
00393 struct DmraidInfo
00394 {
00395 DmraidInfo() {};
00396 DmPartInfo p;
00397 };
00398
00402 struct ContVolInfo
00403 {
00404 ContVolInfo() {numeric=false; nr=0; type=CUNKNOWN;};
00405 CType type;
00406 string cname;
00407 string vname;
00408 bool numeric;
00409 unsigned nr;
00410 };
00411
00415 enum ErrorCodes
00416 {
00417 DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00418 DISK_PARTITION_EXCEEDS_DISK = -1001,
00419 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00420 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00421 DISK_PARTITION_NO_FREE_NUMBER = -1004,
00422 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00423 DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00424 DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00425 DISK_PARTITION_NOT_FOUND = -1008,
00426 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00427 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00428 DISK_SET_TYPE_INVALID_VOLUME = -1011,
00429 DISK_SET_TYPE_PARTED_FAILED = -1012,
00430 DISK_SET_LABEL_PARTED_FAILED = -1013,
00431 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00432 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00433 DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00434 DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00435 DISK_PARTITION_ZERO_SIZE = -1018,
00436 DISK_CHANGE_READONLY = -1019,
00437 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00438 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00439 DISK_RESIZE_NO_SPACE = -1022,
00440 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00441 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00442 DISK_COMMIT_NOTHING_TODO = -1025,
00443 DISK_CREATE_PARTITION_NO_SPACE = -1026,
00444 DISK_REMOVE_USED_BY = -1027,
00445 DISK_INIT_NOT_POSSIBLE = -1028,
00446
00447 STORAGE_DISK_NOT_FOUND = -2000,
00448 STORAGE_VOLUME_NOT_FOUND = -2001,
00449 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00450 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00451 STORAGE_CHANGE_READONLY = -2004,
00452 STORAGE_DISK_USED_BY = -2005,
00453 STORAGE_LVM_VG_EXISTS = -2006,
00454 STORAGE_LVM_VG_NOT_FOUND = -2007,
00455 STORAGE_LVM_INVALID_DEVICE = -2008,
00456 STORAGE_CONTAINER_NOT_FOUND = -2009,
00457 STORAGE_VG_INVALID_NAME = -2010,
00458 STORAGE_REMOVE_USED_VOLUME = -2011,
00459 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00460 STORAGE_NOT_YET_IMPLEMENTED = -2013,
00461 STORAGE_MD_INVALID_NAME = -2014,
00462 STORAGE_MD_NOT_FOUND = -2015,
00463 STORAGE_MEMORY_EXHAUSTED = -2016,
00464 STORAGE_LOOP_NOT_FOUND = -2017,
00465 STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00466 STORAGE_EVMS_INVALID_NAME = -2019,
00467 STORAGE_EVMS_CO_EXISTS = -2020,
00468 STORAGE_EVMS_CO_NOT_FOUND = -2021,
00469 STORAGE_EVMS_INVALID_DEVICE = -2022,
00470 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00471 STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00472 STORAGE_INVALID_FSTAB_VALUE = -2025,
00473 STORAGE_NO_FSTAB_PTR = -2026,
00474 STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00475 STORAGE_DMRAID_CO_NOT_FOUND = -2028,
00476 STORAGE_RESIZE_INVALID_CONTAINER = -2029,
00477
00478 VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00479 VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00480 VOLUME_UMOUNT_FAILED = -3002,
00481 VOLUME_MOUNT_FAILED = -3003,
00482 VOLUME_FORMAT_DD_FAILED = -3004,
00483 VOLUME_FORMAT_UNKNOWN_FS = -3005,
00484 VOLUME_FORMAT_FS_UNDETECTED = -3006,
00485 VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00486 VOLUME_FORMAT_FAILED = -3008,
00487 VOLUME_TUNE2FS_FAILED = -3009,
00488 VOLUME_MKLABEL_FS_UNABLE = -3010,
00489 VOLUME_MKLABEL_FAILED = -3011,
00490 VOLUME_LOSETUP_NO_LOOP = -3012,
00491 VOLUME_LOSETUP_FAILED = -3013,
00492 VOLUME_CRYPT_NO_PWD = -3014,
00493 VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00494 VOLUME_CRYPT_NOT_DETECTED = -3016,
00495 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00496 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00497 VOLUME_MOUNT_POINT_INVALID = -3019,
00498 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00499 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00500 VOLUME_LABEL_NOT_SUPPORTED = -3022,
00501 VOLUME_LABEL_TOO_LONG = -3023,
00502 VOLUME_LABEL_WHILE_MOUNTED = -3024,
00503 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00504 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00505 VOLUME_RESIZE_FAILED = -3027,
00506 VOLUME_ALREADY_IN_USE = -3028,
00507 VOLUME_LOUNSETUP_FAILED = -3029,
00508 VOLUME_DEVICE_NOT_PRESENT = -3030,
00509 VOLUME_DEVICE_NOT_BLOCK = -3031,
00510 VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
00511 VOLUME_CRYPTFORMAT_FAILED = -3033,
00512 VOLUME_CRYPTSETUP_FAILED = -3034,
00513 VOLUME_CRYPTUNSETUP_FAILED = -3035,
00514 VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
00515 VOLUME_FORMAT_NFS_IMPOSSIBLE = -3037,
00516 VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
00517 VOLUME_REMOUNT_FAILED = -3039,
00518
00519 LVM_CREATE_PV_FAILED = -4000,
00520 LVM_PV_ALREADY_CONTAINED = -4001,
00521 LVM_PV_DEVICE_UNKNOWN = -4002,
00522 LVM_PV_DEVICE_USED = -4003,
00523 LVM_VG_HAS_NONE_PV = -4004,
00524 LVM_LV_INVALID_NAME = -4005,
00525 LVM_LV_DUPLICATE_NAME = -4006,
00526 LVM_LV_NO_SPACE = -4007,
00527 LVM_LV_UNKNOWN_NAME = -4008,
00528 LVM_LV_NOT_IN_LIST = -4009,
00529 LVM_VG_CREATE_FAILED = -4010,
00530 LVM_VG_EXTEND_FAILED = -4011,
00531 LVM_VG_REDUCE_FAILED = -4012,
00532 LVM_VG_REMOVE_FAILED = -4013,
00533 LVM_LV_CREATE_FAILED = -4014,
00534 LVM_LV_REMOVE_FAILED = -4015,
00535 LVM_LV_RESIZE_FAILED = -4016,
00536 LVM_PV_STILL_ADDED = -4017,
00537 LVM_PV_REMOVE_NOT_FOUND = -4018,
00538 LVM_CREATE_LV_INVALID_VOLUME = -4019,
00539 LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00540 LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00541 LVM_CHANGE_READONLY = -4022,
00542 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00543 LVM_COMMIT_NOTHING_TODO = -4024,
00544 LVM_LV_REMOVE_USED_BY = -4025,
00545 LVM_LV_ALREADY_ON_DISK = -4026,
00546 LVM_LV_NO_STRIPE_SIZE = -4027,
00547
00548 FSTAB_ENTRY_NOT_FOUND = -5000,
00549 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00550 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00551 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00552 FSTAB_ADD_ENTRY_FOUND = -5004,
00553
00554 MD_CHANGE_READONLY = -6000,
00555 MD_DUPLICATE_NUMBER = -6001,
00556 MD_TOO_FEW_DEVICES = -6002,
00557 MD_DEVICE_UNKNOWN = -6003,
00558 MD_DEVICE_USED = -6004,
00559 MD_CREATE_INVALID_VOLUME = -6005,
00560 MD_REMOVE_FAILED = -6006,
00561 MD_NOT_IN_LIST = -6007,
00562 MD_CREATE_FAILED = -6008,
00563 MD_UNKNOWN_NUMBER = -6009,
00564 MD_REMOVE_USED_BY = -6010,
00565 MD_NUMBER_TOO_LARGE = -6011,
00566 MD_REMOVE_INVALID_VOLUME = -6012,
00567 MD_REMOVE_CREATE_NOT_FOUND = -6013,
00568 MD_NO_RESIZE_ON_DISK = -6014,
00569 MD_ADD_DUPLICATE = -6015,
00570 MD_REMOVE_NONEXISTENT = -6016,
00571 MD_NO_CHANGE_ON_DISK = -6017,
00572 MD_NO_CREATE_UNKNOWN = -6018,
00573
00574 LOOP_CHANGE_READONLY = -7000,
00575 LOOP_DUPLICATE_FILE = -7001,
00576 LOOP_UNKNOWN_FILE = -7002,
00577 LOOP_REMOVE_USED_BY = -7003,
00578 LOOP_FILE_CREATE_FAILED = -7004,
00579 LOOP_CREATE_INVALID_VOLUME = -7005,
00580 LOOP_REMOVE_FILE_FAILED = -7006,
00581 LOOP_REMOVE_INVALID_VOLUME = -7007,
00582 LOOP_NOT_IN_LIST = -7008,
00583 LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00584 LOOP_MODIFY_EXISTING = -7010,
00585
00586 EVMS_HELPER_UNKNOWN_CMD = -8000,
00587 EVMS_UNSUPPORTED_CONTAINER_TYPE = -8001,
00588 EVMS_MALLOC_FAILED = -8002,
00589 EVMS_INVALID_PHYSICAL_VOLUME = -8003,
00590 EVMS_PHYSICAL_VOLUME_IN_USE = -8004,
00591 EVMS_PLUGIN_NOT_FOUND = -8005,
00592 EVMS_CREATE_CONTAINER_FAILED = -8006,
00593 EVMS_RESIZE_VOLUME_NOT_FOUND = -8007,
00594 EVMS_RESIZE_CONTAINER_NOT_FOUND = -8008,
00595 EVMS_RESIZE_EXPAND_FAILED = -8009,
00596 EVMS_RESIZE_SHRINK_FAILED = -8010,
00597 EVMS_COMMIT_FAILED = -8011,
00598 EVMS_CREATE_VOLUME_FREESPACE_NOT_FOUND = -8012,
00599 EVMS_CREATE_VOLUME_FAILED = -8013,
00600 EVMS_CREATE_COMPAT_VOLUME_FAILED = -8014,
00601 EVMS_SEGMENT_NOT_FOUND = -8015,
00602 EVMS_REMOVE_VOLUME_NOT_FOUND = -8016,
00603 EVMS_REMOVE_REGION_FAILED = -8017,
00604 EVMS_CONTAINER_NOT_FOUND = -8018,
00605 EVMS_CONTAINER_EXPAND_FAILED = -8019,
00606 EVMS_CONTAINER_SHRINK_INVALID_SEGMENT = -8020,
00607 EVMS_CONTAINER_SHRINK_FAILED = -8021,
00608 EVMS_CONTAINER_REMOVE_FAILED = -8022,
00609 EVMS_PV_ALREADY_CONTAINED = -8023,
00610 EVMS_PV_DEVICE_UNKNOWN = -8024,
00611 EVMS_PV_DEVICE_USED = -8025,
00612 EVMS_CO_HAS_NONE_PV = -8026,
00613 EVMS_LV_INVALID_NAME = -8027,
00614 EVMS_LV_DUPLICATE_NAME = -8028,
00615 EVMS_LV_NO_SPACE = -8029,
00616 EVMS_LV_UNKNOWN_NAME = -8030,
00617 EVMS_LV_NOT_IN_LIST = -8031,
00618 EVMS_PV_STILL_ADDED = -8032,
00619 EVMS_PV_REMOVE_NOT_FOUND = -8033,
00620 EVMS_CREATE_LV_INVALID_VOLUME = -8034,
00621 EVMS_REMOVE_LV_INVALID_VOLUME = -8035,
00622 EVMS_RESIZE_LV_INVALID_VOLUME = -8036,
00623 EVMS_CHANGE_READONLY = -8037,
00624 EVMS_CHECK_RESIZE_INVALID_VOLUME = -8038,
00625 EVMS_COMMIT_NOTHING_TODO = -8039,
00626 EVMS_LV_REMOVE_USED_BY = -8040,
00627 EVMS_COMMUNICATION_FAILED = -8041,
00628 EVMS_LV_ALREADY_ON_DISK = -8042,
00629 EVMS_LV_NO_STRIPE_SIZE = -8043,
00630 EVMS_ACTIVATE_FAILED = -8044,
00631 EVMS_CONTAINER_NOT_CREATED = -8045,
00632
00633 PEC_PE_SIZE_INVALID = -9000,
00634 PEC_PV_NOT_FOUND = -9001,
00635 PEC_REMOVE_PV_IN_USE = -9002,
00636 PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00637 PEC_LV_NO_SPACE_STRIPED = -9004,
00638 PEC_LV_NO_SPACE_SINGLE = -9005,
00639 PEC_LV_PE_DEV_NOT_FOUND = -9006,
00640
00641 DM_CHANGE_READONLY = -10000,
00642 DM_UNKNOWN_TABLE = -10001,
00643 DM_REMOVE_USED_BY = -10002,
00644 DM_REMOVE_CREATE_NOT_FOUND = -10003,
00645 DM_REMOVE_INVALID_VOLUME = -10004,
00646 DM_REMOVE_FAILED = -10005,
00647 DM_NOT_IN_LIST = -10006,
00648
00649 DASD_NOT_POSSIBLE = -11000,
00650 DASD_FDASD_FAILED = -11001,
00651 DASD_DASDFMT_FAILED = -11002,
00652
00653 DMPART_CHANGE_READONLY = -12001,
00654 DMPART_INTERNAL_ERR = -12002,
00655 DMPART_INVALID_VOLUME = -12003,
00656 DMPART_PARTITION_NOT_FOUND = -12004,
00657 DMPART_REMOVE_PARTITION_LIST_ERASE = -12005,
00658 DMPART_COMMIT_NOTHING_TODO = -12006,
00659 DMPART_NO_REMOVE = -12007,
00660
00661 DMRAID_REMOVE_FAILED = -13001,
00662
00663 NFS_VOLUME_NOT_FOUND = -14001,
00664 NFS_CHANGE_READONLY = -14002,
00665 NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
00666 NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
00667 NFS_REMOVE_INVALID_VOLUME = -14005,
00668
00669 CONTAINER_INTERNAL_ERROR = -99000,
00670 CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00671
00672 };
00673
00674
00678 class StorageInterface
00679 {
00680 public:
00681
00682 StorageInterface () {}
00683 virtual ~StorageInterface () {}
00684
00688 virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00689
00697 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
00698
00707 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
00708 DiskInfo& info ) = 0;
00709
00717 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
00718
00727 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
00728 LvmVgInfo& info) = 0;
00729
00737 virtual int getEvmsCoInfo( const string& name, EvmsCoInfo& info) = 0;
00738
00747 virtual int getContEvmsCoInfo( const string& name, ContainerInfo& cinfo,
00748 EvmsCoInfo& info) = 0;
00749
00757 virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0;
00758
00767 virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo,
00768 DmraidCoInfo& info) = 0;
00769
00775 virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
00776
00784 virtual int getVolume( const string& device, VolumeInfo& info) = 0;
00785
00793 virtual int getPartitionInfo( const string& disk,
00794 deque<PartitionInfo>& plist ) = 0;
00795
00803 virtual int getLvmLvInfo( const string& name,
00804 deque<LvmLvInfo>& plist ) = 0;
00805
00813 virtual int getEvmsInfo( const string& name,
00814 deque<EvmsInfo>& plist ) = 0;
00815
00822 virtual int getMdInfo( deque<MdInfo>& plist ) = 0;
00823
00830 virtual int getNfsInfo( deque<NfsInfo>& plist ) = 0;
00831
00838 virtual int getLoopInfo( deque<LoopInfo>& plist ) = 0;
00839
00846 virtual int getDmInfo( deque<DmInfo>& plist ) = 0;
00847
00855 virtual int getDmraidInfo( const string& name,
00856 deque<DmraidInfo>& plist ) = 0;
00857
00861 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
00862
00867 virtual string getAllUsedFs() const = 0;
00868
00876 virtual void printInfo( std::ostream& str ) = 0;
00877
00886 virtual void printInfoCo( std::ostream& str, const string& name ) = 0;
00887
00900 virtual int createPartition( const string& disk, PartitionType type,
00901 unsigned long start,
00902 unsigned long sizeCyl,
00903 string& device ) = 0;
00904
00913 virtual int resizePartition( const string& device,
00914 unsigned long sizeCyl ) = 0;
00915
00924 virtual int resizePartitionNoFs( const string& device,
00925 unsigned long sizeCyl ) = 0;
00926
00937 virtual int updatePartitionArea( const string& device,
00938 unsigned long start,
00939 unsigned long sizeCyl ) = 0;
00940
00941
00951 virtual int nextFreePartition( const string& disk, PartitionType type,
00952 unsigned &nr, string& device ) = 0;
00953
00966 virtual int createPartitionKb( const string& disk, PartitionType type,
00967 unsigned long long start,
00968 unsigned long long size,
00969 string& device ) = 0;
00970
00981 virtual int createPartitionAny( const string& disk,
00982 unsigned long long size,
00983 string& device ) = 0;
00984
00995 virtual int createPartitionMax( const string& disk, PartitionType type,
00996 string& device ) = 0;
00997
01005 virtual unsigned long long cylinderToKb( const string& disk,
01006 unsigned long size ) = 0;
01007
01015 virtual unsigned long kbToCylinder( const string& disk,
01016 unsigned long long size ) = 0;
01017
01024 virtual int removePartition (const string& partition) = 0;
01025
01033 virtual int changePartitionId (const string& partition, unsigned id) = 0;
01034
01041 virtual int forgetChangePartitionId (const string& partition ) = 0;
01042
01051 virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
01052
01063 virtual int initializeDisk( const string& disk, bool value ) = 0;
01064
01071 virtual string defaultDiskLabel() const = 0;
01072
01082 virtual string defaultDiskLabelSize( unsigned long long size_k ) const = 0;
01083
01089 virtual unsigned long long maxSizeLabelK( const string& label ) const = 0;
01090
01099 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
01100
01108 virtual int changeLabelVolume( const string& device, const string& label ) = 0;
01109
01117 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
01118
01126 virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0;
01127
01136 virtual int changeMountPoint( const string& device, const string& mount ) = 0;
01137
01145 virtual int getMountPoint( const string& device, string& mount ) = 0;
01146
01154 virtual int changeMountBy( const string& device, MountByType mby ) = 0;
01155
01163 #ifndef SWIG
01164 virtual int getMountBy( const string& device, MountByType& mby ) = 0;
01165 #else
01166 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0;
01167 #endif
01168
01178 virtual int changeFstabOptions( const string& device, const string& options ) = 0;
01179
01188 virtual int getFstabOptions( const string& device, string& options ) = 0;
01189
01198 virtual int addFstabOptions( const string& device, const string& options ) = 0;
01199
01209 virtual int removeFstabOptions( const string& device, const string& options ) = 0;
01210
01218 virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
01219
01226 virtual int forgetCryptPassword( const string& device ) = 0;
01227
01235 virtual int getCryptPassword( const string& device, string& pwd ) = 0;
01236
01244 virtual int setCrypt( const string& device, bool val ) = 0;
01245
01254 virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0;
01255
01263 #ifndef SWIG
01264 virtual int getCrypt( const string& device, bool& val ) = 0;
01265 #else
01266 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0;
01267 #endif
01268
01278 virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01279
01287 #ifndef SWIG
01288 virtual int getIgnoreFstab( const string& device, bool& val ) = 0;
01289 #else
01290 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0;
01291 #endif
01292
01301 virtual int changeDescText( const string& device, const string& txt ) = 0;
01302
01314 virtual int addFstabEntry( const string& device, const string& mount,
01315 const string& vfs, const string& options,
01316 unsigned freq, unsigned passno ) = 0;
01317
01318
01326 virtual int resizeVolume( const string& device, unsigned long long newSizeMb ) = 0;
01327
01335 virtual int resizeVolumeNoFs( const string& device, unsigned long long newSizeMb ) = 0;
01336
01343 virtual int forgetResizeVolume( const string& device ) = 0;
01344
01359 virtual void setRecursiveRemoval( bool val ) = 0;
01360
01366 virtual bool getRecursiveRemoval() const = 0;
01367
01381 virtual void setZeroNewPartitions( bool val ) = 0;
01382
01388 virtual bool getZeroNewPartitions() const = 0;
01389
01393 virtual void setDefaultMountBy( MountByType val ) = 0;
01394
01398 virtual MountByType getDefaultMountBy() const = 0;
01399
01409 virtual void setRootPrefix( const string& root ) = 0;
01410
01416 virtual void setDetectMountedVolumes( bool val ) = 0;
01417
01423 virtual bool getDetectMountedVolumes() const = 0;
01424
01432 virtual int removeVolume( const string& device ) = 0;
01433
01444 virtual int createLvmVg( const string& name,
01445 unsigned long long peSizeK, bool lvm1,
01446 const deque<string>& devs ) = 0;
01447
01455 virtual int removeLvmVg( const string& name ) = 0;
01456
01464 virtual int extendLvmVg( const string& name,
01465 const deque<string>& devs ) = 0;
01466
01474 virtual int shrinkLvmVg( const string& name,
01475 const deque<string>& devs ) = 0;
01476
01488 virtual int createLvmLv( const string& vg, const string& name,
01489 unsigned long long sizeM, unsigned stripe,
01490 string& device ) = 0;
01491
01498 virtual int removeLvmLvByDevice( const string& device ) = 0;
01499
01507 virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01508
01518 virtual int changeLvStripeCount( const string& vg, const string& name,
01519 unsigned long stripes ) = 0;
01520
01530 virtual int changeLvStripeSize( const string& vg, const string& name,
01531 unsigned long long stripeSize ) = 0;
01532
01543 virtual int createEvmsContainer( const string& name,
01544 unsigned long long peSizeK, bool lvm1,
01545 const deque<string>& devs ) = 0;
01546
01561 virtual int modifyEvmsContainer( const string& old_name,
01562 const string& new_name,
01563 unsigned long long peSizeK,
01564 bool lvm1 ) = 0;
01565
01573 virtual int removeEvmsContainer( const string& name ) = 0;
01574
01582 virtual int extendEvmsContainer( const string& name,
01583 const deque<string>& devs ) = 0;
01584
01592 virtual int shrinkEvmsContainer( const string& name,
01593 const deque<string>& devs ) = 0;
01594
01606 virtual int createEvmsVolume( const string& coname, const string& name,
01607 unsigned long long sizeM, unsigned stripe,
01608 string& device ) = 0;
01609
01616 virtual int removeEvmsVolumeByDevice( const string& device ) = 0;
01617
01625 virtual int removeEvmsVolume( const string& coname, const string& name ) = 0;
01626
01636 virtual int changeEvmsStripeCount( const string& coname,
01637 const string& name,
01638 unsigned long stripe ) = 0;
01639
01649 virtual int changeEvmsStripeSize( const string& coname,
01650 const string& name,
01651 unsigned long long stripeSize ) = 0;
01652
01662 virtual int evmsActivate( bool force ) = 0;
01663
01672 virtual int createMd( const string& name, MdType rtype,
01673 const deque<string>& devs ) = 0;
01674
01683 virtual int createMdAny( MdType rtype, const deque<string>& devs,
01684 string& device ) = 0;
01685
01694 virtual int removeMd( const string& name, bool destroySb ) = 0;
01695
01704 virtual int extendMd( const string& name, const string& dev ) = 0;
01705
01714 virtual int shrinkMd( const string& name, const string& dev ) = 0;
01715
01724 virtual int changeMdType( const string& name, MdType rtype ) = 0;
01725
01734 virtual int changeMdChunk( const string& name, unsigned long chunk ) = 0;
01735
01744 virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
01745
01752 virtual int checkMd( const string& name ) = 0;
01753
01763 virtual int addNfsDevice( const string& nfsDev, const string& opts,
01764 unsigned long long sizeK,
01765 const string& mp ) = 0;
01766
01775 virtual int checkNfsDevice( const string& nfsDev, const string& opts,
01776 unsigned long long& sizeK ) = 0;
01777
01794 virtual int createFileLoop( const string& lname, bool reuseExisting,
01795 unsigned long long sizeK,
01796 const string& mp, const string& pwd,
01797 string& device ) = 0;
01798
01816 virtual int modifyFileLoop( const string& device, const string& lname,
01817 bool reuseExisting,
01818 unsigned long long sizeK ) = 0;
01819
01828 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
01829
01836 virtual int removeDmraid( const string& name ) = 0;
01837
01846 virtual deque<string> getCommitActions( bool mark_destructive ) = 0;
01847
01853 virtual const string& getLastAction() const = 0;
01854
01861 virtual const string& getExtendedErrorMessage() const = 0;
01862
01863
01864 #ifndef SWIG
01865
01871 virtual void setCallbackProgressBar( CallbackProgressBar pfnc ) = 0;
01872
01878 virtual CallbackProgressBar getCallbackProgressBar() const = 0;
01879
01880
01886 virtual void setCallbackShowInstallInfo( CallbackShowInstallInfo pfnc ) = 0;
01887
01893 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
01894
01895
01902 virtual void setCallbackInfoPopup( CallbackInfoPopup pfnc ) = 0;
01903
01910 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
01911
01912
01919 virtual void setCallbackYesNoPopup( CallbackYesNoPopup pfnc ) = 0;
01920
01927 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
01928
01929 #endif
01930
01936 virtual void setCacheChanges (bool cache) = 0;
01937
01941 virtual bool isCacheChanges () const = 0;
01942
01947 virtual int commit() = 0;
01948
01955 virtual int createBackupState( const string& name ) = 0;
01956
01963 virtual int restoreBackupState( const string& name ) = 0;
01964
01971 virtual bool checkBackupState( const string& name ) = 0;
01972
01981 virtual bool equalBackupStates( const string& lhs,
01982 const string& rhs,
01983 bool verbose_log ) const = 0;
01984
01992 virtual int removeBackupState( const string& name ) = 0;
01993
02001 virtual bool checkDeviceMounted( const string& device, string& mp ) = 0;
02002
02011 virtual bool umountDevice( const string& device ) = 0;
02012
02022 virtual bool mountDevice( const string& device, const string& mp ) = 0;
02023
02034 virtual bool mountDeviceOpts( const string& device, const string& mp,
02035 const string& opts ) = 0;
02036
02047 virtual bool mountDeviceRo( const string& device, const string& mp,
02048 const string& opts ) = 0;
02049
02056 virtual bool checkDmMapsTo( const string& device ) = 0;
02057
02063 virtual void removeDmTableTo( const string& device ) = 0;
02064
02076 virtual bool getFreeInfo( const string& device,
02077 unsigned long long& resize_free,
02078 unsigned long long& df_free,
02079 unsigned long long& used,
02080 bool& win, bool& efi, bool use_cache ) = 0;
02081
02089 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
02090
02098 virtual void setNoEvms( bool val ) = 0;
02099
02105 virtual bool getNoEvms() = 0;
02106
02113 virtual void activateHld( bool val ) = 0;
02114
02123 virtual void rescanEverything() = 0;
02124
02128 virtual void dumpObjectList() = 0;
02129
02139 virtual int getContVolInfo( const string& dev, ContVolInfo& info) = 0;
02140
02141 };
02142
02143
02147 void initDefaultLogger ();
02148
02149
02153 StorageInterface* createDefaultStorageInterface ();
02154
02155
02159 StorageInterface* createStorageInterface (bool readonly, bool testmode,
02160 bool autodetect);
02161
02162
02166 void destroyStorageInterface (StorageInterface*);
02167
02168 }
02169
02170
02171 #endif