Skip to content

Commit 9c930e0

Browse files
committed
VM module: IP was not freed when VM is deleted.
VM module: Error in SQL query to select a template.
1 parent 967a4ac commit 9c930e0

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

interface/web/vm/openvz_vm_del.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@
4949
$app->load('tform_actions');
5050

5151
class page_action extends tform_actions {
52+
53+
function onAfterDelete() {
54+
global $app, $conf;
55+
56+
//* Release all IP addresses which are assigned to this VM
57+
$app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = '".$this->id."'");
58+
59+
}
5260

5361
}
5462

interface/web/vm/openvz_vm_edit.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,6 @@ function onAfterUpdate() {
183183

184184
}
185185

186-
function onAfterDelete() {
187-
global $app, $conf;
188-
189-
//* Release all IP addresses which are assigned to this VM
190-
$app->db->query("UPDATE openvz_ip SET vm_id = 0 WHERE vm_id = '".$this->id."'");
191-
192-
}
193-
194186
function applyTemplate() {
195187
global $app, $conf;
196188

server/plugins-available/openvz_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function vm_insert($event_name,$data) {
7777
return;
7878
}
7979

80-
$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ".$vm['ostemplate_id']);
80+
$tmp = $app->db->queryOneRecord("SELECT template_file FROM openvz_ostemplate WHERE ostemplate_id = ".$data['new']['ostemplate_id']);
8181
$ostemplate = escapeshellcmd($tmp['template_file']);
8282
unset($tmp);
8383

0 commit comments

Comments
 (0)