diff --git a/interface/lib/plugins/vm_openvz_plugin.inc.php b/interface/lib/plugins/vm_openvz_plugin.inc.php index 73cc9cda86fd3e2be17a351ccda7fff974e4cf08..9d54b6b1a92f4546dd0eb90e490f34d797718aaf 100644 --- a/interface/lib/plugins/vm_openvz_plugin.inc.php +++ b/interface/lib/plugins/vm_openvz_plugin.inc.php @@ -94,7 +94,10 @@ class vm_openvz_plugin { } // 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();