Esempio n. 1
0
    def update(self):
        if (self.updateable == False):
            return

        idx = 0
        total = len(self.dict.items())
        for (k, v) in self.dict.items():
            idx += 1
            self.dict[k] = v + str(uuid.uuid1())

        for (k, v) in self.dict.items():
            cmd_update = self.cmd_update(k, v)

            retry = 0
            while (1):
                dmsg(cmd_update + '[%d/%d]' % (idx, total) + " retry %d" %
                     (retry))
                try:
                    docker_exec(cmd_update)
                except Exp, e:
                    if (e.errno == errno.EIO or retry > 300):
                        raise

                    time.sleep(1)
                    retry = retry + 1
                    continue
                break
Esempio n. 2
0
    def create(self):
        idx = 0
        total = len(self.dict.items())
        for (k, v) in self.dict.items():
            idx += 1
            cmd_create = self.cmd_create(k, v)
            cmd_remove = self.cmd_remove(k, v)

            retry = 0
            while (1):
                dmsg(cmd_create + '[%d/%d]' % (idx, total) + " retry %d" %
                     (retry))
                try:
                    docker_exec(cmd_create)
                except Exp, e:
                    if (e.errno == errno.EIO or retry > 300):
                        raise

                    if (e.errno == errno.EEXIST):
                        if (retry == 0):
                            raise Exp(errno.EEXIST, "create fail, exist")
                        else:
                            try:
                                docker_exec(cmd_remove)
                            except Exp, e:
                                pass

                    time.sleep(1)
                    retry = retry + 1
                    continue
                break
Esempio n. 3
0
def test_mkdir(target, ec=None):
    if ec:
        cmd = "%s /%s%s -e %s" % ("sdfs mkdir", TEST_POOL, target, ec)
    else:
        cmd = "%s /%s%s" % ("sdfs mkdir", TEST_POOL, target)

    docker_exec(cmd)
    return "/%s%s" % (TEST_POOL, target)
Esempio n. 4
0
    def check(self):
        idx = 0
        total = len(self.dict.items())
        for (k, v) in self.dict.items():
            idx += 1
            cmd_check = self.cmd_check(k, v)

            retry = 0
            while (1):
                dmsg(cmd_check + ' [%d/%d]' % (idx, total) + " retry %d" %
                     (retry))
                try:
                    docker_exec(cmd_check)
                except Exp, e:
                    if (e.errno == errno.EIO or retry > 300):
                        raise

                    time.sleep(1)
                    retry = retry + 1
                    continue
                break
Esempio n. 5
0
def test_touch(target):
    cmd = "%s /%s%s" % (config.uss_touch, TEST_POOL, target)
    cmd = "%s -s 1G /%s%s" % (config.uss_truncate, TEST_POOL, target)

    docker_exec(cmd)
    return "/%s%s" % (TEST_POOL, target)