X-Git-Url: http://git.datanom.net/omvzfs.git/blobdiff_plain/77a007e04e6b82eaee3c3f00ba96d8aea97c0c36..HEAD:/src/Utils.php?ds=sidebyside diff --git a/src/Utils.php b/src/Utils.php index 58bdc7b..43a83b1 100644 --- a/src/Utils.php +++ b/src/Utils.php @@ -11,6 +11,16 @@ require_once("Zpool.php"); */ class OMVModuleZFSUtil { + /** + * Sets a GPT label on a disk to prevent the zpool command from generating + * errors. + * + */ + public static function setGPTLabel($disk) { + $cmd = "parted -s " . $disk . " mklabel gpt 2>&1"; + OMVModuleZFSUtil::exec($cmd,$out,$res); + } + /** * Manages relocation of ZFS filesystem mountpoints in the OMV backend. * Needed when the user changes mountpoint of a filesystem in the GUI. @@ -226,6 +236,7 @@ class OMVModuleZFSUtil { 'expanded'=>$expanded, 'path'=>$path); $pool = new OMVModuleZFSZpool($path); + $tmp['origin'] = "n/a"; $tmp['size'] = $pool->getSize(); $tmp['used'] = $pool->getAttribute("allocated"); $tmp['available'] = $pool->getAttribute("free"); @@ -243,12 +254,12 @@ class OMVModuleZFSUtil { $ds = new OMVModuleZFSDataset($path); if ($ds->isClone()) { //This is a cloned Filesystem - $tmp['type'] = "Clone"; $tmp['origin'] = $ds->getOrigin(); } else { //This is a standard Filesystem. - $tmp['type']= ucfirst($type); + $tmp['origin'] = "n/a"; } + $tmp['type']= ucfirst($type); $tmp['size'] = "n/a"; $used = $ds->getProperty("used"); $tmp['used'] = $used['value']; @@ -268,7 +279,15 @@ class OMVModuleZFSUtil { 'icon'=>"images/save.png", 'path'=>$path, 'expanded'=>$expanded); - $vol = new OMVModuleZFSZvol(); + $vol = new OMVModuleZFSZvol($path); + if ($vol->isClone()) { + //This is a cloned Volume + $tmp['origin'] = $vol->getOrigin(); + } else { + //This is a standard Volume + $tmp['origin'] = "n/a"; + } + $tmp['type']= ucfirst($type); $tmp['size'] = $vol->getSize(); $tmp['used'] = "n/a"; $tmp['available'] = "n/a"; @@ -287,6 +306,7 @@ class OMVModuleZFSUtil { 'icon'=>'images/zfs_snap.png', 'path'=>$path, 'expanded'=>$expanded); + $tmp['origin'] = "n/a"; $tmp['size'] = "n/a"; $tmp['used'] = "n/a"; $tmp['available'] = "n/a";