Skip to content

Commit deff20f

Browse files
committed
Bugfixes in VM module.
1 parent 46598e0 commit deff20f

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

interface/lib/plugins/vm_openvz_plugin.inc.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function onLoad() {
2323
//* Register for events
2424
$app->plugin->registerEvent('vm:openvz_vm:on_after_insert','vm_openvz_plugin','openvz_vm_insert');
2525
$app->plugin->registerEvent('vm:openvz_vm:on_after_update','vm_openvz_plugin','openvz_vm_update');
26+
$app->plugin->registerEvent('vm:openvz_vm:on_after_delete','vm_openvz_plugin','openvz_vm_delete');
2627
}
2728

2829
/*
@@ -105,6 +106,16 @@ function openvz_vm_update($event_name, $page_form) {
105106

106107
}
107108

109+
function openvz_vm_delete($event_name, $page_form) {
110+
global $app, $conf;
111+
112+
//* Free the IP address
113+
$tmp = $app->db->queryOneRecord("SELECT ip_address_id FROM openvz_ip WHERE vm_id = ".$page_form->id);
114+
$app->db->datalogUpdate('openvz_ip', 'vm_id = 0', 'ip_address_id', $tmp['ip_address_id']);
115+
unset($tmp);
116+
117+
}
118+
108119
private function applyTemplate() {
109120
global $app, $conf;
110121

interface/web/vm/openvz_vm_del.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@
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-
}
6052

6153
}
6254

server/plugins-available/openvz_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
Copyright (c) 2009, Till Brehm, projektfarm Gmbh
4+
Copyright (c) 2011, Till Brehm, projektfarm Gmbh
55
All rights reserved.
66
77
Redistribution and use in source and binary forms, with or without modification,

0 commit comments

Comments
 (0)