Add memfree to selector and use proper defaults

This commit is contained in:
Joshua Boniface 2022-06-10 02:03:12 -04:00
parent f8cdcb30ba
commit b1357cafdb
3 changed files with 28 additions and 14 deletions

View File

@ -1252,7 +1252,7 @@ class API_VM_Root(Resource):
{"name": "node"}, {"name": "node"},
{ {
"name": "selector", "name": "selector",
"choices": ("mem", "vcpus", "load", "vms", "none"), "choices": ("mem", "memfree", "vcpus", "load", "vms", "none"),
"helptext": "A valid selector must be specified", "helptext": "A valid selector must be specified",
}, },
{"name": "autostart"}, {"name": "autostart"},
@ -1298,12 +1298,14 @@ class API_VM_Root(Resource):
type: string type: string
required: false required: false
description: The selector used to determine candidate nodes during migration description: The selector used to determine candidate nodes during migration
default: mem default: none
enum: enum:
- mem - mem
- memfree
- vcpus - vcpus
- load - load
- vms - vms
- none (cluster default)
- in: query - in: query
name: autostart name: autostart
type: boolean type: boolean
@ -1397,7 +1399,7 @@ class API_VM_Element(Resource):
{"name": "node"}, {"name": "node"},
{ {
"name": "selector", "name": "selector",
"choices": ("mem", "vcpus", "load", "vms", "none"), "choices": ("mem", "memfree", "vcpus", "load", "vms", "none"),
"helptext": "A valid selector must be specified", "helptext": "A valid selector must be specified",
}, },
{"name": "autostart"}, {"name": "autostart"},
@ -1445,9 +1447,10 @@ class API_VM_Element(Resource):
type: string type: string
required: false required: false
description: The selector used to determine candidate nodes during migration description: The selector used to determine candidate nodes during migration
default: mem default: none
enum: enum:
- mem - mem
- memfree
- vcpus - vcpus
- load - load
- vms - vms
@ -1646,7 +1649,7 @@ class API_VM_Metadata(Resource):
{"name": "limit"}, {"name": "limit"},
{ {
"name": "selector", "name": "selector",
"choices": ("mem", "vcpus", "load", "vms", "none"), "choices": ("mem", "memfree", "vcpus", "load", "vms", "none"),
"helptext": "A valid selector must be specified", "helptext": "A valid selector must be specified",
}, },
{"name": "autostart"}, {"name": "autostart"},
@ -1678,9 +1681,11 @@ class API_VM_Metadata(Resource):
description: The selector used to determine candidate nodes during migration description: The selector used to determine candidate nodes during migration
enum: enum:
- mem - mem
- memfree
- vcpus - vcpus
- load - load
- vms - vms
- none (cluster default)
- in: query - in: query
name: autostart name: autostart
type: boolean type: boolean

View File

@ -805,9 +805,9 @@ def cli_vm():
"-s", "-s",
"--selector", "--selector",
"node_selector", "node_selector",
default="mem", default="none",
show_default=True, show_default=True,
type=click.Choice(["mem", "load", "vcpus", "vms", "none"]), type=click.Choice(["mem", "memfree", "load", "vcpus", "vms", "none"]),
help='Method to determine optimal target node during autoselect; "none" will use the default for the cluster.', help='Method to determine optimal target node during autoselect; "none" will use the default for the cluster.',
) )
@click.option( @click.option(
@ -902,7 +902,7 @@ def vm_define(
"node_selector", "node_selector",
default=None, default=None,
show_default=False, show_default=False,
type=click.Choice(["mem", "load", "vcpus", "vms", "none"]), type=click.Choice(["mem", "memfree", "load", "vcpus", "vms", "none"]),
help='Method to determine optimal target node during autoselect; "none" will use the default for the cluster.', help='Method to determine optimal target node during autoselect; "none" will use the default for the cluster.',
) )
@click.option( @click.option(
@ -4102,7 +4102,9 @@ def provisioner_template_system_list(limit):
@click.option( @click.option(
"--node-selector", "--node-selector",
"node_selector", "node_selector",
type=click.Choice(["mem", "vcpus", "vms", "load", "none"], case_sensitive=False), type=click.Choice(
["mem", "memfree", "vcpus", "vms", "load", "none"], case_sensitive=False
),
default="none", default="none",
help='Method to determine optimal target node during autoselect; "none" will use the default for the cluster.', help='Method to determine optimal target node during autoselect; "none" will use the default for the cluster.',
) )
@ -4194,7 +4196,9 @@ def provisioner_template_system_add(
@click.option( @click.option(
"--node-selector", "--node-selector",
"node_selector", "node_selector",
type=click.Choice(["mem", "vcpus", "vms", "load", "none"], case_sensitive=False), type=click.Choice(
["mem", "memfree", "vcpus", "vms", "load", "none"], case_sensitive=False
),
help='Method to determine optimal target node during autoselect; "none" will use the default for the cluster.', help='Method to determine optimal target node during autoselect; "none" will use the default for the cluster.',
) )
@click.option( @click.option(

View File

@ -6173,13 +6173,15 @@
"type": "string" "type": "string"
}, },
{ {
"default": "mem", "default": "none",
"description": "The selector used to determine candidate nodes during migration", "description": "The selector used to determine candidate nodes during migration",
"enum": [ "enum": [
"mem", "mem",
"memfree",
"vcpus", "vcpus",
"load", "load",
"vms" "vms",
"none (cluster default)"
], ],
"in": "query", "in": "query",
"name": "selector", "name": "selector",
@ -6330,10 +6332,11 @@
"type": "string" "type": "string"
}, },
{ {
"default": "mem", "default": "none",
"description": "The selector used to determine candidate nodes during migration", "description": "The selector used to determine candidate nodes during migration",
"enum": [ "enum": [
"mem", "mem",
"memfree",
"vcpus", "vcpus",
"load", "load",
"vms", "vms",
@ -6594,9 +6597,11 @@
"description": "The selector used to determine candidate nodes during migration", "description": "The selector used to determine candidate nodes during migration",
"enum": [ "enum": [
"mem", "mem",
"memfree",
"vcpus", "vcpus",
"load", "load",
"vms" "vms",
"none (cluster default)"
], ],
"in": "query", "in": "query",
"name": "selector", "name": "selector",