00001 #ifndef STORAGE_INTERFACE_H
00002 #define STORAGE_INTERFACE_H
00003
00004
00005 #include <string>
00006 #include <deque>
00007 #include <list>
00008 #include <ostream>
00009
00010 using std::string;
00011 using std::deque;
00012 using std::list;
00013
00014
00099 namespace storage
00100 {
00101 enum FsType { FSUNKNOWN, REISERFS, EXT2, EXT3, VFAT, XFS, JFS, HFS, NTFS, SWAP, HFSPLUS, NFS, FSNONE };
00102
00103 enum PartitionType { PRIMARY, EXTENDED, LOGICAL, PTYPE_ANY };
00104
00105 enum MountByType { MOUNTBY_DEVICE, MOUNTBY_UUID, MOUNTBY_LABEL, MOUNTBY_ID, MOUNTBY_PATH };
00106
00107 enum EncryptType { ENC_NONE, ENC_TWOFISH, ENC_TWOFISH_OLD,
00108 ENC_TWOFISH256_OLD, ENC_LUKS, ENC_UNKNOWN };
00109
00110 enum MdType { RAID_UNK, RAID0, RAID1, RAID5, RAID6, RAID10, MULTIPATH };
00111
00112 enum MdParity { PAR_NONE, LEFT_ASYMMETRIC, LEFT_SYMMETRIC,
00113 RIGHT_ASYMMETRIC, RIGHT_SYMMETRIC };
00114
00115 enum UsedByType { UB_NONE, UB_LVM, UB_MD, UB_DM, UB_DMRAID, UB_DMMULTIPATH };
00116
00117 enum CType { CUNKNOWN, DISK, MD, LOOP, LVM, DM, DMRAID, NFSC, DMMULTIPATH,
00118 COTYPE_LAST_ENTRY };
00119
00123 typedef void (*CallbackProgressBar)( const string& id, unsigned cur, unsigned max );
00124
00129 typedef void (*CallbackShowInstallInfo)( const string& id );
00130
00135 typedef void (*CallbackInfoPopup)( const string& text );
00136
00143 typedef bool (*CallbackYesNoPopup)( const string& text );
00144
00145
00149 struct FsCapabilities
00150 {
00151 FsCapabilities () {}
00152 bool isExtendable;
00153 bool isExtendableWhileMounted;
00154 bool isReduceable;
00155 bool isReduceableWhileMounted;
00156 bool supportsUuid;
00157 bool supportsLabel;
00158 bool labelWhileMounted;
00159 unsigned int labelLength;
00160 unsigned long long minimalFsSizeK;
00161 };
00162
00166 struct ContainerInfo
00167 {
00168 ContainerInfo() {}
00169 CType type;
00170 unsigned volcnt;
00171 string device;
00172 string name;
00173 UsedByType usedByType;
00174 string usedByName;
00175 string usedByDevice;
00176 bool readonly;
00177 };
00178
00182 struct DiskInfo
00183 {
00184 DiskInfo() {}
00185 unsigned long long sizeK;
00186 unsigned long long cylSizeB;
00187 unsigned long cyl;
00188 unsigned long heads;
00189 unsigned long sectors;
00190 string disklabel;
00191 string udevPath;
00192 string udevId;
00193 unsigned maxLogical;
00194 unsigned maxPrimary;
00195 bool initDisk;
00196 bool iscsi;
00197 };
00198
00202 struct LvmVgInfo
00203 {
00204 LvmVgInfo() {}
00205 unsigned long long sizeK;
00206 unsigned long long peSize;
00207 unsigned long peCount;
00208 unsigned long peFree;
00209 string uuid;
00210 bool lvm2;
00211 bool create;
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
00234 struct DmmultipathCoInfo
00235 {
00236 DmmultipathCoInfo() {}
00237 DmPartCoInfo p;
00238 string vendor;
00239 string model;
00240 };
00241
00245 struct VolumeInfo
00246 {
00247 VolumeInfo() {}
00248 unsigned long long sizeK;
00249 unsigned long major;
00250 unsigned long minor;
00251 string name;
00252 string device;
00253 string mount;
00254 MountByType mount_by;
00255 UsedByType usedByType;
00256 string usedByName;
00257 string usedByDevice;
00258 string fstab_options;
00259 string uuid;
00260 string label;
00261 string mkfs_options;
00262 string tunefs_options;
00263 string loop;
00264 string dtxt;
00265 EncryptType encryption;
00266 string crypt_pwd;
00267 FsType fs;
00268 bool format;
00269 bool create;
00270 bool is_mounted;
00271 bool resize;
00272 bool ignore_fs;
00273 unsigned long long OrigSizeK;
00274 };
00275
00276 struct PartitionAddInfo
00277 {
00278 PartitionAddInfo() {}
00279 unsigned nr;
00280 unsigned long cylStart;
00281 unsigned long cylSize;
00282 PartitionType partitionType;
00283 unsigned id;
00284 bool boot;
00285 string udevPath;
00286 string udevId;
00287 };
00288
00292 struct PartitionInfo
00293 {
00294 PartitionInfo() {}
00295 PartitionInfo& operator=( const PartitionAddInfo& rhs );
00296 VolumeInfo v;
00297 unsigned nr;
00298 unsigned long cylStart;
00299 unsigned long cylSize;
00300 PartitionType partitionType;
00301 unsigned id;
00302 bool boot;
00303 string udevPath;
00304 string udevId;
00305 };
00306
00310 struct LvmLvInfo
00311 {
00312 LvmLvInfo() {}
00313 VolumeInfo v;
00314 unsigned stripe;
00315 unsigned stripe_size;
00316 string uuid;
00317 string status;
00318 string allocation;
00319 string dm_table;
00320 string dm_target;
00321 string origin;
00322 unsigned long long sizeK;
00323 };
00324
00328 struct LvmLvSnapshotStateInfo
00329 {
00330 LvmLvSnapshotStateInfo() {}
00331 bool active;
00332 double allocated;
00333 };
00334
00338 struct MdInfo
00339 {
00340 MdInfo() {}
00341 VolumeInfo v;
00342 unsigned nr;
00343 unsigned type;
00344 unsigned parity;
00345 string uuid;
00346 string sb_ver;
00347 unsigned long chunk;
00348 string devices;
00349 };
00350
00354 struct MdStateInfo
00355 {
00356 MdStateInfo() {}
00357 bool active;
00358 bool degraded;
00359 };
00360
00364 struct NfsInfo
00365 {
00366 NfsInfo() {}
00367 VolumeInfo v;
00368 };
00369
00373 struct LoopInfo
00374 {
00375 LoopInfo() {}
00376 VolumeInfo v;
00377 bool reuseFile;
00378 unsigned nr;
00379 string file;
00380 };
00381
00385 struct DmInfo
00386 {
00387 DmInfo() {}
00388 VolumeInfo v;
00389 unsigned nr;
00390 string table;
00391 string target;
00392 };
00393
00397 struct DmPartInfo
00398 {
00399 DmPartInfo() {}
00400 VolumeInfo v;
00401 PartitionAddInfo p;
00402 bool part;
00403 string table;
00404 string target;
00405 };
00406
00410 struct DmraidInfo
00411 {
00412 DmraidInfo() {}
00413 DmPartInfo p;
00414 };
00415
00419 struct DmmultipathInfo
00420 {
00421 DmmultipathInfo() {}
00422 DmPartInfo p;
00423 };
00424
00428 struct ContVolInfo
00429 {
00430 ContVolInfo() { numeric=false; nr=0; type=CUNKNOWN; }
00431 CType type;
00432 string cname;
00433 string vname;
00434 bool numeric;
00435 unsigned nr;
00436 };
00437
00441 struct PartitionSlotInfo
00442 {
00443 PartitionSlotInfo() {}
00444 unsigned long cylStart;
00445 unsigned long cylSize;
00446 bool primarySlot;
00447 bool primaryPossible;
00448 bool extendedSlot;
00449 bool extendedPossible;
00450 bool logicalSlot;
00451 bool logicalPossible;
00452 };
00453
00457 struct CommitInfo
00458 {
00459 bool destructive;
00460 deque<string> actions;
00461 };
00462
00463
00467 enum ErrorCodes
00468 {
00469 DISK_PARTITION_OVERLAPS_EXISTING = -1000,
00470 DISK_PARTITION_EXCEEDS_DISK = -1001,
00471 DISK_CREATE_PARTITION_EXT_ONLY_ONCE = -1002,
00472 DISK_CREATE_PARTITION_EXT_IMPOSSIBLE = -1003,
00473 DISK_PARTITION_NO_FREE_NUMBER = -1004,
00474 DISK_CREATE_PARTITION_INVALID_VOLUME = -1005,
00475 DISK_CREATE_PARTITION_INVALID_TYPE = -1006,
00476 DISK_CREATE_PARTITION_PARTED_FAILED = -1007,
00477 DISK_PARTITION_NOT_FOUND = -1008,
00478 DISK_CREATE_PARTITION_LOGICAL_NO_EXT = -1009,
00479 DISK_PARTITION_LOGICAL_OUTSIDE_EXT = -1010,
00480 DISK_SET_TYPE_INVALID_VOLUME = -1011,
00481 DISK_SET_TYPE_PARTED_FAILED = -1012,
00482 DISK_SET_LABEL_PARTED_FAILED = -1013,
00483 DISK_REMOVE_PARTITION_PARTED_FAILED = -1014,
00484 DISK_REMOVE_PARTITION_INVALID_VOLUME = -1015,
00485 DISK_REMOVE_PARTITION_LIST_ERASE = -1016,
00486 DISK_DESTROY_TABLE_INVALID_LABEL = -1017,
00487 DISK_PARTITION_ZERO_SIZE = -1018,
00488 DISK_CHANGE_READONLY = -1019,
00489 DISK_RESIZE_PARTITION_INVALID_VOLUME = -1020,
00490 DISK_RESIZE_PARTITION_PARTED_FAILED = -1021,
00491 DISK_RESIZE_NO_SPACE = -1022,
00492 DISK_CHECK_RESIZE_INVALID_VOLUME = -1023,
00493 DISK_REMOVE_PARTITION_CREATE_NOT_FOUND = -1024,
00494 DISK_COMMIT_NOTHING_TODO = -1025,
00495 DISK_CREATE_PARTITION_NO_SPACE = -1026,
00496 DISK_REMOVE_USED_BY = -1027,
00497 DISK_INIT_NOT_POSSIBLE = -1028,
00498 DISK_INVALID_PARTITION_ID = -1029,
00499
00500 STORAGE_DISK_NOT_FOUND = -2000,
00501 STORAGE_VOLUME_NOT_FOUND = -2001,
00502 STORAGE_REMOVE_PARTITION_INVALID_CONTAINER = -2002,
00503 STORAGE_CHANGE_PARTITION_ID_INVALID_CONTAINER = -2003,
00504 STORAGE_CHANGE_READONLY = -2004,
00505 STORAGE_DISK_USED_BY = -2005,
00506 STORAGE_LVM_VG_EXISTS = -2006,
00507 STORAGE_LVM_VG_NOT_FOUND = -2007,
00508 STORAGE_LVM_INVALID_DEVICE = -2008,
00509 STORAGE_CONTAINER_NOT_FOUND = -2009,
00510 STORAGE_VG_INVALID_NAME = -2010,
00511 STORAGE_REMOVE_USED_VOLUME = -2011,
00512 STORAGE_REMOVE_USING_UNKNOWN_TYPE = -2012,
00513 STORAGE_NOT_YET_IMPLEMENTED = -2013,
00514 STORAGE_MD_INVALID_NAME = -2014,
00515 STORAGE_MD_NOT_FOUND = -2015,
00516 STORAGE_MEMORY_EXHAUSTED = -2016,
00517 STORAGE_LOOP_NOT_FOUND = -2017,
00518 STORAGE_CREATED_LOOP_NOT_FOUND = -2018,
00519 STORAGE_CHANGE_AREA_INVALID_CONTAINER = -2023,
00520 STORAGE_BACKUP_STATE_NOT_FOUND = -2024,
00521 STORAGE_INVALID_FSTAB_VALUE = -2025,
00522 STORAGE_NO_FSTAB_PTR = -2026,
00523 STORAGE_DEVICE_NODE_NOT_FOUND = -2027,
00524 STORAGE_DMRAID_CO_NOT_FOUND = -2028,
00525 STORAGE_RESIZE_INVALID_CONTAINER = -2029,
00526 STORAGE_DMMULTIPATH_CO_NOT_FOUND = -2030,
00527 STORAGE_ZERO_DEVICE_FAILED = -2031,
00528
00529 VOLUME_COMMIT_UNKNOWN_STAGE = -3000,
00530 VOLUME_FSTAB_EMPTY_MOUNT = -3001,
00531 VOLUME_UMOUNT_FAILED = -3002,
00532 VOLUME_MOUNT_FAILED = -3003,
00533 VOLUME_FORMAT_UNKNOWN_FS = -3005,
00534 VOLUME_FORMAT_FS_UNDETECTED = -3006,
00535 VOLUME_FORMAT_FS_TOO_SMALL = -3007,
00536 VOLUME_FORMAT_FAILED = -3008,
00537 VOLUME_TUNE2FS_FAILED = -3009,
00538 VOLUME_MKLABEL_FS_UNABLE = -3010,
00539 VOLUME_MKLABEL_FAILED = -3011,
00540 VOLUME_LOSETUP_NO_LOOP = -3012,
00541 VOLUME_LOSETUP_FAILED = -3013,
00542 VOLUME_CRYPT_NO_PWD = -3014,
00543 VOLUME_CRYPT_PWD_TOO_SHORT = -3015,
00544 VOLUME_CRYPT_NOT_DETECTED = -3016,
00545 VOLUME_FORMAT_EXTENDED_UNSUPPORTED = -3017,
00546 VOLUME_MOUNT_EXTENDED_UNSUPPORTED = -3018,
00547 VOLUME_MOUNT_POINT_INVALID = -3019,
00548 VOLUME_MOUNTBY_NOT_ENCRYPTED = -3020,
00549 VOLUME_MOUNTBY_UNSUPPORTED_BY_FS = -3021,
00550 VOLUME_LABEL_NOT_SUPPORTED = -3022,
00551 VOLUME_LABEL_TOO_LONG = -3023,
00552 VOLUME_LABEL_WHILE_MOUNTED = -3024,
00553 VOLUME_RESIZE_UNSUPPORTED_BY_FS = -3025,
00554 VOLUME_RESIZE_UNSUPPORTED_BY_CONTAINER = -3026,
00555 VOLUME_RESIZE_FAILED = -3027,
00556 VOLUME_ALREADY_IN_USE = -3028,
00557 VOLUME_LOUNSETUP_FAILED = -3029,
00558 VOLUME_DEVICE_NOT_PRESENT = -3030,
00559 VOLUME_DEVICE_NOT_BLOCK = -3031,
00560 VOLUME_MOUNTBY_UNSUPPORTED_BY_VOLUME = -3032,
00561 VOLUME_CRYPTFORMAT_FAILED = -3033,
00562 VOLUME_CRYPTSETUP_FAILED = -3034,
00563 VOLUME_CRYPTUNSETUP_FAILED = -3035,
00564 VOLUME_FORMAT_NOT_IMPLEMENTED = -3036,
00565 VOLUME_FORMAT_NFS_IMPOSSIBLE = -3037,
00566 VOLUME_CRYPT_NFS_IMPOSSIBLE = -3038,
00567 VOLUME_REMOUNT_FAILED = -3039,
00568 VOLUME_TUNEREISERFS_FAILED = -3040,
00569
00570 LVM_CREATE_PV_FAILED = -4000,
00571 LVM_PV_ALREADY_CONTAINED = -4001,
00572 LVM_PV_DEVICE_UNKNOWN = -4002,
00573 LVM_PV_DEVICE_USED = -4003,
00574 LVM_VG_HAS_NONE_PV = -4004,
00575 LVM_LV_INVALID_NAME = -4005,
00576 LVM_LV_DUPLICATE_NAME = -4006,
00577 LVM_LV_NO_SPACE = -4007,
00578 LVM_LV_UNKNOWN_NAME = -4008,
00579 LVM_LV_NOT_IN_LIST = -4009,
00580 LVM_VG_CREATE_FAILED = -4010,
00581 LVM_VG_EXTEND_FAILED = -4011,
00582 LVM_VG_REDUCE_FAILED = -4012,
00583 LVM_VG_REMOVE_FAILED = -4013,
00584 LVM_LV_CREATE_FAILED = -4014,
00585 LVM_LV_REMOVE_FAILED = -4015,
00586 LVM_LV_RESIZE_FAILED = -4016,
00587 LVM_PV_STILL_ADDED = -4017,
00588 LVM_PV_REMOVE_NOT_FOUND = -4018,
00589 LVM_CREATE_LV_INVALID_VOLUME = -4019,
00590 LVM_REMOVE_LV_INVALID_VOLUME = -4020,
00591 LVM_RESIZE_LV_INVALID_VOLUME = -4021,
00592 LVM_CHANGE_READONLY = -4022,
00593 LVM_CHECK_RESIZE_INVALID_VOLUME = -4023,
00594 LVM_COMMIT_NOTHING_TODO = -4024,
00595 LVM_LV_REMOVE_USED_BY = -4025,
00596 LVM_LV_ALREADY_ON_DISK = -4026,
00597 LVM_LV_NO_STRIPE_SIZE = -4027,
00598 LVM_LV_UNKNOWN_ORIGIN = -4028,
00599 LVM_LV_NOT_ON_DISK = -4029,
00600 LVM_LV_NOT_SNAPSHOT = -4030,
00601 LVM_LV_HAS_SNAPSHOTS = -4031,
00602 LVM_LV_IS_SNAPSHOT = -4032,
00603
00604 FSTAB_ENTRY_NOT_FOUND = -5000,
00605 FSTAB_CHANGE_PREFIX_IMPOSSIBLE = -5001,
00606 FSTAB_REMOVE_ENTRY_NOT_FOUND = -5002,
00607 FSTAB_UPDATE_ENTRY_NOT_FOUND = -5003,
00608 FSTAB_ADD_ENTRY_FOUND = -5004,
00609
00610 MD_CHANGE_READONLY = -6000,
00611 MD_DUPLICATE_NUMBER = -6001,
00612 MD_TOO_FEW_DEVICES = -6002,
00613 MD_DEVICE_UNKNOWN = -6003,
00614 MD_DEVICE_USED = -6004,
00615 MD_CREATE_INVALID_VOLUME = -6005,
00616 MD_REMOVE_FAILED = -6006,
00617 MD_NOT_IN_LIST = -6007,
00618 MD_CREATE_FAILED = -6008,
00619 MD_UNKNOWN_NUMBER = -6009,
00620 MD_REMOVE_USED_BY = -6010,
00621 MD_NUMBER_TOO_LARGE = -6011,
00622 MD_REMOVE_INVALID_VOLUME = -6012,
00623 MD_REMOVE_CREATE_NOT_FOUND = -6013,
00624 MD_NO_RESIZE_ON_DISK = -6014,
00625 MD_ADD_DUPLICATE = -6015,
00626 MD_REMOVE_NONEXISTENT = -6016,
00627 MD_NO_CHANGE_ON_DISK = -6017,
00628 MD_NO_CREATE_UNKNOWN = -6018,
00629 MD_STATE_NOT_ON_DISK = -6019,
00630
00631 LOOP_CHANGE_READONLY = -7000,
00632 LOOP_DUPLICATE_FILE = -7001,
00633 LOOP_UNKNOWN_FILE = -7002,
00634 LOOP_REMOVE_USED_BY = -7003,
00635 LOOP_FILE_CREATE_FAILED = -7004,
00636 LOOP_CREATE_INVALID_VOLUME = -7005,
00637 LOOP_REMOVE_FILE_FAILED = -7006,
00638 LOOP_REMOVE_INVALID_VOLUME = -7007,
00639 LOOP_NOT_IN_LIST = -7008,
00640 LOOP_REMOVE_CREATE_NOT_FOUND = -7009,
00641 LOOP_MODIFY_EXISTING = -7010,
00642
00643 PEC_PE_SIZE_INVALID = -9000,
00644 PEC_PV_NOT_FOUND = -9001,
00645 PEC_REMOVE_PV_IN_USE = -9002,
00646 PEC_REMOVE_PV_SIZE_NEEDED = -9003,
00647 PEC_LV_NO_SPACE_STRIPED = -9004,
00648 PEC_LV_NO_SPACE_SINGLE = -9005,
00649 PEC_LV_PE_DEV_NOT_FOUND = -9006,
00650
00651 DM_CHANGE_READONLY = -10000,
00652 DM_UNKNOWN_TABLE = -10001,
00653 DM_REMOVE_USED_BY = -10002,
00654 DM_REMOVE_CREATE_NOT_FOUND = -10003,
00655 DM_REMOVE_INVALID_VOLUME = -10004,
00656 DM_REMOVE_FAILED = -10005,
00657 DM_NOT_IN_LIST = -10006,
00658
00659 DASD_NOT_POSSIBLE = -11000,
00660 DASD_FDASD_FAILED = -11001,
00661 DASD_DASDFMT_FAILED = -11002,
00662
00663 DMPART_CHANGE_READONLY = -12001,
00664 DMPART_INTERNAL_ERR = -12002,
00665 DMPART_INVALID_VOLUME = -12003,
00666 DMPART_PARTITION_NOT_FOUND = -12004,
00667 DMPART_REMOVE_PARTITION_LIST_ERASE = -12005,
00668 DMPART_COMMIT_NOTHING_TODO = -12006,
00669 DMPART_NO_REMOVE = -12007,
00670
00671 DMRAID_REMOVE_FAILED = -13001,
00672
00673 NFS_VOLUME_NOT_FOUND = -14001,
00674 NFS_CHANGE_READONLY = -14002,
00675 NFS_REMOVE_VOLUME_CREATE_NOT_FOUND = -14003,
00676 NFS_REMOVE_VOLUME_LIST_ERASE = -14004,
00677 NFS_REMOVE_INVALID_VOLUME = -14005,
00678
00679 CONTAINER_INTERNAL_ERROR = -99000,
00680 CONTAINER_INVALID_VIRTUAL_CALL = -99001,
00681
00682 };
00683
00684
00688 class StorageInterface
00689 {
00690 public:
00691
00692 StorageInterface () {}
00693 virtual ~StorageInterface () {}
00694
00698 virtual void getContainers( deque<ContainerInfo>& infos) = 0;
00699
00707 virtual int getDiskInfo( const string& disk, DiskInfo& info) = 0;
00708
00717 virtual int getContDiskInfo( const string& disk, ContainerInfo& cinfo,
00718 DiskInfo& info ) = 0;
00719
00727 virtual int getLvmVgInfo( const string& name, LvmVgInfo& info) = 0;
00728
00737 virtual int getContLvmVgInfo( const string& name, ContainerInfo& cinfo,
00738 LvmVgInfo& info) = 0;
00739
00747 virtual int getDmraidCoInfo( const string& name, DmraidCoInfo& info) = 0;
00748
00757 virtual int getContDmraidCoInfo( const string& name, ContainerInfo& cinfo,
00758 DmraidCoInfo& info) = 0;
00759
00767 virtual int getDmmultipathCoInfo( const string& name, DmmultipathCoInfo& info) = 0;
00768
00777 virtual int getContDmmultipathCoInfo( const string& name, ContainerInfo& cinfo,
00778 DmmultipathCoInfo& info) = 0;
00779
00785 virtual void getVolumes( deque<VolumeInfo>& infos) = 0;
00786
00794 virtual int getVolume( const string& device, VolumeInfo& info) = 0;
00795
00803 virtual int getPartitionInfo( const string& disk,
00804 deque<PartitionInfo>& plist ) = 0;
00805
00813 virtual int getLvmLvInfo( const string& name,
00814 deque<LvmLvInfo>& 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
00865 virtual int getDmmultipathInfo( const string& name,
00866 deque<DmmultipathInfo>& plist ) = 0;
00867
00871 virtual bool getFsCapabilities (FsType fstype, FsCapabilities& fscapabilities) const = 0;
00872
00876 virtual list<string> getAllUsedFs() const = 0;
00877
00885 virtual void printInfo( std::ostream& str ) = 0;
00886
00895 virtual void printInfoCo( std::ostream& str, const string& name ) = 0;
00896
00909 virtual int createPartition( const string& disk, PartitionType type,
00910 unsigned long start,
00911 unsigned long sizeCyl,
00912 string& device ) = 0;
00913
00922 virtual int resizePartition( const string& device,
00923 unsigned long sizeCyl ) = 0;
00924
00933 virtual int resizePartitionNoFs( const string& device,
00934 unsigned long sizeCyl ) = 0;
00935
00946 virtual int updatePartitionArea( const string& device,
00947 unsigned long start,
00948 unsigned long sizeCyl ) = 0;
00949
00957 virtual int freeCylindersAfterPartition(const string& device, unsigned long& freeCyls) = 0;
00958
00968 virtual int nextFreePartition( const string& disk, PartitionType type,
00969 unsigned &nr, string& device ) = 0;
00970
00983 virtual int createPartitionKb( const string& disk, PartitionType type,
00984 unsigned long long start,
00985 unsigned long long size,
00986 string& device ) = 0;
00987
00998 virtual int createPartitionAny( const string& disk,
00999 unsigned long long size,
01000 string& device ) = 0;
01001
01012 virtual int createPartitionMax( const string& disk, PartitionType type,
01013 string& device ) = 0;
01014
01022 virtual unsigned long long cylinderToKb( const string& disk,
01023 unsigned long size ) = 0;
01024
01032 virtual unsigned long kbToCylinder( const string& disk,
01033 unsigned long long size ) = 0;
01034
01041 virtual int removePartition (const string& partition) = 0;
01042
01050 virtual int changePartitionId (const string& partition, unsigned id) = 0;
01051
01058 virtual int forgetChangePartitionId (const string& partition ) = 0;
01059
01070 virtual int getUnusedPartitionSlots(const string& disk, list<PartitionSlotInfo>& slots) = 0;
01071
01080 virtual int destroyPartitionTable (const string& disk, const string& label) = 0;
01081
01092 virtual int initializeDisk( const string& disk, bool value ) = 0;
01093
01100 virtual string defaultDiskLabel() const = 0;
01101
01111 virtual string defaultDiskLabelSize( unsigned long long size_k ) const = 0;
01112
01118 virtual unsigned long long maxSizeLabelK( const string& label ) const = 0;
01119
01128 virtual int changeFormatVolume( const string& device, bool format, FsType fs ) = 0;
01129
01137 virtual int changeLabelVolume( const string& device, const string& label ) = 0;
01138
01146 virtual int changeMkfsOptVolume( const string& device, const string& opts ) = 0;
01147
01155 virtual int changeTunefsOptVolume( const string& device, const string& opts ) = 0;
01156
01165 virtual int changeMountPoint( const string& device, const string& mount ) = 0;
01166
01174 virtual int getMountPoint( const string& device, string& mount ) = 0;
01175
01183 virtual int changeMountBy( const string& device, MountByType mby ) = 0;
01184
01192 #ifndef SWIG
01193 virtual int getMountBy( const string& device, MountByType& mby ) = 0;
01194 #else
01195 virtual int getMountBy( const string& device, MountByType& REFERENCE ) = 0;
01196 #endif
01197
01207 virtual int changeFstabOptions( const string& device, const string& options ) = 0;
01208
01217 virtual int getFstabOptions( const string& device, string& options ) = 0;
01218
01227 virtual int addFstabOptions( const string& device, const string& options ) = 0;
01228
01238 virtual int removeFstabOptions( const string& device, const string& options ) = 0;
01239
01247 virtual int setCryptPassword( const string& device, const string& pwd ) = 0;
01248
01255 virtual int forgetCryptPassword( const string& device ) = 0;
01256
01264 virtual int getCryptPassword( const string& device, string& pwd ) = 0;
01265
01273 virtual int setCrypt( const string& device, bool val ) = 0;
01274
01283 virtual int setCryptType( const string& device, bool val, EncryptType typ ) = 0;
01284
01292 #ifndef SWIG
01293 virtual int getCrypt( const string& device, bool& val ) = 0;
01294 #else
01295 virtual int getCrypt( const string& device, bool& REFERENCE ) = 0;
01296 #endif
01297
01307 virtual int setIgnoreFstab( const string& device, bool val ) = 0;
01308
01316 #ifndef SWIG
01317 virtual int getIgnoreFstab( const string& device, bool& val ) = 0;
01318 #else
01319 virtual int getIgnoreFstab( const string& device, bool& REFERENCE ) = 0;
01320 #endif
01321
01331 virtual int changeDescText( const string& device, const string& txt ) = 0;
01332
01344 virtual int addFstabEntry( const string& device, const string& mount,
01345 const string& vfs, const string& options,
01346 unsigned freq, unsigned passno ) = 0;
01347
01348
01356 virtual int resizeVolume( const string& device, unsigned long long newSizeMb ) = 0;
01357
01365 virtual int resizeVolumeNoFs( const string& device, unsigned long long newSizeMb ) = 0;
01366
01373 virtual int forgetResizeVolume( const string& device ) = 0;
01374
01389 virtual void setRecursiveRemoval( bool val ) = 0;
01390
01396 virtual bool getRecursiveRemoval() const = 0;
01397
01411 virtual void setZeroNewPartitions( bool val ) = 0;
01412
01418 virtual bool getZeroNewPartitions() const = 0;
01419
01425 virtual void setDefaultMountBy( MountByType val ) = 0;
01426
01432 virtual MountByType getDefaultMountBy() const = 0;
01433
01441 virtual void setEfiBoot(bool val) = 0;
01442
01448 virtual bool getEfiBoot() const = 0;
01449
01460 virtual void setRootPrefix( const string& root ) = 0;
01461
01467 virtual string getRootPrefix() const = 0;
01468
01474 virtual void setDetectMountedVolumes( bool val ) = 0;
01475
01481 virtual bool getDetectMountedVolumes() const = 0;
01482
01490 virtual int removeVolume( const string& device ) = 0;
01491
01502 virtual int createLvmVg( const string& name,
01503 unsigned long long peSizeK, bool lvm1,
01504 const deque<string>& devs ) = 0;
01505
01513 virtual int removeLvmVg( const string& name ) = 0;
01514
01522 virtual int extendLvmVg( const string& name,
01523 const deque<string>& devs ) = 0;
01524
01532 virtual int shrinkLvmVg( const string& name,
01533 const deque<string>& devs ) = 0;
01534
01546 virtual int createLvmLv( const string& vg, const string& name,
01547 unsigned long long sizeM, unsigned stripe,
01548 string& device ) = 0;
01549
01556 virtual int removeLvmLvByDevice( const string& device ) = 0;
01557
01565 virtual int removeLvmLv( const string& vg, const string& name ) = 0;
01566
01576 virtual int changeLvStripeCount( const string& vg, const string& name,
01577 unsigned long stripes ) = 0;
01578
01588 virtual int changeLvStripeSize( const string& vg, const string& name,
01589 unsigned long long stripeSize ) = 0;
01590
01601 virtual int createLvmLvSnapshot(const string& vg, const string& origin,
01602 const string& name, unsigned long long cowSizeK,
01603 string& device) = 0;
01604
01612 virtual int removeLvmLvSnapshot(const string& vg, const string& name) = 0;
01613
01624 virtual int getLvmLvSnapshotStateInfo(const string& vg, const string& name,
01625 LvmLvSnapshotStateInfo& info) = 0;
01626
01634 virtual int nextFreeMd(int &nr, string &device) = 0;
01635
01644 virtual int createMd( const string& name, MdType rtype,
01645 const deque<string>& devs ) = 0;
01646
01655 virtual int createMdAny( MdType rtype, const deque<string>& devs,
01656 string& device ) = 0;
01657
01666 virtual int removeMd( const string& name, bool destroySb ) = 0;
01667
01676 virtual int extendMd( const string& name, const string& dev ) = 0;
01677
01686 virtual int shrinkMd( const string& name, const string& dev ) = 0;
01687
01696 virtual int changeMdType( const string& name, MdType rtype ) = 0;
01697
01706 virtual int changeMdChunk( const string& name, unsigned long chunk ) = 0;
01707
01716 virtual int changeMdParity( const string& name, MdParity ptype ) = 0;
01717
01724 virtual int checkMd( const string& name ) = 0;
01725
01735 virtual int getMdStateInfo(const string& name, MdStateInfo& info) = 0;
01736
01748 virtual int computeMdSize(MdType md_type, list<string> devices,
01749 unsigned long long& sizeK) = 0;
01750
01760 virtual int addNfsDevice( const string& nfsDev, const string& opts,
01761 unsigned long long sizeK,
01762 const string& mp ) = 0;
01763
01772 virtual int checkNfsDevice( const string& nfsDev, const string& opts,
01773 unsigned long long& sizeK ) = 0;
01774
01791 virtual int createFileLoop( const string& lname, bool reuseExisting,
01792 unsigned long long sizeK,
01793 const string& mp, const string& pwd,
01794 string& device ) = 0;
01795
01813 virtual int modifyFileLoop( const string& device, const string& lname,
01814 bool reuseExisting,
01815 unsigned long long sizeK ) = 0;
01816
01825 virtual int removeFileLoop( const string& lname, bool removeFile ) = 0;
01826
01833 virtual int removeDmraid( const string& name ) = 0;
01834
01845 virtual deque<string> getCommitActions(bool mark_destructive) const = 0;
01846
01854 virtual void getCommitInfo(bool mark_destructive, CommitInfo& info) const = 0;
01855
01861 virtual const string& getLastAction() const = 0;
01862
01869 virtual const string& getExtendedErrorMessage() const = 0;
01870
01871
01872 #ifndef SWIG
01873
01879 virtual void setCallbackProgressBar( CallbackProgressBar pfnc ) = 0;
01880
01886 virtual CallbackProgressBar getCallbackProgressBar() const = 0;
01887
01888
01894 virtual void setCallbackShowInstallInfo( CallbackShowInstallInfo pfnc ) = 0;
01895
01901 virtual CallbackShowInstallInfo getCallbackShowInstallInfo() const = 0;
01902
01903
01910 virtual void setCallbackInfoPopup( CallbackInfoPopup pfnc ) = 0;
01911
01918 virtual CallbackInfoPopup getCallbackInfoPopup() const = 0;
01919
01920
01927 virtual void setCallbackYesNoPopup( CallbackYesNoPopup pfnc ) = 0;
01928
01935 virtual CallbackYesNoPopup getCallbackYesNoPopup() const = 0;
01936
01937 #endif
01938
01944 virtual void setCacheChanges (bool cache) = 0;
01945
01949 virtual bool isCacheChanges () const = 0;
01950
01955 virtual int commit() = 0;
01956
01963 virtual int createBackupState( const string& name ) = 0;
01964
01971 virtual int restoreBackupState( const string& name ) = 0;
01972
01979 virtual bool checkBackupState( const string& name ) = 0;
01980
01989 virtual bool equalBackupStates( const string& lhs,
01990 const string& rhs,
01991 bool verbose_log ) const = 0;
01992
02000 virtual int removeBackupState( const string& name ) = 0;
02001
02009 virtual bool checkDeviceMounted( const string& device, string& mp ) = 0;
02010
02019 virtual bool umountDevice( const string& device ) = 0;
02020
02030 virtual bool mountDevice( const string& device, const string& mp ) = 0;
02031
02042 virtual bool mountDeviceOpts( const string& device, const string& mp,
02043 const string& opts ) = 0;
02044
02055 virtual bool mountDeviceRo( const string& device, const string& mp,
02056 const string& opts ) = 0;
02057
02064 virtual bool checkDmMapsTo( const string& device ) = 0;
02065
02071 virtual void removeDmTableTo( const string& device ) = 0;
02072
02084 virtual bool getFreeInfo( const string& device,
02085 unsigned long long& resize_free,
02086 unsigned long long& df_free,
02087 unsigned long long& used,
02088 bool& win, bool& efi, bool use_cache ) = 0;
02089
02097 virtual bool readFstab( const string& dir, deque<VolumeInfo>& infos) = 0;
02098
02107 virtual void activateHld( bool val ) = 0;
02108
02115 virtual void activateMultipath( bool val ) = 0;
02116
02125 virtual void rescanEverything() = 0;
02126
02130 virtual void dumpObjectList() = 0;
02131
02141 virtual int getContVolInfo( const string& dev, ContVolInfo& info) = 0;
02142
02153 virtual string byteToHumanString(unsigned long long size, bool classic, int precision,
02154 bool omit_zeroes) const = 0;
02155
02167 virtual bool humanStringToByte(const string& str, bool classic, unsigned long long&
02168 size) const = 0;
02169 };
02170
02171
02175 void initDefaultLogger ();
02176
02177
02183 StorageInterface* createDefaultStorageInterface ();
02184
02185
02191 StorageInterface* createStorageInterface (bool readonly, bool testmode,
02192 bool autodetect);
02193
02194
02202 StorageInterface* createStorageInterfacePid (bool readonly, bool testmode,
02203 bool autodetect, int& locker_pid);
02204
02205
02209 void destroyStorageInterface (StorageInterface*);
02210
02211 }
02212
02213
02214 #endif