Ejemplo n.º 1
0
def _start(name):
    _log('start, name=%s' % name)
    path = _get_path_run(name)
    kill_by_file(KLNK_NAME, path)

    binding = get_binding(name)
    umount(binding)
    mkdirs(binding)

    mountpoint = get_mountpoint(name)
    umount(mountpoint)
    mkdirs(mountpoint)

    cmd = [_get_path_cmd(), name2addr(name), mountpoint]
    # _log(' '.join(cmd))
    pid = popen(cmd)
    if not chkpid(pid):
        raise Exception("failed to start ipc")
    path = _get_path_run(name)
    save_pid(path, pid)
    path = os.path.join(mountpoint, 'test')
    if not _touch(path):
        raise Exception('failed to start ipc')
    bind(mountpoint, binding)
    path = os.path.join(binding, 'test')
    if not _touch(path):
        raise Exception('failed to start ipc')
Ejemplo n.º 2
0
def _start(name):
    _log('start, name=%s' % name)
    path = _get_path_run(name)
    kill_by_file(KLNK_NAME, path)

    binding = get_binding(name)
    umount(binding)
    mkdirs(binding)

    mountpoint = get_mountpoint(name)
    umount(mountpoint)
    mkdirs(mountpoint)

    cmd = [_get_path_cmd(), name2addr(name), mountpoint]
    # _log(' '.join(cmd))
    pid = popen(cmd)
    if not chkpid(pid):
        raise Exception("failed to start ipc")
    path = _get_path_run(name)
    save_pid(path, pid)
    path = os.path.join(mountpoint, 'test')
    if not _touch(path):
        raise Exception('failed to start ipc')
    bind(mountpoint, binding)
    path = os.path.join(binding, 'test')
    if not _touch(path):
        raise Exception('failed to start ipc')
Ejemplo n.º 3
0
def _check_path(name):
    mkdirs(PATH_RUN)
    os.system('rm -f %s' %
              os.path.join(PATH_RUN, '%s.%s.pid' % (container.LXC_NAME, name)))
    os.system('rm -f %s' % os.path.join(PATH_RUN, '%s.%s.pid' %
                                        (ipc.KLNK_NAME, name)))
    os.system('rm -f %s' % os.path.join(PATH_RUN, '%s.%s.pid' %
                                        (fs.LBFS_NAME, name)))
    os.system('rm -f %s' % os.path.join(PATH_RUN, '%s.%s.pid' %
                                        (ckpt.VMAP_NAME, name)))
    mkdirs(PATH_MNT)
    mkdirs(os.path.join(PATH_MNT, fs.get_name()))
    mkdirs(os.path.join(PATH_MNT, ipc.get_name()))
    mkdirs(os.path.join(PATH_MNT, ckpt.get_name()))
    mkdirs(PATH_BIN)
    mkdirs(PATH_VAR)
    dirname = fs.get_log_path()
    mkdirs(dirname)
    os.system('rm -f %s' %
              os.path.join(dirname, '%s.%s.log' % (container.LXC_NAME, name)))
    os.system('rm -f %s' % os.path.join(dirname, '%s.%s.log' %
                                        (ipc.KLNK_NAME, name)))
    os.system('rm -f %s' % os.path.join(dirname, '%s.%s.log' %
                                        (fs.LBFS_NAME, name)))
    mkdirs(fs.get_conf_path())
    dirname = fs.get_path(name)
    umount(dirname)
    mkdirs(dirname)
Ejemplo n.º 4
0
def _release(name):
    path = _get_path_run(name)
    kill_by_file(path)

    binding = get_binding(name)
    umount(binding)

    mountpoint = get_mountpoint(name)
    umount(mountpoint)
    rmdir(mountpoint)
Ejemplo n.º 5
0
def _release(name):
    path = _get_path_run(name)
    kill_by_file(path)

    binding = get_binding(name)
    umount(binding)

    mountpoint = get_mountpoint(name)
    umount(mountpoint)
    rmdir(mountpoint)
Ejemplo n.º 6
0
def start(name):
    path = get_path(name)
    _log('start, mnt=%s' % path)
    mkdirs(path)
    umount(path)
    ftp.mount(path, name2addr(name), FS_PORT)
    path = _get_bin(name)
    if not os.path.exists(path):
        log('failed to start (name=%s)' % name)
        raise Exception('Error: failed to start (name=%s)' % name)
    if LBFS:
        _start_lbfs(name)
