Add selector help and adjust flag name

1. Add documentation on the node selector flags. In the API, reference
the daemon configuration manual which now includes details in this
section; in the CLI, provide the help in "pvc vm define" in detail and
then reference that command's help in the other commands that use this
field.

2. Ensure the naming is consistent in the CLI, using the flag name
"--node-selector" everywhere (was "--selector" for "pvc vm" commands and
"--node-selector" for "pvc provisioner" commands).
This commit is contained in:
Joshua Boniface 2022-06-10 02:14:15 -04:00
parent b1357cafdb
commit d8d3feee22
5 changed files with 44 additions and 14 deletions

View File

@ -1002,7 +1002,7 @@ class API_VM_Root(Resource):
type: string type: string
node_selector: node_selector:
type: string type: string
description: The selector used to determine candidate nodes during migration description: The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference
node_autostart: node_autostart:
type: boolean type: boolean
description: Whether to autostart the VM when its node returns to ready domain state description: Whether to autostart the VM when its node returns to ready domain state
@ -1297,7 +1297,7 @@ class API_VM_Root(Resource):
name: selector name: selector
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; see 'target_selector' in the node daemon configuration reference
default: none default: none
enum: enum:
- mem - mem
@ -1446,7 +1446,7 @@ class API_VM_Element(Resource):
name: selector name: selector
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; see 'target_selector' in the node daemon configuration reference
default: none default: none
enum: enum:
- mem - mem
@ -1629,7 +1629,7 @@ class API_VM_Metadata(Resource):
type: string type: string
node_selector: node_selector:
type: string type: string
description: The selector used to determine candidate nodes during migration description: The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference
node_autostart: node_autostart:
type: string type: string
description: Whether to autostart the VM when its node returns to ready domain state description: Whether to autostart the VM when its node returns to ready domain state
@ -1678,7 +1678,7 @@ class API_VM_Metadata(Resource):
name: selector name: selector
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; see 'target_selector' in the node daemon configuration reference
enum: enum:
- mem - mem
- memfree - memfree

View File

