From cf576dd12e172d21f500af85bc7d48f13d78e081 Mon Sep 17 00:00:00 2001 From: Niclas Berglind Date: Mon, 14 Apr 2014 20:48:58 +0200 Subject: [PATCH] Added methods to Snapshot for rollback and cloning. Signed-off-by: Niclas Berglind --- src/Snapshot.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Snapshot.php b/src/Snapshot.php index b30def2..fa51be0 100644 --- a/src/Snapshot.php +++ b/src/Snapshot.php @@ -159,6 +159,29 @@ class OMVModuleZFSSnapshot { $this->exec($cmd,$out,$res); } + /** + * Rollback a Snapshot on commandline. + * + * @return void + * @access public + */ + public function rollback() { + $cmd = "zfs rollback " . $this->name . " 2>&1"; + $this->exec($cmd,$out,$res); + } + + /** + * Clones a Snapshot on commandline. + * + * @param string $newname + * @return void + * @access public + */ + public function clonesnap($newname) { + $cmd = "zfs clone -p " . $this->name . " " . $newname . " 2>&1"; + $this->exec($cmd,$out,$res); + } + /** * Helper function to execute a command and throw an exception on error * (requires stderr redirected to stdout for proper exception message). -- 2.39.2