Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zhmc_partition shows changed even though partition already existed #54

Open
scheuran opened this issue Sep 27, 2018 · 2 comments
Open

Comments

@scheuran
Copy link
Contributor

I'm using the zhmc_partition module like this

- name: Ensure partition {{ params.name }} exists and is stopped
  zhmc_partition:
    hmc_host: "{{ endpoints.HMC.ip }}"
    hmc_auth:
      userid: "{{ credentials.HMC.user }}"
      password: "{{ credentials.HMC.password }}"
    cpc_name: "{{ endpoints[params.cpc].name }}"
    name: '{{ params.name }}'
    state: stopped
    properties:
      type: "ssc"
      description: "Foo partition"
      ifl_processors: "{{ params.ifl }}"
      initial_memory: "{{ params.memory_initial_mb }}"
      maximum_memory: "{{ params.memory_max_mb | default(params.memory_initial_mb)}}"
      processor_mode: "shared"
      initial_ifl_processing_weight: "{{ params.ifl_weight }}"
      ssc_host_name: "fixme"
      ssc_ipv4_gateway: "{{ params.default_gateway }}"
      ssc_master_userid: "{{ params.ssc.ssc_user }}"
      ssc_master_pw: "{{ params.ssc.ssc_password }}"
      # ssc_dns_servers: "FIXME"
  register: part1

Creation works fine, but executing the playbook a second time, it is still showing the "changed=True", even though no changes should have occurred!

I'm working on a new z14 machine with DPM3.1 installed.

Verbose output

TASK [partition : Ensure partition test-partition exists and is stopped] *************************************************************************************************************************************************************
task path: /Users/scheuran/git/colo/datacenter-automation/playbooks/roles/partition/tasks/main.yml:17
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: scheuran
<127.0.0.1> EXEC /bin/sh -c 'echo ~scheuran && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/scheuran/.ansible/tmp/ansible-tmp-1538030522.5-13084542450754 `" && echo ansible-tmp-1538030522.5-13084542450754="` echo /Users/scheuran/.ansible/tmp/ansible-tmp-1538030522.5-13084542450754 `" ) && sleep 0'
Using module file /Users/scheuran/git/colo/datacenter-automation/.tox/end2end/lib/python2.7/site-packages/zhmc_ansible_modules/zhmc_partition.py
<127.0.0.1> PUT /Users/scheuran/.ansible/tmp/ansible-local-32229Mhd_tW/tmpZyO5Yo TO /Users/scheuran/.ansible/tmp/ansible-tmp-1538030522.5-13084542450754/zhmc_partition.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/scheuran/.ansible/tmp/ansible-tmp-1538030522.5-13084542450754/ /Users/scheuran/.ansible/tmp/ansible-tmp-1538030522.5-13084542450754/zhmc_partition.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/Users/scheuran/git/colo/datacenter-automation/.tox/end2end/bin/python /Users/scheuran/.ansible/tmp/ansible-tmp-1538030522.5-13084542450754/zhmc_partition.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/scheuran/.ansible/tmp/ansible-tmp-1538030522.5-13084542450754/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true, 
    "invocation": {
        "module_args": {
            "cpc_name": "P00M218M", 
            "faked_session": null, 
            "hmc_auth": {
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
                "userid": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER"
            }, 
            "hmc_host": "<some-ip>", 
            "name": "test-partition", 
            "properties": {
                "description": "Colo dev partition", 
                "ifl_processors": "5", 
                "initial_ifl_processing_weight": "50", 
                "initial_memory": "4096", 
                "maximum_memory": "4096", 
                "processor_mode": "shared", 
                "ssc_host_name": "fixme", 
                "ssc_ipv4_gateway": "1.2.3.4", 
                "ssc_master_pw": "testpass", 
                "ssc_master_userid": "testuser", 
                "type": "ssc"
            }, 
            "state": "stopped"
        }
    }, 
    "partition": {
        "acceptable-status": [
            "active"
        ], 
        "access-basic-counter-set": false, 
        "access-basic-sampling": false, 
        "access-coprocessor-group-set": false, 
        "access-crypto-activity-counter-set": false, 
        "access-diagnostic-sampling": false, 
        "access-extended-counter-set": false, 
        "access-global-performance-data": false, 
        "access-problem-state-counter-set": false, 
        "auto-start": false, 
        "autogenerate-partition-id": true, 
        "available-features-list": [
            {
                "description": "The DPM storage management approach in which FCP and FICON storage resources are defined in Storage Groups, which are attached to Partitions.", 
                "name": "dpm-storage-management", 
                "state": true
            }
        ], 
        "boot-configuration-selector": 0, 
        "boot-device": "none", 
        "boot-ftp-host": null, 
        "boot-ftp-insfile": null, 
        "boot-ftp-username": null, 
        "boot-iso-image-name": null, 
        "boot-iso-ins-file": null, 
        "boot-logical-unit-number": "", 
        "boot-network-device": null, 
        "boot-os-specific-parameters": "", 
        "boot-record-lba": "0", 
        "boot-removable-media": null, 
        "boot-removable-media-type": null, 
        "boot-storage-device": null, 
        "boot-storage-volume": null, 
        "boot-timeout": 60, 
        "boot-world-wide-port-name": "", 
        "class": "partition", 
        "cp-absolute-processor-capping": false, 
        "cp-absolute-processor-capping-value": 1.0, 
        "cp-processing-weight-capped": false, 
        "cp-processors": 0, 
        "crypto-configuration": null, 
        "current-cp-processing-weight": 1, 
        "current-ifl-processing-weight": 1, 
        "degraded-adapters": [], 
        "description": "Colo dev partition", 
        "has-unacceptable-status": true, 
        "hba-uris": [], 
        "ifl-absolute-processor-capping": false, 
        "ifl-absolute-processor-capping-value": 1.0, 
        "ifl-processing-weight-capped": false, 
        "ifl-processors": 5, 
        "initial-cp-processing-weight": 100, 
        "initial-ifl-processing-weight": 50, 
        "initial-memory": 4096, 
        "ipl-load-parameter": "", 
        "is-locked": false, 
        "maximum-cp-processing-weight": 999, 
        "maximum-ifl-processing-weight": 999, 
        "maximum-memory": 4096, 
        "minimum-cp-processing-weight": 1, 
        "minimum-ifl-processing-weight": 1, 
        "name": "test-partition", 
        "nic-uris": [
            "/api/partitions/08a1f38a-c0e1-11e8-9f5a-00106f0ddbc9/nics/712add54-c0f5-11e8-97ce-00106f0ddbc9", 
            "/api/partitions/08a1f38a-c0e1-11e8-9f5a-00106f0ddbc9/nics/d1fdefb6-c0fc-11e8-af42-00106f0ddbc9"
        ], 
        "object-id": "08a1f38a-c0e1-11e8-9f5a-00106f0ddbc9", 
        "object-uri": "/api/partitions/08a1f38a-c0e1-11e8-9f5a-00106f0ddbc9", 
        "os-name": "", 
        "os-type": "", 
        "os-version": "", 
        "parent": "/api/cpcs/e3d98452-fcf9-3325-8ee2-a44f19cd33c9", 
        "partition-id": null, 
        "permit-aes-key-import-functions": true, 
        "permit-cross-partition-commands": false, 
        "permit-des-key-import-functions": true, 
        "processor-management-enabled": false, 
        "processor-mode": "shared", 
        "reserve-resources": false, 
        "reserved-memory": 0, 
        "short-name": "TESTPART", 
        "ssc-boot-selection": "installer", 
        "ssc-dns-servers": [], 
        "ssc-host-name": "fixme", 
        "ssc-ipv4-gateway": "1.2.3.4", 
        "ssc-ipv6-gateway": null, 
        "ssc-master-userid": "sscadmin", 
        "status": "stopped", 
        "storage-group-uris": [], 
        "threads-per-processor": 1, 
        "type": "ssc", 
        "virtual-function-uris": []
    }
}


