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

Using the same profile name in multiple clusters will cause creating VMs that use that network name to fail #20246

Closed
fabianvf opened this issue Jan 13, 2017 · 2 comments
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module.

Comments

@fabianvf
Copy link
Contributor

ISSUE TYPE
  • Bug Report
COMPONENT NAME

ovirt_vms

ANSIBLE VERSION
$  ansible --version
ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

CONFIGURATION

[ssh_connection]
ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no

OS / ENVIRONMENT

RHEL 7.3, managing RHEL 7.3

SUMMARY

If you have a RHV/ovirt installation with the Default/Default datacenter and cluster, with the default ovirtmgmt network, and create a second datacenter/cluster, also with the default ovirtmgmt network, you cannot create VMs in the second cluster. This is because the ovirt_vms module does a lookup by name for the network, and returns the first result, so if you have network names that conflict across clusters your VM will try to attach to a network not in the correct cluster.

STEPS TO REPRODUCE

Assuming a RHV installation where you have already created the Default/Default and Custom/Custom datacenters/clusters, with hosts/storage domains/etc configured.

---

- hosts: engine
  remote_user: root
  tasks:
    - name: authenticate to engine
      ovirt_auth:
        username: '{{ engine_username }}'
        password: '{{ admin_password }}'
        url: https://{{ engine_fqdn }}/ovirt-engine/api
        insecure: true

    - name: create vm
      ovirt_vms:
        name: test
        cluster: Custom
        memory: 2GiB
        memory_guaranteed: 2GiB
        cpu_cores: 2
        nics:
          - name: eth0
            profile_name: ovirtmgmt
            interface: virtio
        state: stopped
        wait: true
        auth: '{{ ovirt_auth }}'
EXPECTED RESULTS

A VM named test should come up in the Custom cluster with a nic with the ovirtmgmt profile

ACTUAL RESULTS
Using /home/fabian/code/redhat/rhci/ansible-ovirt/ansible.cfg as config file
Loading callback plugin default of type stdout, v2.0 from /home/fabian/Envs/ansible/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc

PLAYBOOK: play.yml *************************************************************
1 plays in play.yml

PLAY [engine] ******************************************************************

TASK [setup] *******************************************************************
Using module file /home/fabian/Envs/ansible/lib/python2.7/site-packages/ansible/modules/core/system/setup.py
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r x1.example.org '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1484341736.91-132945011824945 `" && echo ansible-tmp-1484341736.91-132945011824945="` echo $HOME/.ansible/tmp/ansible-tmp-1484341736.91-132945011824945 `" ) && sleep 0'"'"''
<x1.example.org> PUT /tmp/fabian/tmpmm9OHX TO /root/.ansible/tmp/ansible-tmp-1484341736.91-132945011824945/setup.py
<x1.example.org> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r '[x1.example.org]'
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r x1.example.org '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1484341736.91-132945011824945/ /root/.ansible/tmp/ansible-tmp-1484341736.91-132945011824945/setup.py && sleep 0'"'"''
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r -tt x1.example.org '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1484341736.91-132945011824945/setup.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1484341736.91-132945011824945/" > /dev/null 2>&1 && sleep 0'"'"''
ok: [x1.example.org]

TASK [authenticate to engine] **************************************************
task path: /home/fabian/code/redhat/rhci/ansible-ovirt/play.yml:8
Using module file /home/fabian/Envs/ansible/lib/python2.7/site-packages/ansible/modules/extras/cloud/ovirt/ovirt_auth.py
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r x1.example.org '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1484341737.55-63513034438551 `" && echo ansible-tmp-1484341737.55-63513034438551="` echo $HOME/.ansible/tmp/ansible-tmp-1484341737.55-63513034438551 `" ) && sleep 0'"'"''
<x1.example.org> PUT /tmp/fabian/tmpAvv1m4 TO /root/.ansible/tmp/ansible-tmp-1484341737.55-63513034438551/ovirt_auth.py
<x1.example.org> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r '[x1.example.org]'
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r x1.example.org '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1484341737.55-63513034438551/ /root/.ansible/tmp/ansible-tmp-1484341737.55-63513034438551/ovirt_auth.py && sleep 0'"'"''
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r -tt x1.example.org '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1484341737.55-63513034438551/ovirt_auth.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1484341737.55-63513034438551/" > /dev/null 2>&1 && sleep 0'"'"''
ok: [x1.example.org] => {
    "ansible_facts": {
        "ovirt_auth": {
            "ca_file": null, 
            "compress": true, 
            "insecure": true, 
            "kerberos": false, 
            "timeout": 0, 
            "token": "U-sPRqQgLSq0sPs6fpVx8nWocTq2ySe4dmPvtcfVbyH5Lxndq45J4qm61xu63sfUBQwxHA6EwBhdWAJJz8mJ8g", 
            "url": "https://x1.example.org/ovirt-engine/api"
        }
    }, 
    "changed": false, 
    "invocation": {
        "module_args": {
            "ca_file": null, 
            "compress": true, 
            "insecure": true, 
            "kerberos": false, 
            "ovirt_auth": null, 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "state": "present", 
            "timeout": 0, 
            "url": "https://x1.example.org/ovirt-engine/api", 
            "username": "admin@internal"
        }, 
        "module_name": "ovirt_auth"
    }
}

