static function getSizeForAll($list) { foreach ($list as $l) { if (csa($l, "lvm:")) { $ret[$l] = vg_diskfree($l); } else { $ret[$l] = lxfile_disk_free_space($l); } } dprintr($ret); return $ret; }
/** * Get the free disk space on a Xen virtual machine. * * Checks if it is LVM based. * * @author Ángel Guzmán Maeso <*****@*****.**> * * @access private * @return integer Free disk space on MB (no bytes included via backend) */ private function getFreeDiskSpace() { $main = $this->main; $root_path = isset($main->corerootdir) ? $main->corerootdir : NULL; // Init 0 bytes as fallback value $free_disk_space = 0; if ($this->isLVM()) { $free_disk_space = vg_diskfree($root_path); } else { $free_disk_space = lxfile_disk_free_space($root_path); } return $free_disk_space; }
function get_best_location($list) { dprintr($list); $lvmlist = null; foreach ($list as $l) { if (csb($l, "lvm:")) { $lvmlist[] = $l; } else { $normallist[] = $l; } } if ($lvmlist) { foreach ($lvmlist as $l) { $out[$l] = vg_diskfree($l); } } else { foreach ($normallist as $l) { $out[$l] = lxfile_disk_free_space($l); } } dprintr($out); arsort($out); dprintr($out); foreach ($out as $k => $v) { return array('location' => $k, 'size' => $v); } }