Revision 16 hci/trunk/eneraptor-web-app/grails-app/controllers/com/eneraptor/hci/ConfigController.groovy
ConfigController.groovy | ||
---|---|---|
11 | 11 |
|
12 | 12 |
def hci = { |
13 | 13 |
|
14 |
/* |
|
15 |
* DISK USAGE - ONLY IF ENERAPTOR HCI IS SUPERUSER |
|
16 |
*/ |
|
17 |
def totalSpace = 0 |
|
18 |
def freeSpace = 0 |
|
19 |
def percent = 0 |
|
20 |
/* |
|
14 | 21 |
def db_sql = new Sql(dataSource) |
15 | 22 |
|
16 | 23 |
def single = db_sql.firstRow("show data_directory") |
17 | 24 |
def loca = single.data_directory |
18 | 25 |
def partition = new File(loca) |
19 |
def totalSpace = partition.getTotalSpace()
|
|
20 |
def freeSpace = partition.getFreeSpace()
|
|
26 |
totalSpace = partition.getTotalSpace() |
|
27 |
freeSpace = partition.getFreeSpace() |
|
21 | 28 |
|
22 | 29 |
totalSpace = (int)((totalSpace/1024)/1024) |
23 | 30 |
freeSpace = (int)((freeSpace/1024)/1024) |
24 | 31 |
|
25 |
def percent = 100 - ((int) ((freeSpace/totalSpace)*100))
|
|
32 |
percent = 100 - ((int) ((freeSpace/totalSpace)*100)) |
|
26 | 33 |
|
34 |
*/ |
|
35 |
|
|
27 | 36 |
def allDevices = DeviceInfo.list() |
28 | 37 |
[conf: InternalConfig, devices: allDevices, totalSpace: totalSpace, freeSpace: freeSpace, percent: percent] |
29 | 38 |
} |
Also available in: Unified diff