heat.engine.clients.os.nova module

class heat.engine.clients.os.nova.FlavorConstraint[source]

基类: NovaBaseConstraint

expected_exceptions = (<class 'novaclient.exceptions.NotFound'>,)
resource_getter_name = 'find_flavor_by_name_or_id'
class heat.engine.clients.os.nova.HostConstraint[source]

基类: NovaBaseConstraint

expected_exceptions = (<class 'novaclient.exceptions.NotFound'>,)
resource_getter_name = 'get_host'
class heat.engine.clients.os.nova.KeypairConstraint[source]

基类: NovaBaseConstraint

resource_getter_name = 'get_keypair'
validate_with_client(client, key_name)[source]
class heat.engine.clients.os.nova.NovaBaseConstraint[source]

基类: BaseCustomConstraint

resource_client_name = 'nova'
class heat.engine.clients.os.nova.NovaClientPlugin(context)[source]

基类: MicroversionMixin, ClientPlugin

COMPUTE = 'compute'
NOVA_API_VERSION = '2.1'
absolute_limits()[source]

返回绝对限制作为字典。

associate_floatingip(server_id, floatingip_id)[source]
associate_floatingip_address(server_id, fip_address)[source]
attach_volume(server_id, volume_id, device)[source]
static build_ignition_data(metadata, userdata)[source]
build_userdata(metadata, userdata=None, instance_user=None, user_data_format='HEAT_CFNTOOLS')[source]

构建 CloudInit 和 Ignition 的多部分数据 blob。

数据 blob 包括用户提供的元数据、用户数据以及所需的 Heat 实例配置。

参数:
  • resource (heat.engine.Resource) – 资源实现

  • userdata (strNone) – 用户数据字符串

  • instance_user (string) – 要在服务器上创建的用户

  • user_data_format (string) – 要返回的用户数据格式

返回值:

multipart mime 作为字符串

check_delete_server_complete(server_id)[source]

等待服务器从 Nova 中消失。

check_detach_volume_complete(server_id, attach_id)[source]

检查 nova 服务器是否已丢失附件。

此检查对于更新时的立即重新附加是必需的:在 cinder 将卷标记为“可用”和 nova 从其自身对象中删除附件之间可能存在一些时间,因此我们检查 nova 是否已经知道卷已分离。

check_interface_attach(server_id, port_id)[source]
check_interface_detach(server_id, port_id)[source]
check_rebuild(server_id)[source]

验证正在重建的服务器是否已成功重建。

如果出现错误状态,则引发错误。

check_resize(server_id, flavor)[source]

验证正在调整大小的服务器是否已正确调整大小。

如果是,则确认调整大小,否则引发错误。

check_verify_resize(server_id)[source]
deferred_server_statuses = {'BUILD', 'HARD_REBOOT', 'PASSWORD', 'REBOOT', 'RESCUE', 'RESIZE', 'REVERT_RESIZE', 'SHUTOFF', 'SUSPENDED', 'VERIFY_RESIZE'}
detach_volume(server_id, attach_id)[source]
dissociate_floatingip(floatingip_id)[source]
dissociate_floatingip_address(fip_address)[source]
exceptions_module = <module 'novaclient.exceptions' from '/home/zuul/src/opendev.org/openstack/heat/.tox/docs/lib/python3.12/site-packages/novaclient/exceptions.py'>
fetch_server(server_id)[source]

从 Nova 获取最新的服务器对象。

对于非关键 API 错误,记录警告并返回 None。 在各种 check_*_complete 资源方法中使用此方法,其中可以容忍间歇性错误。

fetch_server_attr(server_id, attr)[source]
find_flavor_by_name_or_id(flavor)[source]

查找具有指定名称或 ID 的风味。

参数:

flavor – 要查找的风味名称

返回值:

风味 :flavor 的 ID

get_console_urls(server)[source]

返回服务器控制台 URL 的类似字典的结构。

实际的控制台 URL 在访问时延迟解析。

get_flavor(flavor_identifier)[source]

获取具有指定风味名称或 ID 的风味对象。

参数:

flavor_identifier – 要查找的风味名称或 ID

返回值:

具有名称或 ID :flavor 的风味对象

get_host(hypervisor_hostname)[source]

按指定名称获取匹配的超visor 列表。

参数:

hypervisor_hostname – 要查找的主机名称

返回值:

匹配的超visor 主机列表

引发:

nova client exceptions.NotFound

get_ip(server, net_type, ip_version)[source]

返回服务器的给定类型和版本的 IP。

get_keypair(key_name)[source]

获取由 :key_name 指定的公钥

参数:

key_name – 要查找的密钥的名称

返回值:

密钥对(名称、公钥)用于 :key_name

引发:

exception.EntityNotFound

get_max_microversion()[source]
get_server(server)[source]

返回新的服务器对象。

将 Nova 的 NotFound 替换为 Heat 的 EntityNotFound,作为 HTTP 错误返回给用户。

get_status(server)[source]

返回服务器的状态。

参数:

server – 服务器对象

返回值:

状态字符串

interface_attach(server_id, port_id=None, net_id=None, fip=None, security_groups=None)[source]
interface_detach(server_id, port_id)[source]
is_bad_request(ex)[source]
is_conflict(ex)[source]

如果异常是冲突,则返回 True。

static is_ignition_format(userdata)[source]
is_not_found(ex)[source]

如果异常是未找到,则返回 True。

is_over_limit(ex)[source]

如果异常是超出限制,则返回 True。

is_unprocessable_entity(ex)[source]
is_version_supported(version)[source]
max_microversion = None
meta_serialize(metadata)[source]

在发送到 Nova 之前序列化非字符串元数据值。

meta_update(server, metadata)[source]

根据需要删除/添加 Nova 中的元数据。

rebuild(server_id, image_id, password=None, preserve_ephemeral=False, meta=None, files=None)[source]

重建服务器并调用 check_rebuild 进行验证。

refresh_server(server)[source]

刷新服务器的属性。

记录非关键 API 错误的警告。

rename(server, name)[source]

更新服务器的名称。

resize(server_id, flavor_id)[source]

调整服务器的大小。

server_to_ipaddress(server)[source]

从 Nova 获取服务器的 IP 地址。

service_types = ['compute']
verify_resize(server_id)[source]
class heat.engine.clients.os.nova.ServerConstraint[source]

基类: NovaBaseConstraint

resource_getter_name = 'get_server'