mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add support for gce accelerators
This commit is contained in:
parent
42ea39aadc
commit
15a0b35f8e
1 changed files with 23 additions and 0 deletions
|
@ -2372,6 +2372,29 @@ def request_instance(vm_):
|
|||
"'pd-standard', 'pd-ssd'"
|
||||
)
|
||||
|
||||
# GCE accelerator options are only supported as of libcloud >= 2.3.0
|
||||
# and Python 3+ is required so that libcloud will detect a type of
|
||||
# 'string' rather than 'unicode'
|
||||
if LIBCLOUD_VERSION_INFO >= (2, 3, 0) and isinstance("test", str):
|
||||
|
||||
kwargs.update(
|
||||
{
|
||||
"ex_accelerator_type": config.get_cloud_config_value(
|
||||
"ex_accelerator_type", vm_, __opts__, default=None
|
||||
),
|
||||
"ex_accelerator_count": config.get_cloud_config_value(
|
||||
"ex_accelerator_count", vm_, __opts__, default=None
|
||||
),
|
||||
}
|
||||
)
|
||||
if kwargs.get("ex_accelerator_type"):
|
||||
log.warning(
|
||||
"An accelerator is being attached to this instance, "
|
||||
"the ex_on_host_maintenance setting is being set to "
|
||||
"'TERMINATE' as a result"
|
||||
)
|
||||
kwargs.update({"ex_on_host_maintenance": "TERMINATE"})
|
||||
|
||||
log.info("Creating GCE instance %s in %s", vm_["name"], kwargs["location"].name)
|
||||
log.debug("Create instance kwargs %s", kwargs)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue