Skip to content

Commit 168c514

Browse files
author
Florian Schaal
committed
when changing the ip_address for a vm set the old ip to "unused"
1 parent 9317737 commit 168c514

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

interface/lib/plugins/vm_openvz_plugin.inc.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@ function openvz_vm_update($event_name, $page_form) {
9494
}
9595

9696
// Set the IP address
97-
if(isset($this->dataRecord['ip_address'])) $app->db->query("UPDATE openvz_ip SET vm_id = ? WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']);
97+
if(isset($this->dataRecord['ip_address'])) {
98+
$app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = ?", $this->id);
99+
$app->db->query("UPDATE openvz_ip SET vm_id = ? WHERE ip_address = ?", $this->id, $this->dataRecord['ip_address']);
100+
}
98101

99102
// Create the OpenVZ config file and store it in config field
100103
$this->makeOpenVZConfig();

0 commit comments

Comments
 (0)