Skip to content

[vmware_guest_serial_port] Incorrect error message while removing a serial device  #1234

Open
@keirazhang

Description

@keirazhang
SUMMARY

While removing a serial device from VM and VM is powered-on, it returned message "A serial device cannot be added to a VM in the current state(poweredOn). ". It should be "A serial device cannot be removed from a VM in the current state(poweredOn).

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "backings": [
                {
                    "backing_type": "file",
                    "device_name": null,
                    "direction": "client",
                    "endpoint": "client",
                    "file_path": "[datastore2] test_vm-2/serial-20220224024048.log",
                    "no_rx_loss": false,
                    "pipe_name": null,
                    "service_uri": null,
                    "state": "absent",
                    "type": "file",
                    "yield_on_poll": true
                }
            ],
            "hostname": "10.180.193.39",
            "moid": null,
            "name": "test_vm-2",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 443,
            "proxy_host": null,
            "proxy_port": null,
            "use_instance_uuid": false,
            "username": "[email protected]",
            "uuid": null,
            "validate_certs": false
        }
    },
    "msg": "A serial device cannot be added to a VM in the current state(poweredOn). Please use the vmware_guest_powerstate module to power off the VM"
}
ISSUE TYPE
  • Bug Report
COMPONENT NAME

vmware_guest_serial_port

ANSIBLE VERSION
 "ansible [core 2.12.1]",
        "  config file = /home/worker/workspace/Ansible_Ubuntu_LTS_Server_OVA_67GA/ansible-vsphere-gos-validation/ansible.cfg",
        "  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']",
        "  ansible python module location = /usr/lib/python3.9/site-packages/ansible",
        "  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections",
        "  executable location = /usr/bin/ansible",
        "  python version = 3.9.1 (default, Aug 19 2021, 02:58:42) [GCC 10.2.0]",
        "  jinja version = 3.0.1",
        "  libyaml = True"
COLLECTION VERSION
"# /root/.ansible/collections/ansible_collections",
        "Collection        Version",
        "----------------- -------",
        "ansible.netcommon 2.5.0  ",
        "ansible.posix     1.3.0  ",
        "ansible.utils     2.4.3  ",
        "ansible.windows   1.9.0  ",
        "community.crypto  2.1.0  ",
        "community.general 4.3.0  ",
        "community.vmware  2.0.0  ",
        "community.windows 1.9.0  "
CONFIGURATION
        "CALLBACKS_ENABLED(/home/worker/workspace/Ansible_Ubuntu_LTS_Server_OVA_67GA/ansible-vsphere-gos-validation/ansible.cfg) = ['timer']",
        "DEFAULT_CALLBACK_PLUGIN_PATH(/home/worker/workspace/Ansible_Ubuntu_LTS_Server_OVA_67GA/ansible-vsphere-gos-validation/ansible.cfg) = ['/home/worker/workspace/Ansible_Ubuntu_LTS_Server_OVA_67GA/ansible-vsphere-gos-validation/plugin']",
        "DISPLAY_SKIPPED_HOSTS(/home/worker/workspace/Ansible_Ubuntu_LTS_Server_OVA_67GA/ansible-vsphere-gos-validation/ansible.cfg) = False",
        "RETRY_FILES_ENABLED(/home/worker/workspace/Ansible_Ubuntu_LTS_Server_OVA_67GA/ansible-vsphere-gos-validation/ansible.cfg) = False"
OS / ENVIRONMENT
STEPS TO REPRODUCE
- name: "Remove a serial port using output file"
  vmware_guest_serial_port:
    hostname: "{{ vsphere_host_name }}"
    username: "{{ vsphere_host_user }}"
    password: "{{ vsphere_host_user_password }}"
    validate_certs: "{{ validate_certs | default(False) }}"
    name: "{{ vm_name }}"
    backings:
      - type: "file"
        file_path: "{{ vm_serial_port_file_path }}"
        state: absent
  register: remove_serial_port
EXPECTED RESULTS

Expected correct error message.

ACTUAL RESULTS

Incorrect message

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue/PR relates to a bugneeds_triageNeeds a first human triage before being processed.python3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions