def resizeFsImage(img, partid, size): from sh import guestfish logger = logging.getLogger('virtimg') str = """add %s run resize2fs-size /dev/sda%s %dK """ % (img.path, partid, size) for line in guestfish(_in=str, _iter=True): logger.debug('%s: guestfish resize2fs-size: %s', line)
def checkPartition(img, partid): from sh import guestfish logger = logging.getLogger('virtimg') str = """add %s run e2fsck-f /dev/sda%s """ % (img.path, partid) for line in guestfish(_in=str, _iter=True): logger.debug('%s: guestfish e2fsck-f: %s', img.name, line)
def _fish(self, *args): return sh.guestfish("--network", "-vx", "-d", self.name, *args)