feat: display VDI size

This commit is contained in:
Julien Fontanet
2017-05-11 15:27:06 +02:00
parent 725b0342d1
commit 019d6f4cb6
3 changed files with 12 additions and 1 deletions

View File

@@ -38,6 +38,7 @@
"babel-runtime": "^6.23.0",
"chalk": "^1.1.3",
"exec-promise": "^0.7.0",
"human-format": "^0.8.0",
"lodash": "^4.17.4",
"pw": "^0.0.4",
"xen-api": "^0.10.0"

View File

@@ -3,6 +3,7 @@
import archy from 'archy'
import chalk from 'chalk'
import execPromise from 'exec-promise'
import humanFormat from 'human-format'
import pw from 'pw'
import { createClient } from 'xen-api'
import { forEach, map, orderBy } from 'lodash'
@@ -14,6 +15,11 @@ const askPassword = prompt => new Promise(resolve => {
pw(resolve)
})
const formatSize = bytes => humanFormat(bytes, {
prefix: 'Gi',
scale: 'binary'
})
const required = name => {
const e = `missing required argument <${name}>`
throw e
@@ -98,7 +104,7 @@ execPromise(async args => {
const makeVdiNode = vdi => {
const { uuid } = vdi
let label = `${vdi.name_label} - ${uuid}`
let label = `${vdi.name_label} - ${uuid} - ${formatSize(vdi.physical_utilisation)}`
const nodes = []
const vhdChildren = vhdChildrenByUuid[uuid]

View File

@@ -1806,6 +1806,10 @@ http-signature@~1.1.0:
jsprim "^1.2.2"
sshpk "^1.7.0"
human-format@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/human-format/-/human-format-0.8.0.tgz#6146370a838fd52718d1e27f16f1916b43a06e92"
husky@^0.13.3:
version "0.13.3"
resolved "https://registry.yarnpkg.com/husky/-/husky-0.13.3.tgz#bc2066080badc8b8fe3516e881f5bc68a57052ff"