Skip to content
Snippets Groups Projects
  • Jakob Meng's avatar
    ac401bb3
    Refactored server and server_info modules · ac401bb3
    Jakob Meng authored
    Allow to update server attributes such as its description.
    
    Changed default value of server attribute 'security_groups' from
    ['default'] to [] because the latter is the default in
    python-openstackclient [1] and the former behavior causes issues
    with existing servers [2]: Previously, when no 'security_groups'
    parameter was given, the server module would change existing
    servers to use the default security group, dropping all other
    security groups assigned to the server.
    Our (undocumented) guideline when writing modules is to only
    add or change what has been requested by the user and to stick to
    defaults from openstacksdk and python-openstackclient whenever
    possible. Since we have to break backward compatibility with the
    next release anyway, we take this opportunity to clean up this odd
    behavior. Now, when no security groups are given, then security
    groups of an existing server will not be touched.
    Closes story #2007893 [2].
    Note, Nova will create a server in the default security group,
    if the security_groups parameter is omitted.
    
    Dropped 'openstack' field from server module's results. This
    variable expanded to additional server information which might
    be useful for Ansible inventories and was filled from
    openstacksdk's get_openstack_vars() function [3]. Variables in
    this function can make additional cloud queries to retrieve
    additional data, so calling this function can be expensive [4].
    Users can use *_info modules to retrieve this data on-demand.
    
    Dropped 'availabity_zone' attribute from generic OpenStackModule
    arguments and inserted it into server and volume modules because
    it is relevant to those two modules only. This is completes what
    was started years ago [5] and is possible now since we have
    breaking changes anyway.
    
    Switched attribute name 'userdata' with its alias 'user_data' to
    match openstacksdk's attribute names which are used e.g. in module
    results. The previous attribute name 'userdata' is now used as an
    alias and 'user_data' is used as the attribute name to keep backward
    compatibility.
    
    Wait for server to get into 'ACTIVE' state when creating a server
    and attribute 'wait' has been set to true.
    
    Sorted argument specs and documentation of the server module and
    marked attributes which are not updatable. Changed unstable bash
    script example in server module documentation.
    
    Renamed server's module attribute 'delete_fip' to 'delete_ips' to
    match openstacksdk and clarify that it includes all floating ip
    addresses of the server.
    
    Renamed server_info's module attribute 'server' to 'name' and added
    the former as an alias to be consistent with other *_info modules.
    
    Added RETURN fields documentation for the module results of both
    server and server_info modules.
    
    Added description and examples of how to use the 'filters' attribute
    of the server_info module. Closes story #2007873 [6].
    
    Removed 'openstack_' prefix from module results because the prefix is
    not consistently used across modules, is more to type without any
    benefit and removal of the prefix allows us to signal to users that
    their code for handling module results has to be updated. Many modules
    have different return values with openstacksdk >= 0.99.0 because it
    consistently uses resource proxies now.
    
    Added assertions for module results to catch future changes in the
    openstacksdk and our Ansible modules.
    
    Added integration tests to check the update mechanism of the server
    module.
    
    Fixed indentation in integration tests.
    
    Ensure proper creation and deletion of resources such as networks,
    subnets and servers in integration tests of server_action module.
    
    Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
    'a' in the file extension to be consistent with other filenames.
    
    Dropped deprecated function openstack_find_nova_addresses() and
    incorporated its code directly into the server module because it
    is not used anywhere else.
    
    [1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
    [2] https://storyboard.openstack.org/#!/story/2007893
    [3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
    [4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
    [5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
    [6] https://storyboard.openstack.org/#!/story/2007873
    
    
    
    Signed-off-by: default avatarJakob Meng <code@jakobmeng.de>
    Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d
    ac401bb3
    History
    Refactored server and server_info modules
    Jakob Meng authored
    Allow to update server attributes such as its description.
    
    Changed default value of server attribute 'security_groups' from
    ['default'] to [] because the latter is the default in
    python-openstackclient [1] and the former behavior causes issues
    with existing servers [2]: Previously, when no 'security_groups'
    parameter was given, the server module would change existing
    servers to use the default security group, dropping all other
    security groups assigned to the server.
    Our (undocumented) guideline when writing modules is to only
    add or change what has been requested by the user and to stick to
    defaults from openstacksdk and python-openstackclient whenever
    possible. Since we have to break backward compatibility with the
    next release anyway, we take this opportunity to clean up this odd
    behavior. Now, when no security groups are given, then security
    groups of an existing server will not be touched.
    Closes story #2007893 [2].
    Note, Nova will create a server in the default security group,
    if the security_groups parameter is omitted.
    
    Dropped 'openstack' field from server module's results. This
    variable expanded to additional server information which might
    be useful for Ansible inventories and was filled from
    openstacksdk's get_openstack_vars() function [3]. Variables in
    this function can make additional cloud queries to retrieve
    additional data, so calling this function can be expensive [4].
    Users can use *_info modules to retrieve this data on-demand.
    
    Dropped 'availabity_zone' attribute from generic OpenStackModule
    arguments and inserted it into server and volume modules because
    it is relevant to those two modules only. This is completes what
    was started years ago [5] and is possible now since we have
    breaking changes anyway.
    
    Switched attribute name 'userdata' with its alias 'user_data' to
    match openstacksdk's attribute names which are used e.g. in module
    results. The previous attribute name 'userdata' is now used as an
    alias and 'user_data' is used as the attribute name to keep backward
    compatibility.
    
    Wait for server to get into 'ACTIVE' state when creating a server
    and attribute 'wait' has been set to true.
    
    Sorted argument specs and documentation of the server module and
    marked attributes which are not updatable. Changed unstable bash
    script example in server module documentation.
    
    Renamed server's module attribute 'delete_fip' to 'delete_ips' to
    match openstacksdk and clarify that it includes all floating ip
    addresses of the server.
    
    Renamed server_info's module attribute 'server' to 'name' and added
    the former as an alias to be consistent with other *_info modules.
    
    Added RETURN fields documentation for the module results of both
    server and server_info modules.
    
    Added description and examples of how to use the 'filters' attribute
    of the server_info module. Closes story #2007873 [6].
    
    Removed 'openstack_' prefix from module results because the prefix is
    not consistently used across modules, is more to type without any
    benefit and removal of the prefix allows us to signal to users that
    their code for handling module results has to be updated. Many modules
    have different return values with openstacksdk >= 0.99.0 because it
    consistently uses resource proxies now.
    
    Added assertions for module results to catch future changes in the
    openstacksdk and our Ansible modules.
    
    Added integration tests to check the update mechanism of the server
    module.
    
    Fixed indentation in integration tests.
    
    Ensure proper creation and deletion of resources such as networks,
    subnets and servers in integration tests of server_action module.
    
    Renamed ci/roles/server/defaults/main.yaml to main.yml, removing the
    'a' in the file extension to be consistent with other filenames.
    
    Dropped deprecated function openstack_find_nova_addresses() and
    incorporated its code directly into the server module because it
    is not used anywhere else.
    
    [1] https://opendev.org/openstack/python-openstackclient/src/commit/e49ad1795b9dd57d5a82fb6f8f365fa20041cf29/openstackclient/compute/v2/server.py#L1070
    [2] https://storyboard.openstack.org/#!/story/2007893
    [3] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/_compute.py#L1772
    [4] https://opendev.org/openstack/openstacksdk/src/commit/9e9fc9879583943a08f854980cca5dfb3a5832f7/openstack/cloud/meta.py#L482
    [5] https://github.com/ansible/ansible/commit/9bf33e56dd49e9478ba091a1ba12d17b7caeac24
    [6] https://storyboard.openstack.org/#!/story/2007873
    
    
    
    Signed-off-by: default avatarJakob Meng <code@jakobmeng.de>
    Change-Id: I2f955519a7e8c782b1dab8f94f7a019ed384b81d