TASK [create vm] ***************************************************************
task path: /home/fabian/code/redhat/rhci/ansible-ovirt/play.yml:15
Using module file /home/fabian/Envs/ansible/lib/python2.7/site-packages/ansible/modules/extras/cloud/ovirt/ovirt_vms.py
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r x1.example.org '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1484341738.25-102817380964459 `" && echo ansible-tmp-1484341738.25-102817380964459="` echo $HOME/.ansible/tmp/ansible-tmp-1484341738.25-102817380964459 `" ) && sleep 0'"'"''
<x1.example.org> PUT /tmp/fabian/tmpzfNZ1r TO /root/.ansible/tmp/ansible-tmp-1484341738.25-102817380964459/ovirt_vms.py
<x1.example.org> SSH: EXEC sftp -b - -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r '[x1.example.org]'
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r x1.example.org '/bin/sh -c '"'"'chmod u+x /root/.ansible/tmp/ansible-tmp-1484341738.25-102817380964459/ /root/.ansible/tmp/ansible-tmp-1484341738.25-102817380964459/ovirt_vms.py && sleep 0'"'"''
<x1.example.org> ESTABLISH SSH CONNECTION FOR USER: root
<x1.example.org> SSH: EXEC ssh -vvv -C -o ControlMaster=auto -o ControlPersist=60s -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o 'IdentityFile="/usr/share/vagrant/keys/vagrant"' -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=root -o ConnectTimeout=10 -o ControlPath=/home/fabian/.ansible/cp/ansible-ssh-%h-%p-%r -tt x1.example.org '/bin/sh -c '"'"'/usr/bin/python /root/.ansible/tmp/ansible-tmp-1484341738.25-102817380964459/ovirt_vms.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1484341738.25-102817380964459/" > /dev/null 2>&1 && sleep 0'"'"''
ok: [x1.example.org] => {
    "changed": false, 
    "id": "d3bf2a12-4667-41e7-8a4a-a08b0d06675c", 
    "invocation": {
        "module_args": {
            "boot_devices": null, 
            "cd_iso": null, 
            "clone": false, 
            "clone_permissions": false, 
            "cloud_init": null, 
            "cluster": "Custom", 
            "cpu_cores": 2, 
            "cpu_shares": null, 
            "cpu_sockets": null, 
            "delete_protected": null, 
            "disks": [], 
            "force": false, 
            "high_availability": null, 
            "host": null, 
            "id": null, 
            "memory": "2GiB", 
            "memory_guaranteed": "2GiB", 
            "name": "test", 
            "nics": [
                {
                    "interface": "virtio", 
                    "name": "eth0", 
                    "profile_name": "ovirtmgmt"
                }
            ], 
            "operating_system": null, 
            "poll_interval": 3, 
            "state": "stopped", 
            "stateless": null, 
            "sysprep": null, 
            "template": null, 
            "timeout": 180, 
            "type": null, 
            "wait": true
        }, 
        "module_name": "ovirt_vms"
    }, 
    "vm": {
        "affinity_labels": [], 
        "applications": [], 
        "bios": {
            "boot_menu": {
                "enabled": false
            }
        }, 
        "cdroms": [], 
        "cluster": {
            "href": "/ovirt-engine/api/clusters/b2156b97-cf49-416a-8c75-83f069087552", 
            "id": "b2156b97-cf49-416a-8c75-83f069087552"
        }, 
        "cpu": {
            "architecture": "x86_64", 
            "topology": {
                "cores": 2, 
                "sockets": 1, 
                "threads": 1
            }
        }, 
        "cpu_profile": {
            "href": "/ovirt-engine/api/cpuprofiles/a84f7c54-079c-489a-9988-1e2b1fc89be8", 
            "id": "a84f7c54-079c-489a-9988-1e2b1fc89be8"
        }, 
        "cpu_shares": 0, 
        "creation_time": "2017-01-13 21:07:56.962000+00:00", 
        "delete_protected": false, 
        "disk_attachments": [], 
        "display": {
            "allow_override": false, 
            "copy_paste_enabled": true, 
            "disconnect_action": "LOCK_SCREEN", 
            "file_transfer_enabled": true, 
            "monitors": 1, 
            "single_qxl_pci": false, 
            "smartcard_enabled": false, 
            "type": "spice"
        }, 
        "graphics_consoles": [], 
        "high_availability": {
            "enabled": false, 
            "priority": 0
        }, 
        "host_devices": [], 
        "href": "/ovirt-engine/api/vms/d3bf2a12-4667-41e7-8a4a-a08b0d06675c", 
        "id": "d3bf2a12-4667-41e7-8a4a-a08b0d06675c", 
        "io": {
            "threads": 0
        }, 
        "katello_errata": [], 
        "large_icon": {
            "href": "/ovirt-engine/api/icons/488feec3-1b70-4489-b72b-04f5db6afe9c", 
            "id": "488feec3-1b70-4489-b72b-04f5db6afe9c"
        }, 
        "memory": 2147483648, 
        "memory_policy": {
            "ballooning": true, 
            "guaranteed": 2147483648
        }, 
        "migration": {
            "auto_converge": "inherit", 
            "compressed": "inherit"
        }, 
        "migration_downtime": -1, 
        "name": "test", 
        "next_run_configuration_exists": false, 
        "nics": [], 
        "numa_nodes": [], 
        "numa_tune_mode": "interleave", 
        "origin": "ovirt", 
        "os": {
            "boot": {
                "devices": [
                    "hd"
                ]
            }, 
            "type": "other"
        }, 
        "permissions": [], 
        "placement_policy": {
            "affinity": "migratable"
        }, 
        "reported_devices": [], 
        "sessions": [], 
        "small_icon": {
            "href": "/ovirt-engine/api/icons/9b9b954d-5a8c-4e61-8b8a-3544b0ad8770", 
            "id": "9b9b954d-5a8c-4e61-8b8a-3544b0ad8770"
        }, 
        "snapshots": [], 
        "sso": {
            "methods": [
                {
                    "id": "guest_agent"
                }
            ]
        }, 
        "start_paused": false, 
        "stateless": false, 
        "statistics": [], 
        "status": "down", 
        "stop_time": "2017-01-13 21:07:56.969000+00:00", 
        "tags": [], 
        "template": {
            "href": "/ovirt-engine/api/templates/00000000-0000-0000-0000-000000000000", 
            "id": "00000000-0000-0000-0000-000000000000"
        }, 
        "time_zone": {
            "name": "Etc/GMT"
        }, 
        "type": "desktop", 
        "usb": {
            "enabled": false
        }, 
        "watchdogs": []
    }
}

