Skip to content

Commit 61e08e7

Browse files
author
Florian Schaal
committed
openvz: free all ip-addresses if the vm was deleted
1 parent 1dbd0e3 commit 61e08e7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

interface/lib/plugins/vm_openvz_plugin.inc.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,12 @@ function openvz_vm_delete($event_name, $page_form) {
130130
global $app, $conf;
131131

132132
//* Free the IP address
133-
$tmp = $app->db->queryOneRecord("SELECT ip_address_id FROM openvz_ip WHERE vm_id = ?", $page_form->id);
134-
$app->db->datalogUpdate('openvz_ip', array('vm_id' => 0), 'ip_address_id', $tmp['ip_address_id']);
133+
$tmp_rec = $app->db->queryAllRecords("SELECT ip_address_id FROM openvz_ip WHERE vm_id = ?", $page_form->id);
134+
foreach ($tmp_rec as $tmp) {
135+
$app->db->datalogUpdate('openvz_ip', array('vm_id' => 0), 'ip_address_id', $tmp['ip_address_id']);
136+
}
135137
unset($tmp);
136-
138+
unset($tmp_rec);
137139
}
138140

139141
private function applyTemplate() {

0 commit comments

Comments
 (0)