[ovirt-users] multiple NICs VLAN ID conflict

Edward Haas ehaas at redhat.com
Thu Mar 17 07:56:13 UTC 2016


On Thu, Mar 17, 2016 at 2:14 AM, Bill James <bill.james at j2.com> wrote:
> I  tried based on this url: (based on
> https://github.com/oVirt/vdsm/blob/master/vdsm_hooks/extra_ipv4_addrs/extra_ipv4_addrs.py_)
> It seems to work ok, but the ovirt gui says the network is out of sync.
> So I can't add any more networks to that interface.  :-(

That's because you need to fake it back as well, otherwise Engine
complains that what it requested is not what exists.
So you need another two hooks: after_get_caps and after_get_stats
Please look at these two:
https://github.com/oVirt/vdsm/blob/master/vdsm_hooks/ovs/ovs_after_get_caps.py
https://github.com/oVirt/vdsm/blob/master/vdsm_hooks/ovs/ovs_after_get_stats.py

To see what you need to change, issue the two reports on your host:
# vdsClient -s 0 getVdsCaps
# vdsClient -s 0 getVdsStats

>
> If I try detaching the "custom" network I get an error:
> So obviously I'm missing something.

Please send us vdsm logs: vdsm.log and supervdsm.log

>
> 2016-03-16 17:09:17,948 WARN
> [org.ovirt.engine.core.vdsbroker.vdsbroker.HostSetupNetworksVDSCommand]
> (default task-49) [77dc0af6] Unexpected return value: StatusForXmlRpc
> [code=-32603, message=Internal JSON-RPC error.]
> 2016-03-16 17:09:17,948 ERROR
> [org.ovirt.engine.core.vdsbroker.vdsbroker.HostSetupNetworksVDSCommand]
> (default task-49) [77dc0af6] Failed in 'HostSetupNetworksVDS' method
> 2016-03-16 17:09:17,962 ERROR
> [org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogDirector]
> (default task-49) [77dc0af6] Correlation ID: null, Call Stack: null, Custom
> Event ID: -1, Message: VDSM ovirt2.test.j2noc.com command failed: Internal
> JSON-RPC error.
> 2016-03-16 17:09:17,962 ERROR
> [org.ovirt.engine.core.vdsbroker.vdsbroker.HostSetupNetworksVDSCommand]
> (default task-49) [77dc0af6] Error: VDSGenericException: VDSErrorException:
> Failed to HostSetupNetworksVDS, error = Internal JSON-RPC error., code =
> -32603
> 2016-03-16 17:09:17,962 ERROR
> [org.ovirt.engine.core.vdsbroker.vdsbroker.HostSetupNetworksVDSCommand]
> (default task-49) [77dc0af6] Exception:
> org.ovirt.engine.core.vdsbroker.vdsbroker.VDSErrorException:
> VDSGenericException: VDSErrorException: Failed to HostSetupNetworksVDS,
> error = Internal JSON-RPC error., code = -32603
>         at
> org.ovirt.engine.core.vdsbroker.vdsbroker.VdsBrokerCommand.createDefaultConcreteException(VdsBrokerCommand.java:75)
> [vdsbroker.jar:]
>         at
> org.ovirt.engine.core.vdsbroker.vdsbroker.BrokerCommandBase.createException(BrokerCommandBase.java:211)
> [vdsbroker.jar:]
> ...
> 2016-03-16 17:09:17,973 ERROR
> [org.ovirt.engine.core.vdsbroker.vdsbroker.HostSetupNetworksVDSCommand]
> (default task-49) [77dc0af6] Command 'HostSetupNetworksVDSCommand(HostName =
> ovirt2.test.j2noc.com,
> HostSetupNetworksVdsCommandParameters:{runAsync='true',
> hostId='7cd16015-609f-47ce-9ea2-d9c1e83769e0',
> vds='Host[ovirt2.test.j2noc.com,7cd16015-609f-47ce-9ea2-d9c1e83769e0]',
> rollbackOnFailure='true', conectivityTimeout='120',
> hostNetworkQosSupported='true', networks='[]', removedNetworks='[V10_dev]',
> bonds='[]', removedBonds='[]'})' execution failed: VDSGenericException:
> VDSErrorException: Failed to HostSetupNetworksVDS, error = Internal JSON-RPC
> error., code = -32603
> 2016-03-16 17:09:17,973 ERROR
> [org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand] (default
> task-49) [77dc0af6] Command
> 'org.ovirt.engine.core.bll.network.host.HostSetupNetworksCommand' failed:
> EngineException:
> org.ovirt.engine.core.vdsbroker.vdsbroker.VDSErrorException:
> VDSGenericException: VDSErrorException: Failed to HostSetupNetworksVDS,
> error = Internal JSON-RPC error., code = -32603 (Failed with error
> unexpected and code 16)
>
>
>
>
> My hook script, please excuse the poor scripting since this is my first
> python script.

