[pve-devel] [PATCH v2 pve-ha-manager 4/5] check resource better on addition and update
Thomas Lamprecht
t.lamprecht at proxmox.com
Mon Oct 12 15:04:41 CEST 2015
Check if the resource exists in the cluster when adding it to the
ha stack.
When trying to update/migrate or delete a resource check if it's
ha managed at all.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/PVE/API2/HA/Resources.pm | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm
index d4b4b71..93383aa 100644
--- a/src/PVE/API2/HA/Resources.pm
+++ b/src/PVE/API2/HA/Resources.pm
@@ -127,6 +127,8 @@ __PACKAGE__->register_method ({
my $plugin = PVE::HA::Resources->lookup($type);
$plugin->verify_name($name);
+ $plugin->exists($name);
+
my $opts = $plugin->check_config($sid, $param, 1, 1);
PVE::HA::Config::lock_ha_domain(
@@ -224,6 +226,8 @@ __PACKAGE__->register_method ({
my ($sid, $type, $name) = PVE::HA::Tools::parse_sid(extract_param($param, 'sid'));
+ PVE::HA::Config::service_is_ha_managed($sid);
+
PVE::HA::Config::lock_ha_domain(
sub {
@@ -259,6 +263,8 @@ __PACKAGE__->register_method ({
my ($sid, $type, $name) = PVE::HA::Tools::parse_sid(extract_param($param, 'sid'));
+ PVE::HA::Config::service_is_ha_managed($sid);
+
PVE::HA::Config::queue_crm_commands("migrate $sid $param->{node}");
return undef;
@@ -285,6 +291,8 @@ __PACKAGE__->register_method ({
my ($sid, $type, $name) = PVE::HA::Tools::parse_sid(extract_param($param, 'sid'));
+ PVE::HA::Config::service_is_ha_managed($sid);
+
PVE::HA::Config::queue_crm_commands("relocate $sid $param->{node}");
return undef;
--
2.1.4
More information about the pve-devel
mailing list