@andy-maier
Copy link
Member

I analyzed the issue,. and it turns out that the "Get Partition Properties" operation (rightfully) does not return the "ssc-master-pw" property. This is documented in the HMC WS API book. The zhmc ansible module then compares the input properties, which specify a value for the "ssc-master-pw" property with the properties returned and determines that an update needs to be made. This update (rightfully) causes the changed flag to be set.

The root problem is that the password is not coming back, so it is not possible for the zhmc ansible module to find out that no update is actually needed. Of course, we could special-case this property, but it is not clear what we should special-case it to. Sometimes the password is already as desired, and the module does not know, and sometimes there is a need to set it as desired. These two cases are not distinguishable by the module.

Some options I can see, are:

  1. No change from current code - setting the ssc master password is possible but triggers the changed flag even if it already had the desired value.
  2. Don't set the changed flag when updating the "ssc-master-pw" property. This allows setting the ssc master password, but does not correctly report back the change of the password if there was a change.
  3. No longer allow setting the "ssc-master-pw" property as a property in the "stopped" etc states, but provide a special state "set_password" for that. That would cause the other states to correctly report the changed flag, and would narrow the imprecision about the changed flag to just that one property.

@andy-maier andy-maier self-assigned this Sep 27, 2018
@andy-maier andy-maier added this to the 0.5.0 milestone Sep 27, 2018
@andy-maier andy-maier modified the milestones: 0.5.0, 0.6.0 Oct 24, 2018
@andy-maier andy-maier modified the milestones: 0.6.0, 0.7.0 Jan 7, 2019
@andy-maier
Copy link
Member

Proposal: Go with option 3, abovbe.

@andy-maier andy-maier modified the milestones: 0.7.0, 0.8.0 Feb 20, 2019
@andy-maier andy-maier modified the milestones: 0.8.0, 0.9.0 Apr 2, 2019
@andy-maier andy-maier removed this from the 1.0.0 milestone Oct 15, 2020
@andy-maier andy-maier removed their assignment Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants