[pve-devel] [PATCH pve-ha-manager 2/2] use helpers to enable advanced auto completion
Thomas Lamprecht
t.lamprecht at proxmox.com
Tue Sep 15 09:27:37 CEST 2015
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/PVE/API2/HA/Groups.pm | 6 ++++--
src/PVE/API2/HA/Resources.pm | 18 ++++++++++++------
src/PVE/CLI/ha_manager.pm | 6 ++++--
src/PVE/HA/Groups.pm | 3 ++-
src/PVE/HA/Resources.pm | 7 +++++--
5 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/src/PVE/API2/HA/Groups.pm b/src/PVE/API2/HA/Groups.pm
index e800a32..aa4768b 100644
--- a/src/PVE/API2/HA/Groups.pm
+++ b/src/PVE/API2/HA/Groups.pm
@@ -76,7 +76,8 @@ __PACKAGE__->register_method ({
parameters => {
additionalProperties => 0,
properties => {
- group => get_standard_option('pve-ha-group-id'),
+ group => get_standard_option('pve-ha-group-id',
+ { completion => \&PVE::HA::Tools::complete_group }),
},
},
returns => {},
@@ -201,7 +202,8 @@ __PACKAGE__->register_method ({
parameters => {
additionalProperties => 0,
properties => {
- group => get_standard_option('pve-ha-group-id'),
+ group => get_standard_option('pve-ha-group-id',
+ { completion => \&PVE::HA::Tools::complete_group }),
},
},
returns => { type => 'null' },
diff --git a/src/PVE/API2/HA/Resources.pm b/src/PVE/API2/HA/Resources.pm
index 354b7b6..e97b377 100644
--- a/src/PVE/API2/HA/Resources.pm
+++ b/src/PVE/API2/HA/Resources.pm
@@ -87,7 +87,8 @@ __PACKAGE__->register_method ({
parameters => {
additionalProperties => 0,
properties => {
- sid => get_standard_option('pve-ha-resource-or-vm-id'),
+ sid => get_standard_option('pve-ha-resource-or-vm-id',
+ { completion => \&PVE::HA::Tools::complete_sid }),
},
},
returns => {},
@@ -213,7 +214,8 @@ __PACKAGE__->register_method ({
parameters => {
additionalProperties => 0,
properties => {
- sid => get_standard_option('pve-ha-resource-or-vm-id'),
+ sid => get_standard_option('pve-ha-resource-or-vm-id',
+ { completion => \&PVE::HA::Tools::complete_sid }),
},
},
returns => { type => 'null' },
@@ -245,8 +247,10 @@ __PACKAGE__->register_method ({
parameters => {
additionalProperties => 0,
properties => {
- sid => get_standard_option('pve-ha-resource-or-vm-id'),
- node => get_standard_option('pve-node'),
+ sid => get_standard_option('pve-ha-resource-or-vm-id',
+ { completion => \&PVE::HA::Tools::complete_sid }),
+ node => get_standard_option('pve-node',
+ { completion => \&PVE::Cluster::get_nodelist }),
},
},
returns => { type => 'null' },
@@ -269,8 +273,10 @@ __PACKAGE__->register_method ({
parameters => {
additionalProperties => 0,
properties => {
- sid => get_standard_option('pve-ha-resource-or-vm-id'),
- node => get_standard_option('pve-node'),
+ sid => get_standard_option('pve-ha-resource-or-vm-id',
+ { completion => \&PVE::HA::Tools::complete_sid }),
+ node => get_standard_option('pve-node',
+ { completion => \&PVE::Cluster::get_nodelist }),
},
},
returns => { type => 'null' },
diff --git a/src/PVE/CLI/ha_manager.pm b/src/PVE/CLI/ha_manager.pm
index b05257c..3ed952b 100644
--- a/src/PVE/CLI/ha_manager.pm
+++ b/src/PVE/CLI/ha_manager.pm
@@ -31,7 +31,8 @@ __PACKAGE__->register_method ({
parameters => {
additionalProperties => 0,
properties => {
- sid => get_standard_option('pve-ha-resource-or-vm-id'),
+ sid => get_standard_option('pve-ha-resource-or-vm-id',
+ { completion => \&PVE::HA::Tools::complete_sid }),
},
},
returns => { type => 'null' },
@@ -54,7 +55,8 @@ __PACKAGE__->register_method ({
parameters => {
additionalProperties => 0,
properties => {
- sid => get_standard_option('pve-ha-resource-or-vm-id'),
+ sid => get_standard_option('pve-ha-resource-or-vm-id',
+ { completion => \&PVE::HA::Tools::complete_sid }),
},
},
returns => { type => 'null' },
diff --git a/src/PVE/HA/Groups.pm b/src/PVE/HA/Groups.pm
index ab2a170..0f0ddf9 100644
--- a/src/PVE/HA/Groups.pm
+++ b/src/PVE/HA/Groups.pm
@@ -13,7 +13,8 @@ use base qw(PVE::SectionConfig);
my $defaultData = {
propertyList => {
type => { description => "Section type." },
- group => get_standard_option('pve-ha-group-id'),
+ group => get_standard_option('pve-ha-group-id',
+ { completion => \&PVE::HA::Tools::complete_group }),
nodes => get_standard_option('pve-ha-group-node-list'),
restricted => {
description => "Services on unrestricted groups may run on any cluster members if all group members are offline. But they will migrate back as soon as a group member comes online. One can implement a 'preferred node' behavior using an unrestricted group with one member.",
diff --git a/src/PVE/HA/Resources.pm b/src/PVE/HA/Resources.pm
index 2bdebb9..9b5f910 100644
--- a/src/PVE/HA/Resources.pm
+++ b/src/PVE/HA/Resources.pm
@@ -13,7 +13,8 @@ use base qw(PVE::SectionConfig);
my $defaultData = {
propertyList => {
type => { description => "Resource type.", optional => 1 },
- sid => get_standard_option('pve-ha-resource-or-vm-id'),
+ sid => get_standard_option('pve-ha-resource-or-vm-id',
+ { completion => \&PVE::HA::Tools::complete_sid }),
state => {
description => "Resource state.",
type => 'string',
@@ -21,7 +22,9 @@ my $defaultData = {
optional => 1,
default => 'enabled',
},
- group => get_standard_option('pve-ha-group-id', { optional => 1 }),
+ group => get_standard_option('pve-ha-group-id',
+ { optional => 1,
+ completion => \&PVE::HA::Tools::complete_group }),
comment => {
description => "Description.",
type => 'string',
--
2.1.4
More information about the pve-devel
mailing list