Hi
I've been able to work around this issue by adding a hook which checks if the ovirtmgmt interface is a port on a ovs switch and if so add the correct data to interface element. I added this to before_device_create and before_nic_hotplug folders, it works as far as bringing the hosted engine up, but resyncing host network from engine side makes it loose the connection.

/Sverker


Den 2018-05-14 kl. 10:12, skrev Sverker Abrahamsson:

Apparently the logs were too big for the mailing list, but should have been received by Petr and Dominik. Let me know if not.

What it boils down to, I think, is that the xml sent to libvirt does not have the correct data for openvswitch in interface element, see snippet below.

The question is, where should that be set?

What I actually want to reach is to have ovirtmgmt network on OVN according to this description "https://gist.github.com/phoracek/ebbd9a6bcfcb14d88f6b463c8dccb27b"; so it might be an unnecessary step to get it to work with OVS switch but the content of interface element in xml sent to libvirt is similar so I think an understanding of where it comes from is necessary to troubleshoot that (if needed).

/Sverker

Den 2018-05-13 kl. 00:23, skrev Sverker Abrahamsson:
Sure, they are attached. The attempt to start the hosted engine vm occurs at 14:29:42

Best regards
Sverker

Den 2018-05-11 kl. 13:39, skrev Petr Horacek:
Hi,

would you mind sharing the whole vdsm.log and supervdsm.log?

Thanks,
Petr

2018-05-10 22:48 GMT+02:00 Sverker Abrahamsson <sver...@abrahamsson.com <mailto:sver...@abrahamsson.com>>:

    Hi Dominik

    Den 2018-05-10 kl. 22:08, skrev Dominik Holler:

        On Thu, 10 May 2018 19:15:07 +0200
        Sverker Abrahamsson <sver...@abrahamsson.com
        <mailto:sver...@abrahamsson.com>> wrote:

            Hi
            I have a problem with running hosted engine with
            openvswitch. I have

        Which version of oVirt?

    Ovirt version is 4.2.3.5, vdsm version 4.20.27

        How do you configured hosted engine to use openvswitch?
        Did you follow the steps in
        https://lists.ovirt.org/pipermail/users/2017-March/080748.html
        <https://lists.ovirt.org/pipermail/users/2017-March/080748.html>
        ?

    I've followed the same steps as outlined in that mail just that
    I found it when I started to troubleshoot.

            one cluster where the ovirt engine runs on the host,
            there it works

        What is the switch type of this cluster?

    OVS

            and when starting a vm the interface definition looks
            like this:

                      <interface type="bridge">
                          <address bus="0x00" domain="0x0000"
            function="0x0"
            slot="0x03" type="pci" />
                          <mac address="00:1a:4a:16:01:51" />
                          <model type="virtio" />
                          <source bridge="vdsmbr_2XMhqdgD" />
                          <virtualport type="openvswitch" />
                          <filterref filter="vdsm-no-mac-spoofing" />
                      </interface>

        Where do you pick up this xml?

    From vdsm.log when the vm is created

            The xml for that vm as fetched from vdsm does not
            contain virtualport

        Where do you pick up this xml, maybe from a logfile or virsh?

     vdsm-client VM getInfo vmID=3efc0421-5ad5-4a04-9a0e-30bd8822b299

            tag nor does it use the correct bridge, it looks like this:

            <interface type="bridge">
                  <model type="virtio"/>
                  <link state="up"/>
                  <source bridge="ovirtmgmt"/>
                  <address bus="0x00" domain="0x0000" function="0x0"
            slot="0x03"
            type="pci"/>
                  <mac address="00:1a:4a:16:01:51"/>
                  <filterref filter="vdsm-no-mac-spoofing"/>
                  <bandwidth/>
            </interface>

            I.e. somewhere the definition is modified to contain the
            correct data
            to work with openvswitch

            On the other cluster where I try to run hosted engine I
            don't get the

        What is the switch type of this cluster?

    In the engine it's set to OVS, but at this point it hasn't
    started yet. Does the host have that setting somewhere?

            above behaviour. When the engine vm starts the interface
            settings are
            not modified to use the bridge in openvswitch, with the
            result that
            the vm fails to start:

        Can you share the error message from engine.log and
        vdsm.log, and maybe
        supervdsm.log?

    These are the error messages when vm fails to start, but it's
    caused by the interface element does not contain virtualport nor
    the correct bridge.

    vdsm.log:
    2018-05-10 22:45:30,562+0200 ERROR (vm/f222c92f) [virt.vm]
    (vmId='f222c92f-91af-4d1c-860d-c2b406211496') The vm start
    process failed (vm:943)
    Traceback (most recent call last):
      File "/usr/lib/python2.7/site-packages/vdsm/virt/vm.py", line
    872, in _startUnderlyingVm
        self._run()
      File "/usr/lib/python2.7/site-packages/vdsm/virt/vm.py", line
    2872, in _run
        dom.createWithFlags(flags)
      File
    "/usr/lib/python2.7/site-packages/vdsm/common/libvirtconnection.py",
    line 130, in wrapper
        ret = f(*args, **kwargs)
      File
    "/usr/lib/python2.7/site-packages/vdsm/common/function.py", line
    92, in wrapper
        return func(inst, *args, **kwargs)
      File "/usr/lib64/python2.7/site-packages/libvirt.py", line
    1099, in createWithFlags
        if ret == -1: raise libvirtError
    ('virDomainCreateWithFlags() failed', dom=self)
    libvirtError: Unable to add bridge ovirtmgmt port vnet0:
    Operation not supported
    2018-05-10 22:45:30,562+0200 INFO  (vm/f222c92f) [virt.vm]
    (vmId='f222c92f-91af-4d1c-860d-c2b406211496') Changed state to
    Down: Unable to add bridge ovirtmgmt port vnet0: Operation not
    supported (code=1)
    (vm:1683)
    2018-05-10 22:45:30,604+0200 INFO  (vm/f222c92f) [virt.vm]
    (vmId='f222c92f-91af-4d1c-860d-c2b406211496') Stopping
    connection (guestagent:438)

    It's the hosted engine vm that fails to start, hence I don't
    have any engine.log and supervdsm.log doesn't contain anything
    about this

                      <interface type="bridge">
                          <model type="virtio"/>
                          <link state="up"/>
                          <source bridge="ovirtmgmt"/>
                          <alias
            name="ua-430d692e-6ef0-4529-8af0-b37a53a11564"/>
                          <address bus="0x00" domain="0x0000"
            function="0x0"
            slot="0x03" type="pci"/>
                          <mac address="00:16:3e:0e:39:42"/>
                          <filterref filter="vdsm-no-mac-spoofing"/>
                          <bandwidth/>
                      </interface>

            Last login: Thu May 10 16:23:48 2018 from 172.27.1.32
            [root@h2 ~]# ovs-vsctl show
            dfcf7463-ce51-4115-9a3a-ecab9efa8146
                  Bridge "vdsmbr_H91hH5sG"
                      Port "vdsmbr_H91hH5sG"
                          Interface "vdsmbr_H91hH5sG"
                              type: internal
                      Port ovirtmgmt
                          Interface ovirtmgmt
                              type: internal
                      Port "dummy0"
                          Interface "dummy0"
                  ovs_version: "2.9.0"

            I assumed first there is a hook that make the needed
            change, but the
            only hooks I can find that mentions openvswitch are
            ovirt_provider_ovn_hook and 50_openstacknet but both
            those would set
            the source bridge to br-int and not look up the dynamic
            name of the
            bridge as created by vdsm.

            One special thing about the host where I try to run
            hosted engine is
            that the there is a dummy port since otherwise I
            couldn't get vdsm to
            create the bridge, but that shouldn't affect changing
            the interface
            definition for the vm.

            Where should I look next?
            _______________________________________________
            Users mailing list -- users@ovirt.org
            <mailto:users@ovirt.org>
            To unsubscribe send an email to users-le...@ovirt.org
            <mailto:users-le...@ovirt.org>

    _______________________________________________
    Users mailing list -- users@ovirt.org <mailto:users@ovirt.org>
    To unsubscribe send an email to users-le...@ovirt.org
    <mailto:users-le...@ovirt.org>