PLAY RECAP *********************************************************************
x1.example.org             : ok=3    changed=0    unreachable=0    failed=0   


@ansibot
Copy link
Contributor

ansibot commented Jan 13, 2017

@ansibot ansibot added affects_2.2 This issue/PR affects Ansible v2.2 bug_report cloud module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Jan 13, 2017
@alikins alikins removed the needs_triage Needs a first human triage before being processed. label Jan 16, 2017
machacekondra added a commit to machacekondra/ansible that referenced this issue Jan 18, 2017
This patch add additional filtering of VNIC profiles by the cluster
parameter. It is a must, because there could be same names of the
VNIC profiles in system, as every datacenter can have VNIC profile
same name, which can be in other datacenter.

This patch fixes issue ansible#20246
@machacekondra
Copy link
Contributor

machacekondra commented Jan 18, 2017

resolved_by #20384

ryansb pushed a commit that referenced this issue Jan 18, 2017
This patch add additional filtering of VNIC profiles by the cluster
parameter. It is a must, because there could be same names of the
VNIC profiles in system, as every datacenter can have VNIC profile
same name, which can be in other datacenter.

This patch fixes issue #20246
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.2 This issue/PR affects Ansible v2.2 bug This issue/PR relates to a bug. cloud module This issue/PR relates to a module.
Projects
None yet
Development

No branches or pull requests

5 participants