Ejemplo n.º 7
0
def _start_lbfs(name, create=False):
    mnt = _get_lbfs_mnt(name)
    path = _get_path_run(name)
    home = _get_path_home(name)
    _log('start lbfs, name=%s, home=%s, mnt=%s' % (name, home, mnt))
    kill_by_file(LBFS_NAME, path)
    umount(mnt)
    mkdirs(mnt)
    if create:
        mkdirs(home)
    cmd = [_get_path_cmd(), name, home, mnt]
    # _log(' '.join(cmd))
    pid = popen(cmd)
    if not chkpid(pid):
        log('failed to start lbfs (name=%s)' % name)
        raise Exception('failed to start lbfs')
    save_pid(path, pid)
Ejemplo n.º 8
0
def _start(name, create=False):
    path = _get_path_run(name)
    kill_by_file(VMAP_NAME, path)
    vmap = os.path.join(PATH_INIT, VMAP_NAME)
    home = _get_path_home(name)
    if create:
        mkdirs(home)
    mountpoint = get_mountpoint(name)
    _log('start, home=%s, mnt=%s' % (home, mountpoint))
    umount(mountpoint)
    mkdirs(mountpoint)
    cmd = [vmap, home, mountpoint]
    pid = popen(cmd)
    if not chkpid(pid):
        log('failed to start ckpt')
        raise Exception('failed to start ckpt')
    path = _get_path_run(name)
    save_pid(path, pid)
Ejemplo n.º 9
0
def _start(name, create=False):
    path = _get_path_run(name)
    kill_by_file(VMAP_NAME, path)
    vmap = os.path.join(PATH_INIT, VMAP_NAME)
    home = _get_path_home(name)
    if create:
        mkdirs(home)
    mountpoint = get_mountpoint(name)
    _log('start, home=%s, mnt=%s' % (home, mountpoint))
    umount(mountpoint)
    mkdirs(mountpoint)
    cmd = [vmap, home, mountpoint]
    pid = popen(cmd)
    if not chkpid(pid):
        log('failed to start ckpt')
        raise Exception('failed to start ckpt')
    path = _get_path_run(name)
    save_pid(path, pid)
Ejemplo n.º 10
0
def _check_path(name):
    mkdirs(PATH_RUN)
    os.system('rm -f %s' % os.path.join(PATH_RUN, '%s.%s.pid' % (container.LXC_NAME, name)))
    os.system('rm -f %s' % os.path.join(PATH_RUN, '%s.%s.pid' % (ipc.KLNK_NAME, name)))
    os.system('rm -f %s' % os.path.join(PATH_RUN, '%s.%s.pid' % (fs.LBFS_NAME, name)))
    os.system('rm -f %s' % os.path.join(PATH_RUN, '%s.%s.pid' % (ckpt.VMAP_NAME, name)))
    mkdirs(PATH_MNT)
    mkdirs(os.path.join(PATH_MNT, fs.get_name()))
    mkdirs(os.path.join(PATH_MNT, ipc.get_name()))
    mkdirs(os.path.join(PATH_MNT, ckpt.get_name()))
    mkdirs(PATH_BIN)
    mkdirs(PATH_VAR)
    dirname = fs.get_log_path()
    mkdirs(dirname)
    os.system('rm -f %s' % os.path.join(dirname, '%s.%s.log' % (container.LXC_NAME, name)))
    os.system('rm -f %s' % os.path.join(dirname, '%s.%s.log' % (ipc.KLNK_NAME, name)))
    os.system('rm -f %s' % os.path.join(dirname, '%s.%s.log' % (fs.LBFS_NAME, name)))
    mkdirs(fs.get_conf_path())
    dirname = fs.get_path(name)
    umount(dirname)
    mkdirs(dirname)
Ejemplo n.º 11
0
def _release(name):
    umount(get_binding(name))
    umount(get_path(name))
Ejemplo n.º 12
0
def _release(name):
    path = _get_path_run(name)
    kill_by_file(VMAP_NAME, path)
    path = get_mountpoint(name)
    umount(path)
    rmdir(path)
Ejemplo n.º 13
0
def _release(name):
    path = _get_path_run(name)
    kill_by_file(VMAP_NAME, path)
    path = get_mountpoint(name)
    umount(path)
    rmdir(path)