@ -803,7 +803,7 @@ def cli_vm():
) )
@click.option( @click.option(
"-s", "-s",
"--selector", "--node-selector",
"node_selector", "node_selector",
default="none", default="none",
show_default=True, show_default=True,
@ -857,6 +857,18 @@ def vm_define(
): ):
""" """
Define a new virtual machine from Libvirt XML configuration file VMCONFIG. Define a new virtual machine from Libvirt XML configuration file VMCONFIG.
The target node selector ("--node-selector"/"-s") can be "none" to use the cluster default, or one of the following values:
* "mem": choose the node with the least provisioned VM memory
* "memfree": choose the node with the most (real) free memory
* "vcpus": choose the node with the least allocated VM vCPUs
* "load": choose the node with the lowest current load average
* "vms": choose the node with the least number of provisioned VMs
For most clusters, "mem" should be sufficient, but others may be used based on the cluster workload and available resources. The following caveats should be considered:
* "mem" looks at the provisioned memory, not the allocated memory; thus, stopped or disabled VMs are counted towards a node's memory for this selector, even though their memory is not actively in use.
* "memfree" looks at the free memory of the node in general, ignoring the amount provisioned to VMs; if any VM's internal memory usage changes, this value would be affected. This might be preferable to "mem" on clusters with very high memory utilization versus total capacity or if many VMs are stopped/disabled.
* "load" looks at the system load of the node in general, ignoring load in any particular VMs; if any VM's CPU usage changes, this value would be affected. This might be preferable on clusters with some very CPU intensive VMs.
""" """
# Open the XML file # Open the XML file
@ -898,7 +910,7 @@ def vm_define(
) )
@click.option( @click.option(
"-s", "-s",
"--selector", "--node-selector",
"node_selector", "node_selector",
default=None, default=None,
show_default=False, show_default=False,
@ -942,6 +954,8 @@ def vm_meta(
): ):
""" """
Modify the PVC metadata of existing virtual machine DOMAIN. At least one option to update must be specified. DOMAIN may be a UUID or name. Modify the PVC metadata of existing virtual machine DOMAIN. At least one option to update must be specified. DOMAIN may be a UUID or name.
For details on the "--node-selector"/"-s" values, please see help for the command "pvc vm define".
""" """
if ( if (
@ -4137,6 +4151,8 @@ def provisioner_template_system_add(
): ):
""" """
Add a new system template NAME to the PVC cluster provisioner. Add a new system template NAME to the PVC cluster provisioner.
For details on the possible "--node-selector" values, please see help for the command "pvc vm define".
""" """
params = dict() params = dict()
params["name"] = name params["name"] = name
@ -4230,6 +4246,8 @@ def provisioner_template_system_modify(
): ):
""" """
Add a new system template NAME to the PVC cluster provisioner. Add a new system template NAME to the PVC cluster provisioner.
For details on the possible "--node-selector" values, please see help for the command "pvc vm define".
""" """
params = dict() params = dict()
params["vcpus"] = vcpus params["vcpus"] = vcpus

View File

@ -679,7 +679,7 @@ def getNodes(zkhandler, node_limit, dom_uuid):
# #
# via allocated memory # via provisioned memory
# #
def findTargetNodeMem(zkhandler, node_limit, dom_uuid): def findTargetNodeMem(zkhandler, node_limit, dom_uuid):
most_provfree = 0 most_provfree = 0

View File

@ -353,7 +353,19 @@ The password for the PVC node daemon to log in to the IPMI interface.
* *required* * *required*
The selector algorithm to use when migrating hosts away from the node. Valid `selector` values are: `mem`: the node with the least allocated VM memory; `vcpus`: the node with the least allocated VM vCPUs; `load`: the node with the least current load average; `vms`: the node with the least number of provisioned VMs. The default selector algorithm to use when migrating VMs away from a node; individual VMs can override this default.
Valid `target_selector` values are:
* `mem`: choose the node with the least provisioned VM memory
* `memfree`: choose the node with the most (real) free memory
* `vcpus`: choose the node with the least allocated VM vCPUs
* `load`: choose the node with the lowest current load average
* `vms`: choose the node with the least number of provisioned VMs
For most clusters, `mem` should be sufficient, but others may be used based on the cluster workload and available resources. The following caveats should be considered:
* `mem` looks at the provisioned memory, not the allocated memory; thus, stopped or disabled VMs are counted towards a node's memory for this selector, even though their memory is not actively in use.
* `memfree` looks at the free memory of the node in general, ignoring the amount provisioned to VMs; if any VM's internal memory usage changes, this value would be affected. This might be preferable to `mem` on clusters with very high memory utilization versus total capacity or if many VMs are stopped/disabled.
* `load` looks at the system load of the node in general, ignoring load in any particular VMs; if any VM's CPU usage changes, this value would be affected. This might be preferable on clusters with some very CPU intensive VMs.
#### `system``configuration``directories``dynamic_directory` #### `system``configuration``directories``dynamic_directory`

View File

@ -192,7 +192,7 @@
"type": "array" "type": "array"
}, },
"node_selector": { "node_selector": {
"description": "The selector used to determine candidate nodes during migration", "description": "The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference",
"type": "string" "type": "string"
} }
}, },
@ -1414,7 +1414,7 @@
"type": "array" "type": "array"
}, },
"node_selector": { "node_selector": {
"description": "The selector used to determine candidate nodes during migration", "description": "The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference",
"type": "string" "type": "string"
}, },
"profile": { "profile": {
@ -6174,7 +6174,7 @@
}, },
{ {
"default": "none", "default": "none",
"description": "The selector used to determine candidate nodes during migration", "description": "The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference",
"enum": [ "enum": [
"mem", "mem",
"memfree", "memfree",
@ -6333,7 +6333,7 @@
}, },
{ {
"default": "none", "default": "none",
"description": "The selector used to determine candidate nodes during migration", "description": "The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference",
"enum": [ "enum": [
"mem", "mem",
"memfree", "memfree",
@ -6594,7 +6594,7 @@
"type": "string" "type": "string"
}, },
{ {
"description": "The selector used to determine candidate nodes during migration", "description": "The selector used to determine candidate nodes during migration; see 'target_selector' in the node daemon configuration reference",
"enum": [ "enum": [
"mem", "mem",
"memfree", "memfree",