[pve-devel] [PATCH v2 common] add shellcmd standard option

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Jan 21 18:34:05 CET 2019


On 1/21/19 4:04 PM, Tim Marx wrote:
> Signed-off-by: Tim Marx <t.marx at proxmox.com>
> ---
>  src/PVE/JSONSchema.pm | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
> index fb58ad3..cba9187 100644
> --- a/src/PVE/JSONSchema.pm
> +++ b/src/PVE/JSONSchema.pm
> @@ -52,6 +52,13 @@ sub get_standard_option {
>      return $res;
>  };
>  
> +register_standard_option('shellcmd', {
> +    type => 'string',
> +    description => "Run command instead of normal shell.",
> +    enum => ['upgrade', 'ceph_install'],
> +    optional => 1,
> +});
> +
>  register_standard_option('pve-vmid', {
>      description => "The (unique) ID of the VM.",
>      type => 'integer', format => 'pve-vmid',
> 

Please just keep this local to pve-manager, you can register it there in
PVE::API2::Nodes if you want to reuse it, or even kust use a module variable
containing the property definition hash.

Else, you need to always touch two repositories if this gets extended or
changed, maybe even do packaging version dependency changes just because
a nowhere else used parameter definition changed...

most of the time, standard options should be only registered for things
which are used very often and mostly even only if the usage extends over
repository boundaries.




More information about the pve-devel mailing list