]> git.proxmox.com Git - pve-ha-manager.git/commitdiff
check resource better on addition and update
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 12 Oct 2015 13:04:41 +0000 (15:04 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 12 Oct 2015 16:15:08 +0000 (18:15 +0200)
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@proxmox.com>
src/PVE/API2/HA/Resources.pm

index d4b4b7189f38e37ea5bc56f519c5a27b018b606d..93383aaa537e9290ec8a8bce4cb08c9c8f4888bd 100644 (file)
@@ -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;