I would suggest posting a patch on gerrit (https://gerrit.ovirt.org),
check http://www.ovirt.org/develop/dev-process/working-with-gerrit/

>
>
> #!/usr/bin/env python
> """
>     Tweak an interface defintion so that it uses an alternate port group.
>     It applies on a per vnic basis, it gets triggered and used by event:
>         * before_network_setup
>
>     This hook can be used to  allow multiple NICs with same VLAN ID
>     in case they are used on multiple hardware NICs.
>         From:
> http://lists.ovirt.org/pipermail/users/2014-November/029227.html
> """
>
>
> import os
> import hooking
> import sys
> import traceback
> import xml.dom
>
>
>
> HOOK_NAME = 'extnet_pg'
>
> target = open("/tmp/fake_vlan.out",'w')
>
> def main():
>     setup_nets_config = hooking.read_json()
>     for network, attrs in setup_nets_config['request']['networks'].items():
>         target.write("bbb for in fake: %s, %s\n" % (network,attrs))
>         if 'vlan' in attrs:
>             target.write("bbb custom in fake\n")
>             #_process_network(network, attrs)
>             vlanid = int(attrs['vlan'])
>             target.write("bbb fake vlanid= %s\n" % vlanid)
>             if vlanid > 900:
>                 newid = vlanid - 900
>                 attrs['vlan'] = newid
>                 target.write("bbb fake newid= %s\n" % newid)
>                 hooking.write_json(setup_nets_config)
>
>
> def _process_network(network, attrs):
>         """ Changes vlan id if > 900 """
>         vlanid = int(attrs['vlan'])
>         #vlanid = int(filter(str.isdigit, port_group))
>         target.write("bbb fake vlanid= %s\n" % vlanid)
>         if vlanid > 900:
>             newid = vlanid - 900
>             attrs['vlan'] = newid
>             target.write("bbb fake newid= %s\n" % newid)
>             hooking.write_json(setup_nets_config)
>
>
> def test():
>         print "do some test here"
>
> if __name__ == '__main__':
>         try:
>             if '--test' in sys.argv:
>                 test()
>             else:
>                 main()
>         except:
>             hooking.exit_hook('extnet hook: [unexpected error]: %s\n' %
>                               traceback.format_exc())
>
>
>
>
>
>
> On 03/16/2016 01:17 AM, Edward Haas wrote:
>>
>> On Tue, Mar 15, 2016 at 8:19 PM, Bill James <bill.james at j2.com> wrote:
>>>
>>> thank you very much for the reply.
>>> I'm trying to find more about how to setup a 'fake vlan id', but so far
>>> have
>>> not been able to find anything.  The link you mentioned mentioned a link
>>> about setup_network_hooks, but the link doesn't work any more.
>>>
>>> I have found there is a directory called
>>> /usr/libexec/vdsm/hooks/before_network_setup.
>>>
>>> This doc
>>> http://www.ovirt.org/develop/developer-guide/vdsm/hook/network-nat/
>>> suggests using "sudo engine-config -s CustomDeviceProperties"
>>> but I haven't found any descriptions on how to use it.
>>> This doc goes into a little detail:
>>>
>>>
>>> http://200.1.19.60/ovirt-engine/docs/manual/en_US/html/Administration_Guide/VDSM_hooks_defining_custom_properties.html
>>
>> It's not a must to use the custom properties in your case, although it
>> will be more flexible.
>> The idea is to use a 'fake' vlan, say 999, and build a hook on the
>> host to intercept the request, detect that the vlan id is 999 and
>> replace it with the correct vlan id.
>> Using the custom properties just allows you to define the target vlan
>> id on the Engine and not in the hook code.
>>
>> You can review this reference for the vdsm part:
>> http://www.ovirt.org/develop/developer-guide/vdsm/hooks/
>>
>>>
>>> but what property define vlan number and how do I tell it that this
>>> number
>>> is really that number?
>>
>> If you look at this hook as an example:
>> https://github.com/oVirt/vdsm/tree/master/vdsm_hooks/extra_ipv4_addrs
>> You need to look for the 'vlan' attribute, check it is 999 and
>> overwrite it with your ID.
>>
>>>
>>> Thanks.
>>>
>>>
>>> On 03/15/2016 04:57 AM, Alona Kaplan wrote:
>>>
>>> Hi Bill,
>>>
>>> Currently the engine blocks adding two networks with the same vlan id to
>>> a
>>> data center.
>>> If you think there is a use case for having more than one network with
>>> the
>>> same vlan id in a DC, please open an RFE.
>>>
>>> As a workaround, you can add a network with a 'fake vlan id' (a vlan id
>>> that
>>> is not in use by the dc).
>>> And using 'vdsm before network setup hook'
>>> (https://bugzilla.redhat.com/1057637) translating the 'fake vlan id' to
>>> the
>>> desired one.
>>>
>>> Alona.
>>>
>>> ----- Original Message -----
>>>
>>> From: "Bill James" <bill.james at j2.com>
>>> To: "users" <users at ovirt.org>
>>> Sent: Tuesday, March 15, 2016 1:34:23 AM
>>> Subject: [ovirt-users] multiple NICs VLAN ID conflict
>>>
>>> We have DEV and QA is the same "data center" but on the network side of
>>> things they are on different switches, so they reused some VLAN IDs.
>>> No problem, my server has 4 NICS.
>>> But how do I tell ovirt its ok to have 2 networks with same vlan ID
>>> because
>>> I'm going to put them on different NICs?
>>>
>>> It says "specified VLAN ID is already in use".
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/users
>>>
>>>
>>>
>>> _______________________________________________
>>> Users mailing list
>>> Users at ovirt.org
>>> http://lists.ovirt.org/mailman/listinfo/users
>>>
>
>
> Cloud Services for Business www.j2.com
> j2 | eFax | eVoice | FuseMail | Campaigner | KeepItSafe | Onebox
>
>
> This email, its contents and attachments contain information from j2 Global,
> Inc. and/or its affiliates which may be privileged, confidential or
> otherwise protected from disclosure. The information is intended to be for
> the addressee(s) only. If you are not an addressee, any disclosure, copy,
> distribution, or use of the contents of this message is prohibited. If you
> have received this email in error please notify the sender by reply e-mail
> and delete the original message and any copies. (c) 2015 j2 Global, Inc. All
> rights reserved. eFax, eVoice, Campaigner, FuseMail, KeepItSafe, and Onebox
> are registered trademarks of j2 Global, Inc. and its affiliates.



More information about the Users mailing list