summaryrefslogtreecommitdiffstats
path: root/lvm2-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-12-31 21:59:19 +0000
committerTed Trask <ttrask01@yahoo.com>2008-12-31 21:59:19 +0000
commit18359329c7a1ec413b1263236979b846d087aef7 (patch)
treeaf6957c77ce2498b1ef5f79b2a303f806a12af2b /lvm2-model.lua
downloadacf-lvm2-18359329c7a1ec413b1263236979b846d087aef7.tar.bz2
acf-lvm2-18359329c7a1ec413b1263236979b846d087aef7.tar.xz
Added lvm2 controller with basic functionality.
git-svn-id: svn://svn.alpinelinux.org/acf/lvm2/trunk@1660 ab2d0c66-481e-0410-8bed-d214d4d58bed
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