Marius Cramer
2015-08-23 eb1177f61b0299bb011ffc1180e0d3c7fc1e87fc
interface/lib/plugins/vm_openvz_plugin.inc.php
@@ -94,7 +94,10 @@
      }
      // Set the IP address
      if(isset($this->dataRecord['ip_address'])) $app->db->query("UPDATE openvz_ip SET vm_id = ? WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']);
      if(isset($this->dataRecord['ip_address'])) {
         $app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = ?", $this->id);
         $app->db->query("UPDATE openvz_ip SET vm_id = ? WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']);
      }
      // Create the OpenVZ config file and store it in config field
      $this->makeOpenVZConfig();
@@ -133,9 +136,10 @@
      $sql .= "nameserver = ?, ";
      $sql .= "create_dns = ?, ";
      $sql .= "capability = ?, ";
      $sql .= "features = ? ";
      $sql .= "features = ?, ";
      $sql .= "iptables = ? ";
      $sql .= "WHERE vm_id = ?";
      $app->db->query($sql, $tpl['diskspace'], $tpl['ram'], $tpl['ram_burst'], $tpl['cpu_units'], $tpl['cpu_num'], $tpl['cpu_limit'], $tpl['io_priority'], $tpl['nameserver'], $tpl['create_dns'], $tpl['capability'], $tpl['features'], $this->id);
      $app->db->query($sql, $tpl['diskspace'], $tpl['ram'], $tpl['ram_burst'], $tpl['cpu_units'], $tpl['cpu_num'], $tpl['cpu_limit'], $tpl['io_priority'], $tpl['nameserver'], $tpl['create_dns'], $tpl['capability'], $tpl['features'], $tpl['iptables'], $this->id);
   }
@@ -195,6 +199,7 @@
      $tpl->setVar('nameserver', $vm['nameserver']);
      $tpl->setVar('capability', $vm['capability']);
      $tpl->setVar('features', $vm['features']);
      $tpl->setVar('iptables', $vm['iptables']);
      $tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ?", $app->functions->intval($vm['ostemplate_id']));
      $tpl->setVar('ostemplate', $tmp['template_file']);
@@ -247,7 +252,7 @@
               "server_id" => $server_id,
               "zone" => $dns_soa_id,
               "name" => $hostname,
               "type" => 'A',
               "type" => @(preg_match("/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/", $ip_address))?'A':'AAAA',
               "data" => $ip_address,
               "aux" => '0',
               "ttl" => '3600',