ovirt-ansible-collection icon indicating copy to clipboard operation
ovirt-ansible-collection copied to clipboard

"Follow" parameter in various oVirt modules returns html text instead of XML

Open IOMadness opened this issue 11 months ago • 0 comments

SUMMARY

When running an Ansible playbook against an oVirt cluster, and I use, for example, the ovirt.ovirt.ovirt_vm_info module, w/ the follow parameter w/ one of the appropriate struct values (i.e. nic.Nics https://ovirt.github.io/ovirt-engine-api-model/master/#types/vm/links_summary), I receive the following result:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ovirtsdk4.Error: The response content type 'text/html;charset=UTF-8' isn't the expected XML fatal: [localhost]: FAILED! => changed=false msg: The response content type 'text/html;charset=UTF-8' isn't the expected XML

COMPONENT NAME

This has occurred with the following modules that I've tested: ovirt.ovirt.ovirt_vm_info ovirt.ovirt.ovirt_nic_info ovirt.ovirt.ovirt_disk_info

STEPS TO REPRODUCE
Set up an oVirt cluster.

Set up a playbook in Ansible to get oVirt auth:
  - name: Obtain SSO token with using username/password credentials
    ovirt.ovirt.ovirt_auth:
      url: 'https://my-host.com/ovirt-engine/api'
      hostname: 'borg.arcc.uwyo.edu'
      username: "{{ ovirt_username }}"
      ca_file: "./conf/my-host.pem"
      password: "{{ ovirt_password }}"
      
Set up another play to pull and print VM info w/ ovirt_vm_info:
  - name: "Get a List of VMs on the Cluster"
    ovirt.ovirt.ovirt_vm_info:
      auth: "{{ ovirt_auth }}"
      pattern: name=my-vm
      next_run: true
      follow: ['nics.Nic', 'disk_attachments.DiskAttachment']
    register: vm_info

  - name: "Print VM Details"
    ansible.builtin.debug:
      msg: "{{ vm_info.ovirt_vms[0] }}"
      
 Create a ovirt_login.yml file w/ oVirt credentials
 
 Run playbooks from a master playbook:
- name: "Get Current VMs"
  hosts: localhost 
  tasks:
          - block:
                  - ansible.builtin.include_vars: ovirt_login.yml
                  - import_tasks: auth_gnt.yml
                  - import_tasks: get_vm_info.yml
                  #loop: "{{ exp_target }}"
            always:
                  - import_tasks: auth_rvk.yml
      
 Get error:
 An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ovirtsdk4.Error: The response content type 'text/html;charset=UTF-8' isn't the expected XML
fatal: [localhost]: FAILED! => changed=false 
  msg: The response content type 'text/html;charset=UTF-8' isn't the expected XML
  
  This ONLY happens when I put in the "follow" parameter. Ironically, the 'deprecated' "fetch_nested" parameter actually DOES work... so uh... that's nice.
      
EXPECTED RESULTS

The playbook should run the ovirt_vm_info module and pull all the nested attributes so I can see what disks and what nics are attached to what VM.

ACTUAL RESULTS
Again, only happens when including the "follow" parameter. Otherwise the module connects just fine to oVirt and pulls data just fine.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ovirtsdk4.Error: The response content type 'text/html;charset=UTF-8' isn't the expected XML
fatal: [localhost]: FAILED! => changed=false 
  msg: The response content type 'text/html;charset=UTF-8' isn't the expected XML

IOMadness avatar Jul 20 '23 22:07 IOMadness