diff --git a/html/includes/application/proxmox.inc.php b/html/includes/application/proxmox.inc.php
index 05448e1e3b..bd775247b9 100644
--- a/html/includes/application/proxmox.inc.php
+++ b/html/includes/application/proxmox.inc.php
@@ -16,14 +16,30 @@
* See http://www.gnu.org/licenses/gpl.txt for the full license
*/
+/**
+ * Fetch all VM's in a Proxmox Cluster
+ * @param string $c Clustername
+ * @return array An array with all the VM's on this cluster
+ */
function proxmox_cluster_vms($c) {
return dbFetchRows("SELECT * FROM proxmox WHERE cluster = ? ORDER BY vmid", array($c));
}
+/**
+ * Fetch all VM's on a Proxmox node
+ * @param integer $n device_id
+ * @return array An array with all the VM's on this node
+ */
function proxmox_node_vms($n) {
return dbFetchRows("SELECT * FROM proxmox WHERE device_id = ? ORDER BY vmid", array($n));
}
+/**
+ * Fetch all info about a Proxmox VM
+ * @param integer $vmid Proxmox VM ID
+ * @param string $c Clustername
+ * @return array An array with all info of this VM on this cluster, including ports
+ */
function proxmox_vm_info($vmid, $c) {
$vm = dbFetchRow("SELECT pm.*, d.hostname AS host, d.device_id FROM proxmox pm, devices d WHERE pm.device_id = d.device_id AND pm.vmid = ? AND pm.cluster = ?", array($vmid, $c));
$appid = dbFetchRow("SELECT app_id FROM applications WHERE device_id = ? AND app_type = ?", array($vm['device_id'], 'proxmox'));
diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php
index 43374b2eef..7b7ea62ca5 100644
--- a/html/includes/functions.inc.php
+++ b/html/includes/functions.inc.php
@@ -12,6 +12,12 @@
* @copyright (C) 2013 LibreNMS Group
*/
+/**
+ * Compare $t with the value of $vars[$v], if that exists
+ * @param string $v Name of the var to test
+ * @param string $t Value to compare $vars[$v] to
+ * @return boolean true, if values are the same, false if $vars[$v] is unset or values differ
+ */
function var_eq($v, $t) {
global $vars;
if (isset($vars[$v]) && $vars[$v] == $t) {
@@ -21,6 +27,11 @@ function var_eq($v, $t) {
return false;
}
+/**
+ * Get the value of $vars[$v], if it exists
+ * @param string $v Name of the var to get
+ * @return string|boolean The value of $vars[$v] if it exists, false if it does not exist
+ */
function var_get($v) {
global $vars;
if (isset($vars[$v])) {
diff --git a/html/pages/apps/proxmox/vm.inc.php b/html/pages/apps/proxmox/vm.inc.php
index 2e318789d8..5bd7a50f38 100644
--- a/html/pages/apps/proxmox/vm.inc.php
+++ b/html/pages/apps/proxmox/vm.inc.php
@@ -1,8 +1,5 @@