[pve-devel] [RFC ha-manager 4/8] add 'haenv' parameter to plugin method 'check_running'
Thomas Lamprecht
t.lamprecht at proxmox.com
Fri Jan 22 17:06:38 CET 2016
This is preparation work and needed when adding virtual resources
for testing/simulation purpose.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/PVE/HA/Env/PVE2.pm | 6 +++---
src/PVE/HA/Resources.pm | 2 +-
src/PVE/HA/Resources/PVECT.pm | 4 ++--
src/PVE/HA/Resources/PVEVM.pm | 8 +++++---
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/PVE/HA/Env/PVE2.pm b/src/PVE/HA/Env/PVE2.pm
index 8a8fe84..52cfb41 100644
--- a/src/PVE/HA/Env/PVE2.pm
+++ b/src/PVE/HA/Env/PVE2.pm
@@ -436,7 +436,7 @@ sub exec_resource_agent {
my $vmid = $service_name;
- my $running = $plugin->check_running($vmid);
+ my $running = $plugin->check_running($self, $vmid);
if ($cmd eq 'started') {
@@ -446,7 +446,7 @@ sub exec_resource_agent {
$plugin->start($self, $vmid);
- $running = $plugin->check_running($vmid);
+ $running = $plugin->check_running($self, $vmid);
if ($running) {
$self->log("info", "service status $sid started");
@@ -464,7 +464,7 @@ sub exec_resource_agent {
$plugin->shutdown($self, $vmid);
- $running = $plugin->check_running($vmid);
+ $running = $plugin->check_running($self, $vmid);
if (!$running) {
$self->log("info", "service status $sid stopped");
diff --git a/src/PVE/HA/Resources.pm b/src/PVE/HA/Resources.pm
index 615e904..2d726d4 100644
--- a/src/PVE/HA/Resources.pm
+++ b/src/PVE/HA/Resources.pm
@@ -125,7 +125,7 @@ sub exists {
}
sub check_running {
- my ($class, $id) = @_;
+ my ($class, $haenv, $id) = @_;
die "implement in subclass";
}
diff --git a/src/PVE/HA/Resources/PVECT.pm b/src/PVE/HA/Resources/PVECT.pm
index ce08004..b6f936f 100644
--- a/src/PVE/HA/Resources/PVECT.pm
+++ b/src/PVE/HA/Resources/PVECT.pm
@@ -101,7 +101,7 @@ sub migrate {
};
# always relocate container for now
- if ($class->check_running($id)) {
+ if ($class->check_running($haenv, $id)) {
$class->shutdown($haenv, $id);
}
@@ -110,7 +110,7 @@ sub migrate {
}
sub check_running {
- my ($class, $vmid) = @_;
+ my ($class, $haenv, $vmid) = @_;
return PVE::LXC::check_running($vmid);
}
diff --git a/src/PVE/HA/Resources/PVEVM.pm b/src/PVE/HA/Resources/PVEVM.pm
index 19d7e91..43e1074 100644
--- a/src/PVE/HA/Resources/PVEVM.pm
+++ b/src/PVE/HA/Resources/PVEVM.pm
@@ -101,7 +101,7 @@ sub migrate {
};
# explicitly shutdown if $online isn't true (relocate)
- if (!$online && $class->check_running($id)) {
+ if (!$online && $class->check_running($haenv, $id)) {
$class->shutdown($haenv, $id);
}
@@ -110,9 +110,11 @@ sub migrate {
}
sub check_running {
- my ($class, $vmid) = @_;
+ my ($class, $haenv, $vmid) = @_;
- return PVE::QemuServer::check_running($vmid, 1);
+ my $nodename = $haenv->nodename();
+
+ return PVE::QemuServer::check_running($vmid, 1, $nodename);
}
1;
--
2.1.4
More information about the pve-devel
mailing list