Bug 1576934

Summary: Support register VMs and Templates when there are multiple data centers with duplicate vnic profile names and networks
Product: [oVirt] ovirt-ansible-collection Reporter: Maor <mlipchuk>
Component: disaster-recoveryAssignee: Maor <mlipchuk>
Status: CLOSED CURRENTRELEASE QA Contact: Kevin Alon Goldblatt <kgoldbla>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.1.4CC: ebenahar, tnisan
Target Milestone: ovirt-4.2.6Flags: rule-engine: ovirt-4.2+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-09-03 15:10:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Maor 2018-05-10 19:02:25 UTC
Description of problem:
On DR scenario when registering a VM/Template the mapping for vnic profile is being passed.
There could be multiple data centers with multiple default networks which contain the same name and vnic profile name.
In that case registering a VM will fail since we can not know which network is being referenced.
The validtor script currently supports duplicate vnic profiles, by obligating the user to indicate the data center names.
We need to use that data in ovirt ansible to filter it out on register of VM/Template

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1. Create 2 Data Centers
2. Use the same vnic profile on both (The default one)
3. Apply mapping which indicate those vnic profiles
3. Try to fail over

Actual results:
Registration will fail, since there are duplicate vnic profiles

Expected results:
The VM should be registered to the appropriate DC by its cluster mapping

Additional info:

Comment 1 Kevin Alon Goldblatt 2018-08-27 12:13:40 UTC
Verified with the following code:
-----------------------------------------
ovirt-engine-4.2.6-0.1.el7ev.noarch
vdsm-4.20.35-1.el7ev.x86_64
ovirt-ansible-disaster-recovery-1.1.1-1.el7ev.noarch


Verified with the following scenario:
-----------------------------------------
Steps to Reproduce:
1. Create 2 Data Centers
2. Use the same vnic profile on both (The default one)
3. Apply mapping which indicate those vnic profiles
3. Run fail over >>>>> The VM is registered to the appropriate DC by its cluster mapping



DR Mapping file VNIC entries:
-------------------------------------
dr_network_mappings:
- primary_network_name: ovirtmgmt
# Data Center name is relevant when multiple vnic profiles are maintained.
# please uncomment it in case you have more than one DC.
  primary_network_dc: DC2
  primary_profile_name: ovirtmgmt
  primary_profile_id: 095a7910-8960-4b20-a750-4ff9acb9fa36
  # Fill in the correlated vnic profile properties in the secondary site for profile 'ovirtmgmt'
  secondary_network_name: ovirtmgmt
# Data Center name is relevant when multiple vnic profiles are maintained.
# please uncomment it in case you have more than one DC.
  secondary_network_dc: DR_DC2
  secondary_profile_name: ovirtmgmt
  secondary_profile_id: 095a7910-8960-4b20-a750-4ff9acb9fa36

- primary_network_name: ovirtmgmt
# Data Center name is relevant when multiple vnic profiles are maintained.
# please uncomment it in case you have more than one DC.
  primary_network_dc: golden_env_mixed
  primary_profile_name: ovirtmgmt
  primary_profile_id: f8f4b82c-e7b2-4d4f-96aa-a82fc59e40a8
  # Fill in the correlated vnic profile properties in the secondary site for profile 'ovirtmgmt'
  secondary_network_name: ovirtmgmt
# Data Center name is relevant when multiple vnic profiles are maintained.
# please uncomment it in case you have more than one DC.
  secondary_network_dc: DR
  secondary_profile_name: ovirtmgmt
  secondary_profile_id: f8f4b82c-e7b2-4d4f-96aa-a82fc59e40a8



Source DB entries for VNIC
-------------------------------------
engine=# SELECT * FROM vnic_profiles;
                  id                  |   name    |              network_id              | port_mirroring | custom_properties | description |     
    _create_date          | _update_date | network_qos_id | passthrough |          network_filter_id           | migratable 
--------------------------------------+-----------+--------------------------------------+----------------+-------------------+-------------+-----
--------------------------+--------------+----------------+-------------+--------------------------------------+------------
 0000000a-000a-000a-000a-000000000398 | ovirtmgmt | 00000000-0000-0000-0000-000000000009 | f              |                   |             | 2015
-02-02 13:47:16.002849+02 |              |                | f           | 5b700999-01bf-0181-0147-00000000030c | f
 f8f4b82c-e7b2-4d4f-96aa-a82fc5vdsm-4.20.35-1.el7ev.x86_649e40a8 | ovirtmgmt | 7a67b46e-70f2-4849-984c-4720848be2bb | f              |                   |             | 2018
-08-12 13:27:48.195105+03 |              |                | f           | 5b700999-01bf-0181-0147-00000000030c | f
 095a7910-8960-4b20-a750-4ff9acb9fa36 | ovirtmgmt | 4d3868e7-bc9f-4799-aa3c-2281985bc7a4 | f              |                   |             | 2018
