Skip to content

Commit

Permalink
fix: remove invalid temp data from storage calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
MauriceNino committed Jul 7, 2022
1 parent 5a3b3a0 commit 45a2e74
Showing 1 changed file with 3 additions and 323 deletions.
326 changes: 3 additions & 323 deletions apps/api/src/dynamic-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,332 +100,12 @@ export const getDynamicServerInfo = () => {
1,
CONFIG.storage_poll_interval,
async (): Promise<StorageLoad> => {
const [
layout,
// blocks, sizes
] = await Promise.all([
const [layout, blocks, sizes] = await Promise.all([
getStaticServerInfo(),
// si.blockDevices(),
// si.fsSize(),
si.blockDevices(),
si.fsSize(),
]);

const sizes = [
{
fs: 'overlay',
type: 'overlay',
size: 489289572352,
used: 211411542016,
available: 257381662720,
use: 45.1,
mount: '/',
},
{
fs: '/dev/mapper/ubuntu--vg-ubuntu--lv',
type: 'ext4',
size: 489289572352,
used: 211411542016,
available: 257381662720,
use: 45.1,
mount: '/mnt/host',
},
{
fs: '/dev/sdb2',
type: 'ext4',
size: 1551745024,
used: 220078080,
available: 1234362368,
use: 15.13,
mount: '/mnt/host/boot',
},
{
fs: '/dev/sdb1',
type: 'vfat',
size: 1124999168,
used: 5484544,
available: 1119514624,
use: 0.49,
mount: '/mnt/host/boot/efi',
},
{
fs: '/dev/loop0',
type: 'squashfs',
size: 65011712,
used: 65011712,
available: 0,
use: 100,
mount: '/mnt/host/snap/core20/1494',
},
{
fs: '/dev/loop1',
type: 'squashfs',
size: 65011712,
used: 65011712,
available: 0,
use: 100,
mount: '/mnt/host/snap/core20/1518',
},
{
fs: '/dev/loop2',
type: 'squashfs',
size: 70516736,
used: 70516736,
available: 0,
use: 100,
mount: '/mnt/host/snap/lxd/21835',
},
{
fs: '/dev/loop4',
type: 'squashfs',
size: 71172096,
used: 71172096,
available: 0,
use: 100,
mount: '/mnt/host/snap/lxd/22753',
},
{
fs: '/dev/loop5',
type: 'squashfs',
size: 49283072,
used: 49283072,
available: 0,
use: 100,
mount: '/mnt/host/snap/snapd/16010',
},
{
fs: '/dev/sda1',
type: 'xfs',
size: 1999421038592,
used: 76902424576,
available: 1922518614016,
use: 3.85,
mount: '/mnt/host/data',
},
{
fs: 'Local:mount',
type: 'fuse.mergerfs',
size: 1168033936314368,
used: 41856151441408,
available: 1126157288505344,
use: 3.58,
mount: '/mnt/host/gmedia',
},
{
fs: 'gcrypt:',
type: 'fuse.rclone',
size: 1167544646742016,
used: 41644739899392,
available: 1125899906842624,
use: 3.57,
mount: '/mnt/host/mnt/GDmount',
},
{
fs: '/dev/loop6',
type: 'squashfs',
size: 49283072,
used: 49283072,
available: 0,
use: 100,
mount: '/mnt/host/snap/snapd/16292',
},
];
const blocks = [
{
name: 'sda',
type: 'disk',
fsType: '',
mount: '',
size: 2000398934016,
physical: 'HDD',
uuid: '',
label: '',
model: 'WDC WD20EARS-00J',
serial: '',
removable: false,
protocol: 'sata',
group: undefined,
},
{
name: 'sdb',
type: 'disk',
fsType: '',
mount: '',
size: 500107862016,
physical: 'SSD',
uuid: '',
label: '',
model: 'CT500MX500SSD1 ',
serial: '',
removable: false,
protocol: 'sata',
group: undefined,
},
{
name: 'loop0',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/core20/1494',
size: 64925696,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'loop1',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/core20/1518',
size: 64933888,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'loop2',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/lxd/21835',
size: 70508544,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'loop4',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/lxd/22753',
size: 71106560,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'loop5',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/snapd/16010',
size: 49233920,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'loop6',
type: 'loop',
fsType: 'squashfs',
mount: '/mnt/host/snap/snapd/16292',
size: 49242112,
physical: '',
uuid: '',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'sda1',
type: 'part',
fsType: 'xfs',
mount: '/mnt/host/data',
size: 2000397795328,
physical: '',
uuid: '80113b64-3c84-4f12-b998-85f7075d1ff8',
label: 'Data',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'sdb1',
type: 'part',
fsType: 'vfat',
mount: '/mnt/host/boot/efi',
size: 1127219200,
physical: '',
uuid: '0A87-BDCA',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'sdb2',
type: 'part',
fsType: 'ext4',
mount: '/mnt/host/boot',
size: 1610612736,
physical: '',
uuid: '803cb74d-55b5-4723-9c13-336f560ac573',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'sdb3',
type: 'part',
fsType: 'LVM2_member',
mount: '',
size: 497368964608,
physical: '',
uuid: 'yhdXqH-9zLI-MXik-HkGv-1OZq-wOCy-GlbnJ2',
label: '',
model: '',
serial: '',
removable: false,
protocol: '',
group: undefined,
},
{
name: 'sr0',
type: 'rom',
fsType: '',
mount: '',
size: 1073741312,
physical: 'CD/DVD',
uuid: '',
label: '',
model: 'DVDRAM GHC0N ',
serial: '',
removable: true,
protocol: 'sata',
group: undefined,
},
];

const storageLayout = layout.storage.layout;
const validMounts = sizes.filter(
({ mount, type }) =>
Expand Down

0 comments on commit 45a2e74

Please sign in to comment.