#!/usr/bin/python

import json
import os
import sys
import hooking

from ovirt_hosted_engine_setup import constants as ohostedcons

BRCTL_SHOW = ['brctl', 'show']
OVS_IFACE_TO_BR = ['ovs-vsctl', 'iface-to-br', 'ovirtmgmt']

def ovs_device(domxml):
    #ifc_name = get_lsp_name()

    try:
        iface = domxml.getElementsByTagName('interface')[0]
    except IndexError:
        return  # skip if not an interface

    source = iface.getElementsByTagName('source')[0]
    bridge = source.getAttribute('bridge')
    if bridge != 'ovirtmgmt':
        return

    type, bridge = _get_bridge()
    if type == 'legacy':
        return
    elif type == 'ovs':
        for child in iface.getElementsByTagName('virtualport'):
            iface.removeChild(child)

        virtualport = domxml.createElement('virtualport')
        virtualport.setAttribute('type', 'openvswitch')
        iface.appendChild(virtualport)

        #parameters = domxml.createElement('parameters')
        #parameters.setAttribute('interfaceid', ifc_name)
        #virtualport.appendChild(parameters)

        source.setAttribute('bridge', bridge)

def _get_bridge():
    retcode, out, err = hooking.execCmd(BRCTL_SHOW, sudo=True)
    if retcode == 0 and 'ovirtmgmt' in out:
        return 'legacy', ''

    retcode, out, err = hooking.execCmd(OVS_IFACE_TO_BR, sudo=True)
    if retcode == 0:
        return 'ovs', out[0]

def main():
    domxml = hooking.read_domxml()
    sys.stderr.write(domxml.toxml())
    ovs_device(domxml)
    hooking.write_domxml(domxml)

if __name__ == "__main__":
    main()


_______________________________________________
Users mailing list -- users@ovirt.org
To unsubscribe send an email to users-le...@ovirt.org

Reply via email to