Change in vdsm[master]: unified_persistence: Fix whitelist value types

asegurap at redhat.com asegurap at redhat.com
Thu Apr 24 16:24:54 UTC 2014


Antoni Segura Puimedon has posted comments on this change.

Change subject: unified_persistence: Fix whitelist value types
......................................................................


Patch Set 1: Verified+1

Manually verified by:

1. first showing the old output doing:
    In [1]: from vdsm.tool import unified_persistence

    In [2]: unified_persistence._getNetInfo()
    Out[2]: 
    ({'other': {'STP': 'no',
                'bootproto': 'dhcp',
                'bridged': True,
                'defaultRoute': False,
                'mtu': '1500',
                'nic': 'eth3'},
      'otherbond': {'STP': 'no',
                    'bonding': 'bond0',
                    'bootproto': 'dhcp',
                    'bridged': True,
                    'defaultRoute': False,
                    'mtu': '1500'},
      'otherbrless': {'bootproto': 'dhcp',
                      'bridged': False,
                      'defaultRoute': False,
                      'mtu': '1500',
                      'nic': u'eth4'},
      'ovirtmgmt': {'STP': 'no',
                    'bootproto': 'dhcp',
                    'bridged': True,
                    'defaultRoute': True,
                    'mtu': '1500',
                    'nic': 'eth2'}},
     {'bond0': {'nics': ['eth5', 'eth6'], 'options': 'mode=1'}})

Then replaced
/usr/lib64/python2.6/site-packages/vdsm/tool/unified_persistence.py
with the one in this patch and repeated the above:

    In [1]: from vdsm.tool import unified_persistence

    In [2]: unified_persistence._getNetInfo()
    Out[2]: 
    ({'other': {'bootproto': 'dhcp',
                'bridged': True,
                'defaultRoute': False,
                'mtu': 1500,
                'nic': 'eth3',
                'stp': False},
      'otherbond': {'bonding': 'bond0',
                    'bootproto': 'dhcp',
                    'bridged': True,
                    'defaultRoute': False,
                    'mtu': 1500,
                    'stp': False},
      'otherbrless': {'bootproto': 'dhcp',
                      'bridged': False,
                      'defaultRoute': False,
                      'mtu': 1500,
                      'nic': u'eth4'},
      'ovirtmgmt': {'bootproto': 'dhcp',
                    'bridged': True,
                    'defaultRoute': True,
                    'mtu': 1500,
                    'nic': 'eth2',
                    'stp': False}},
     {'bond0': {'nics': ['eth5', 'eth6'], 'options': 'mode=1'}})

As we can see, mtu and stp now have the right type, as the patch addressed the
issue.

After this, I did the same the upgrade script does:

    In [1]: from vdsm.tool import unified_persistence

    In [2]: from vdsm import netconfpersistence

    In [3]: nets, bonds = unified_persistence._getNetInfo()

    In [4]: r = netconfpersistence.RunningConfig()

    In [5]: r.delete()

    In [6]: for net, attrs in nets.iteritems():
        r.setNetwork(net, attrs)

    In [7]: for bond, attrs in bonds.iteritems():
        r.setBonding(bond, attrs)

    In [8]: r.save()

    In [9]: r.store()

Then checked what's on running and persistent config:

    toniel602 ~ # tail /var/run/vdsm/netconf/nets/*                 
    ==> /var/run/vdsm/netconf/nets/other <==
    {"nic": "eth3", "mtu": 1500, "bootproto": "dhcp", "stp": false, "bridged": true, "defaultRoute": false}
    ==> /var/run/vdsm/netconf/nets/otherbond <==
    {"mtu": 1500, "bonding": "bond0", "bootproto": "dhcp", "stp": false, "bridged": true, "defaultRoute": false}
    ==> /var/run/vdsm/netconf/nets/otherbrless <==
    {"nic": "eth4", "bootproto": "dhcp", "bridged": false, "defaultRoute": false, "mtu": 1500}
    ==> /var/run/vdsm/netconf/nets/ovirtmgmt <==
    {"nic": "eth2", "mtu": 1500, "bootproto": "dhcp", "stp": false, "bridged": true, "defaultRoute": true}

    toniel602 ~ # tail /var/lib/vdsm/persistence/netconf/nets/*
    ==> /var/lib/vdsm/persistence/netconf/nets/other <==
    {"nic": "eth3", "mtu": 1500, "bootproto": "dhcp", "stp": false, "bridged": true, "defaultRoute": false}
    ==> /var/lib/vdsm/persistence/netconf/nets/otherbond <==
    {"mtu": 1500, "bonding": "bond0", "bootproto": "dhcp", "stp": false, "bridged": true, "defaultRoute": false}
    ==> /var/lib/vdsm/persistence/netconf/nets/otherbrless <==
    {"nic": "eth4", "bootproto": "dhcp", "bridged": false, "defaultRoute": false, "mtu": 1500}
    ==> /var/lib/vdsm/persistence/netconf/nets/ovirtmgmt <==
    {"nic": "eth2", "mtu": 1500, "bootproto": "dhcp", "stp": false, "bridged": true, "defaultRoute": true}

Saw that the types are correct.

Finally, did from the console:

    vdsm-tool restore_nets

And saw that the networks were recreated correctly.

-- 
To view, visit http://gerrit.ovirt.org/27058
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ib1859a57b44f1ba1f2e32ff83e26e9e9fbf8228c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: No


More information about the vdsm-patches mailing list