]> git.datanom.net - omvzfs.git/blobdiff - src/Snapshot.php
Added getSnapshots method to Zvol class.
[omvzfs.git] / src / Snapshot.php
index afd189c2f082055ddfd31fa72b473d304494c1ed..b30def21c05864a622e5ddb6aa6031c1ee3e68c6 100644 (file)
@@ -39,6 +39,7 @@ class OMVModuleZFSSnapshot {
         * @access public
         */
        public function __construct($name) {
+               $snap_exists = true;
                $this->name = $name;
                $cmd = "zfs list -H -t snapshot " .$name . " 2>&1";
                try {
@@ -46,6 +47,10 @@ class OMVModuleZFSSnapshot {
                        $this->updateAllProperties();
                }
                catch (OMVModuleZFSException $e) {
+                       $snap_exists = false;
+               }
+               if (!$snap_exists) {
+                       $this->create();
                }
        }
 
@@ -132,17 +137,15 @@ class OMVModuleZFSSnapshot {
        }
 
        /**
-        * Craete a Snapshot on commandline. Optionally provide a number of properties to set.
+        * Create a Snapshot on commandline.
         * 
-        * @param array $properties Properties to set when creating the dataset.
         * @return void
-        * @access public
+        * @access private
         */
-       public function create(array $properties = null) {
+       private function create() {
                $cmd = "zfs snapshot " . $this->name . " 2>&1";
                $this->exec($cmd,$out,$res);
                $this->updateAllProperties();
-               $this->setProperties($properties);
        }
 
        /**
This page took 0.046111 seconds and 5 git commands to generate.