summaryrefslogtreecommitdiffstats
path: root/mdadm-model.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-12-31 21:58:55 +0000
committerTed Trask <ttrask01@yahoo.com>2008-12-31 21:58:55 +0000
commit3eccb92e8917ca00286a1699acd34938e423bb79 (patch)
tree66f9d00aa8a8d66fcfb0a42fd55e640c790e989b /mdadm-model.lua
downloadacf-mdadm-3eccb92e8917ca00286a1699acd34938e423bb79.tar.bz2
acf-mdadm-3eccb92e8917ca00286a1699acd34938e423bb79.tar.xz
Added mdadm controller with basic functionality.
git-svn-id: svn://svn.alpinelinux.org/acf/mdadm/trunk@1659 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'mdadm-model.lua')
-rw-r--r--mdadm-model.lua39
1 files changed, 39 insertions, 0 deletions
diff --git a/mdadm-model.lua b/mdadm-model.lua
new file mode 100644
index 0000000..0a156ec
--- /dev/null
+++ b/mdadm-model.lua
@@ -0,0 +1,39 @@
+module(..., package.seeall)
+
+-- Load libraries
+require("modelfunctions")
+require("fs")
+require("format")
+
+-- Set variables
+local configfile = "/etc/mdadm.conf"
+local processname = "mdadm-raid"
+local packagename = "mdadm"
+
+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, "MDADM Status")
+end
+
+function getstatusdetails()
+ return cfe({ type="longtext", value=fs.read_file("/proc/mdstat") or "", label="MDADM Status Details" })
+end
+
+function get_filedetails()
+ return modelfunctions.getfiledetails(configfile)
+end
+
+function update_filedetails(filedetails)
+ return modelfunctions.setfiledetails(filedetails, {configfile})
+end