Example #1
0
def mount(uuid):
    disk = Disk(uuid=uuid)
    if disk.mount():
        msg = gettext("Mounting %(device)s", device=disk.dev)
    else:
        msg = gettext("Can't mount %(device)s", device=disk.dev)
    flash(msg)
    return redirect(url_for('.index'))
Example #2
0
def mount(uuid):
    disk = Disk(uuid=uuid)
    if disk.mount():
        msg = gettext("Mounting %(device)s", device = disk.dev)
    else:
        msg = gettext("Can't mount %(device)s", device = disk.dev)
    flash(msg)
    return redirect(url_for('.index'))
Example #3
0
def unmount(uuid):
    disk = Disk(uuid=uuid)
    if disk.is_mounted:
        msg = gettext("Unmounting %(device)s", device=disk.dev)
        disk.unmount()
    else:
        msg = gettext("Disk not mounted")
    flash(msg)
    return redirect(url_for('.index'))
Example #4
0
def unmount(uuid):
    disk = Disk(uuid=uuid)
    if disk.is_mounted:
        msg = gettext("Unmounting %(device)s", device = disk.dev)
        disk.unmount()
    else:
        msg = gettext("Disk not mounted")
    flash(msg)
    return redirect(url_for('.index'))
Example #5
0
def index():
    disks = []
    regexp = re.compile("^/dev/sd.[1-9]")
    for md in psutil.disk_partitions(all=False):
        if re.match(regexp, md.device):
            disk = Disk(partition=md)
            disk.get_usage()
            disks.append(disk)

    devices = glob.glob("/dev/sd*[0-9]")
    mounted_devices = [disk.dev for disk in disks]
    for dev in devices:
        if not dev in mounted_devices:
            disk = Disk(dev=dev)
            if disk.is_mountable():
                disks.append(disk)

    return render_template('disks/disks.html', disks=disks)
Example #6
0
def index():
    disks = []
    regexp = re.compile("^/dev/sd.[1-9]")
    for md in psutil.disk_partitions(all=False):
        if re.match(regexp, md.device):
            disk = Disk(partition=md)
            disk.get_usage()
            disks.append(disk)

    devices = glob.glob("/dev/sd*[0-9]")
    mounted_devices = [disk.dev for disk in disks]
    for dev in devices:
        if not dev in mounted_devices:
            disk = Disk(dev=dev)
            if disk.is_mountable():
                disks.append(disk)

    return render_template('disks/disks.html', disks=disks)