mdinfos = storage.dequemdinfo() c.getMdInfo(mdinfos) for mdinfo in mdinfos: print " Device:", mdinfo.v.device print " Size:", storage.byteToHumanString(1024 * mdinfo.v.sizeK, True, 2, False) print " Chunk Size:", storage.byteToHumanString(1024 * mdinfo.chunkSizeK, True, 2, True) if container.type == storage.LVM: lvmvginfo = storage.LvmVgInfo() c.getLvmVgInfo(container.name, lvmvginfo) print " Size:", storage.byteToHumanString(1024 * lvmvginfo.sizeK, True, 2, False) print " PE Size:", storage.byteToHumanString(1024 * lvmvginfo.peSizeK, True, 2, True) lvmlvinfos = storage.DequeLvmLvInfo() c.getLvmLvInfo(container.name, lvmlvinfos) for lvmlvinfo in lvmlvinfos: print " Device:", lvmlvinfo.v.device print " Size:", storage.byteToHumanString(1024 * lvmlvinfo.v.sizeK, True, 2, False) print " Stripes:", lvmlvinfo.stripes if lvmlvinfo.stripes > 1: print " Stripe Size:", storage.byteToHumanString(1024 * lvmlvinfo.stripeSizeK, True, 2, True) print storage.destroyStorageInterface(c)
#!/usr/bin/python import storage storage.initDefaultLogger() env = storage.Environment(True) storageInterface = storage.createStorageInterface(env) rootdev = "/dev/system/root" swapdev = "/dev/system/swap" bootdev = "/dev/sda1" nodev = "/dev/system/xyz123" disk = "/dev/sdb" print storageInterface.getIgnoreFstab(rootdev) print storageInterface.getCrypt(rootdev) print storageInterface.getMountPoint(rootdev) print storageInterface.getMountPoint(swapdev) print storageInterface.getMountPoint("/dev/system/space") print storageInterface.getMountPoint(nodev) print storageInterface.nextFreePartition(disk, storage.PRIMARY) print storageInterface.nextFreeMd() print "MOUNTBY DEVICE:", storage.MOUNTBY_DEVICE, " UUID:", storage.MOUNTBY_UUID, " LABEL:", storage.MOUNTBY_LABEL, " ID:", storage.MOUNTBY_ID, " PATH:", storage.MOUNTBY_PATH print storageInterface.getMountBy(rootdev) print storageInterface.getMountBy(bootdev) print storageInterface.getDefaultMountBy() storage.destroyStorageInterface(storageInterface)
print " Device:", mdinfo.v.device print " Size:", storage.byteToHumanString( 1024 * mdinfo.v.sizeK, True, 2, False) print " Chunk Size:", storage.byteToHumanString( 1024 * mdinfo.chunkSizeK, True, 2, True) if container.type == storage.LVM: lvmvginfo = storage.LvmVgInfo() c.getLvmVgInfo(container.name, lvmvginfo) print " Size:", storage.byteToHumanString(1024 * lvmvginfo.sizeK, True, 2, False) print " PE Size:", storage.byteToHumanString(1024 * lvmvginfo.peSizeK, True, 2, True) lvmlvinfos = storage.DequeLvmLvInfo() c.getLvmLvInfo(container.name, lvmlvinfos) for lvmlvinfo in lvmlvinfos: print " Device:", lvmlvinfo.v.device print " Size:", storage.byteToHumanString( 1024 * lvmlvinfo.v.sizeK, True, 2, False) print " Stripes:", lvmlvinfo.stripes if lvmlvinfo.stripes > 1: print " Stripe Size:", storage.byteToHumanString( 1024 * lvmlvinfo.stripeSizeK, True, 2, True) print storage.destroyStorageInterface(c)
#!/usr/bin/python from storage import Environment, createStorageInterface, saveDeviceGraph, saveMountGraph, destroyStorageInterface env = Environment(True) c = createStorageInterface(env) saveDeviceGraph(c, "device.gv") saveMountGraph(c, "mount.gv") destroyStorageInterface(c)