-08-23 15:19:29.628434+03 |              |                | f           | 5b700999-01bf-0181-0147-00000000030c | f
(3 rows)

engine=# SELECT * FROM vnic_profiles_view ;
                  id                  |   name    |              network_id              | network_qos_id | port_mirroring | passthrough | migrata
ble | custom_properties | description |          network_filter_id           | network_filter_name  | network_name | network_qos_name | data_cente
r_name | compatibility_version |            data_center_id            
--------------------------------------+-----------+--------------------------------------+----------------+----------------+-------------+--------
----+-------------------+-------------+--------------------------------------+----------------------+--------------+------------------+-----------
-------+-----------------------+--------------------------------------
 095a7910-8960-4b20-a750-4ff9acb9fa36 | ovirtmgmt | 4d3868e7-bc9f-4799-aa3c-2281985bc7a4 |                | f              | f           | f      
    |                   |             | 5b700999-01bf-0181-0147-00000000030c | vdsm-no-mac-spoofing | ovirtmgmt    |                  | DC2       
       | 4.2                   | a590bdcf-c26e-429d-b908-e98f76d3d21b
 f8f4b82c-e7b2-4d4f-96aa-a82fc59e40a8 | ovirtmgmt | 7a67b46e-70f2-4849-984c-4720848be2bb |                | f              | f           | f      
    |                   |             | 5b700999-01bf-0181-0147-00000000030c | vdsm-no-mac-spoofing | ovirtmgmt    |                  | golden_env
_mixed | 4.2                   | 9fa0f88f-f1b6-44ab-b269-bfc5a180da7b
 0000000a-000a-000a-000a-000000000398 | ovirtmgmt | 00000000-0000-0000-0000-000000000009 |                | f              | f           | f      
    |                   |             | 5b700999-01bf-0181-0147-00000000030c | vdsm-no-mac-spoofing | ovirtmgmt    |                  | Default   
       | 4.1                   | 5b700967-0346-0202-03a8-000000000278
(3 rows)


Target DB entries for VNIC
-----------------------------
engine=# SELECT * FROM vm_interface_view ;
 rx_rate | tx_rate | rx_drop | tx_drop | rx_total | tx_total | rx_offset | tx_offset | iface_status | sample_time | type | speed |     mac_addr   
   | network_name | name |           vnic_profile_id            |               vm_guid                | vmt_guid |       vm_name        |        
          id                  | boot_protocol | is_vds | is_plugged | custom_properties | port_mirroring | linked |              cluster_id       
       | vm_entity_type | vnic_profile_name | qos_name 
---------+---------+---------+---------+----------+----------+-----------+-----------+--------------+-------------+------+-------+----------------
---+--------------+------+--------------------------------------+--------------------------------------+----------+----------------------+--------
------------------------------+---------------+--------+------------+-------------------+----------------+--------+-------------------------------
-------+----------------+-------------------+----------
         |         |         |         |          |          |           |           |              |             |    3 | 10000 | 00:1a:4a:16:01:
04 | ovirtmgmt    | nic1 | 35b9d7b8-a23e-4005-9b53-5b6db404e784 | 3e18a3be-88c6-42b9-bd30-16f05ee69a80 |          | vm_nfs_dr_thin_01    | eff09ba
3-f271-497f-b64d-6c1172c4c9a6 |             0 |      0 | t          |                   | f              | t      | 6087fac2-0947-493b-bc9b-525d7b
9cb93f | VM             | ovirtmgmt         | 
         |         |         |         |          |          |           |           |              |             |    3 | 10000 | 00:1a:4a:16:01:
05 | ovirtmgmt    | nic1 | 35b9d7b8-a23e-4005-9b53-5b6db404e784 | 681b1e80-9f6f-4010-8b12-4c94f09bb299 |          | vm_nfs_dr_prealloc_1 | 25c435f
0-d662-466e-b477-7f4b573797d5 |             0 |      0 | t          |                   | f              | t      | 6087fac2-0947-493b-bc9b-525d7b
9cb93f | VM             | ovirtmgmt         | 
         |         |         |         |          |          |           |           |              |             |    3 | 10000 | 00:1a:4a:16:01:
06 | ovirtmgmt    | nic1 | d405d61b-e824-4f7e-9625-feae39791696 | 401ec113-79b6-4edc-af87-29689f1709af |          | vm_dc2_block         | d743397
6-8b92-4493-af54-b9d5cf3d8e8d |             0 |      0 | t          |                   | f              | t      | b9f945ec-c1f0-4e2d-90b2-7787a2
32410e | VM             | ovirtmgmt         | 
(3 rows)

Moving to VERIFIED