Esempio n. 1
0
    def get_disk_from_container(cid):
        disk_ids_used = JBoxHostDiskVol._get_disk_ids_used(cid)
        if len(disk_ids_used) == 0:
            return None

        disk_id_used = disk_ids_used[0]
        disk_path = os.path.join(JBoxHostDiskVol.FS_LOC, disk_id_used)
        container_name = JBoxVol.get_cname(cid)
        sessname = container_name[1:]
        return JBoxHostDiskVol(disk_path, sessname=sessname)
Esempio n. 2
0
 def get_disk_from_container(cid):
     container_name = JBoxVol.get_cname(cid)
     sessname = container_name[1:]
     for dev, vol in JBoxEBSVol.get_mapped_volumes().iteritems():
         vol = EBSVol.get_volume(vol.volume_id)
         if 'Name' in vol.tags:
             name = vol.tags['Name']
             if unique_sessname(name) == sessname:
                 return JBoxEBSVol(dev, sessname=sessname)
     return None
Esempio n. 3
0
 def get_disk_from_container(cid):
     container_name = JBoxVol.get_cname(cid)
     sessname = container_name[1:]
     for dev, vol in JBoxEBSVol.get_mapped_volumes().iteritems():
         vol = EBSVol.get_volume(vol.volume_id)
         if 'Name' in vol.tags:
             name = vol.tags['Name']
             if unique_sessname(name) == sessname:
                 return JBoxEBSVol(dev, sessname=sessname)
     return None
Esempio n. 4
0
    def get_disk_from_container(cid):
        disk_ids_used = JBoxLoopbackVol._get_disk_ids_used(cid)
        if len(disk_ids_used) == 0:
            return None

        disk_id_used = disk_ids_used[0]
        disk_path = os.path.join(JBoxLoopbackVol.FS_LOC, str(disk_id_used))
        container_name = JBoxVol.get_cname(cid)
        sessname = container_name[1:]
        return JBoxLoopbackVol(disk_path, sessname=sessname)
Esempio n. 5
0
    def get_disk_from_container(cid):
        mounts_used = JBoxPolsarDiskVol._get_disk_ids_used(cid)
        if len(mounts_used) == 0:
            return None

        mount_used = mounts_used[0]
        disk_path = os.path.join(JBoxPolsarDiskVol.FS_LOC, str(mount_used))
        container_name = JBoxVol.get_cname(cid)
        sessname = container_name[1:]
        return JBoxPolsarDiskVol(disk_path, sessname=sessname)
Esempio n. 6
0
    def get_disk_from_container(cid):
        mounts_used = JBoxDefaultPackagesVol._get_package_mounts_used(cid)
        if len(mounts_used) == 0:
            return None

        mount_used = mounts_used[0]
        disk_path = os.path.join(JBoxDefaultPackagesVol.FS_LOC, str(mount_used))
        container_name = JBoxVol.get_cname(cid)
        sessname = container_name[1:]
        return JBoxDefaultPackagesVol(disk_path, sessname=sessname)
Esempio n. 7
0
 def _get_disk_ids_used(cid):
     used = []
     try:
         props = JBoxHostDiskVol.dckr().inspect_container(cid)
         for _cpath, hpath in JBoxVol.extract_mounts(props):
             if hpath.startswith(JBoxHostDiskVol.FS_LOC):
                 used.append(hpath.split('/')[-1])
     except:
         JBoxHostDiskVol.log_exception("error finding disk ids used in " + cid)
         return []
     return used
Esempio n. 8
0
 def _get_disk_ids_used(cid):
     used = []
     try:
         props = JBoxLoopbackVol.dckr().inspect_container(cid)
         for _cpath, hpath in JBoxVol.extract_mounts(props):
             if hpath.startswith(JBoxLoopbackVol.FS_LOC):
                 used.append(int(hpath.split('/')[-1]))
     except:
         JBoxLoopbackVol.log_error("error finding disk ids used in " + cid)
         return []
     return used
Esempio n. 9
0
 def _get_disk_ids_used(cid):
     used = []
     props = JBoxPolsarDiskVol.dckr().inspect_container(cid)
     try:
         for _cpath, hpath in JBoxVol.extract_mounts(props):
             if hpath.startswith(JBoxPolsarDiskVol.FS_LOC):
                 used.append(hpath.split("/")[-1])
     except:
         JBoxPolsarDiskVol.log_error("error finding polsar disk ids used in " + cid)
         return []
     return used
Esempio n. 10
0
 def _get_package_mounts_used(cid):
     used = []
     props = JBoxDefaultPackagesVol.dckr().inspect_container(cid)
     try:
         for _cpath, hpath in JBoxVol.extract_mounts(props):
             if hpath.startswith(JBoxDefaultPackagesVol.FS_LOC):
                 used.append(hpath.split('/')[-1])
     except:
         JBoxDefaultPackagesVol.log_error("error finding package mount points used in " + cid)
         return []
     return used
Esempio n. 11
0
    user_conf_file = os.path.join('/jboxengine/conf', 'jbox.user')

    JBoxCfg.read(conf_file, user_conf_file)
    JBoxCfg.dckr = docker.Client()

    LoggerMixin.configure()
    db.configure()
    SessContainer.configure()
    VolMgr.configure()

    plugin = JBPluginCloud.jbox_get_plugin(JBPluginCloud.JBP_BUCKETSTORE)
    if plugin is None:
        VolMgr.log_error("No plugin found for bucketstore")
        exit(1)

    ts = JBoxVol._get_user_home_timestamp()
    tsstr = ts.strftime("%Y%m%d_%H%M")
    VolMgr.log_debug("user_home_timestamp: %s", tsstr)

    imgf, pkgf = copy_for_upload(tsstr)
    copy_for_boot()

    bucket = 'juliabox-user-home-templates'

    VolMgr.log_debug("pushing new image files to bucketstore at: %s", bucket)
    plugin.push(bucket, imgf)
    plugin.push(bucket, pkgf)

    # JuliaBoxTest JuliaBox
    clusters = sys.argv[1] if (len(sys.argv) > 1) else ['JuliaBoxTest']