From 8bda0ab8b8dd389621c5a7054ea677924f6c5045 Mon Sep 17 00:00:00 2001 From: Niclas Berglind Date: Wed, 12 Mar 2014 20:46:47 +0100 Subject: [PATCH] Added rename method to Zvol class. Signed-off-by: Niclas Berglind --- src/Zvol.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Zvol.php b/src/Zvol.php index 9ace6cf..9be6f5e 100644 --- a/src/Zvol.php +++ b/src/Zvol.php @@ -160,7 +160,7 @@ class OMVModuleZFSZvol { */ public function create($size, array $properties = null, $sparse = null) { $cmd = "zfs create -p "; - if (isset($sparse) && $sparse == true) { + if ((isset($sparse)) && ($sparse == true)) { $cmd .= "-s "; } $cmd .= "-V " . $size . " " . $this->name . " 2>&1"; @@ -181,6 +181,19 @@ class OMVModuleZFSZvol { $this->exec($cmd,$out,$res); } + /** + * Renames a Zvol + * + * @param string $newname New name of the Dataset + * @return void + * @access public + */ + public function rename($newname) { + $cmd = "zfs rename -p " . $this->name . " " . $newname . " 2>&1"; + $this->exec($cmd,$out,$res); + $this->name = $newname; + } + /** * Clears a previously set proporty and specifies that it should be * inherited from it's parent. -- 2.39.2