summaryrefslogtreecommitdiffstats
path: root/lvm2-model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lvm2-model.lua')
-rw-r--r--lvm2-model.lua43
1 files changed, 43 insertions, 0 deletions
diff --git a/lvm2-model.lua b/lvm2-model.lua
new file mode 100644
index 0000000..2841035
--- /dev/null
+++ b/lvm2-model.lua
@@ -0,0 +1,43 @@
+module(..., package.seeall)
+
+-- Load libraries
+require("modelfunctions")
+require("fs")
+require("format")
+
+-- Set variables
+local processname = "lvm"
+local packagename = "lvm2"
+
+local path = "PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin "
+
+-- ################################################################################
+-- LOCAL FUNCTIONS
+
+-- ################################################################################
+-- PUBLIC FUNCTIONS
+
+function startstop_service(action)
+ return modelfunctions.startstop_service(processname, action)
+end
+
+function getstatus()
+ return modelfunctions.getstatus(processname, packagename, "LVM Status")
+end
+
+function getstatusdetails()
+ local status = {}
+ status.pvdisplay = cfe({ type="longtext", label="Physical Volumes" })
+ local cmd = path .. "pvdisplay"
+ local f = io.popen(cmd)
+ status.pvdisplay.value = f:read("*a") or ""
+ f:close()
+
+ status.lvdisplay = cfe({ type="longtext", label="Logival Volumes" })
+ cmd = path .. "lvdisplay"
+ f = io.popen(cmd)
+ status.lvdisplay.value = f:read("*a") or ""
+ f:close()
+
+ return cfe({ type="group", value=status, label="LVM Status Details" })
+end