Change in vdsm[master]: ifcfg: only deal gracefully with ENOENT in removeNic

osvoboda at redhat.com osvoboda at redhat.com
Wed Sep 16 10:33:53 UTC 2015


Ondřej Svoboda has posted comments on this change.

Change subject: ifcfg: only deal gracefully with ENOENT in removeNic
......................................................................


Patch Set 1: Verified+1

Together with https://gerrit.ovirt.org/45983/

I simulated removeNic behaviour on EISDIR and then ENOENT (twice).

# ip link add type dummy
>>> import os
>>> os.mkdir('/etc/sysconfig/network-scripts/ifcfg-dummy1')
>>> from network.configurators import ifcfg
>>> w = ifcfg.ConfigWriter()
>>> w.removeNic('dummy1')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "network/configurators/ifcfg.py", line 679, in removeNic
    self._backup(cf)
  File "network/configurators/ifcfg.py", line 368, in _backup
    self._persistentBackup(filename)
  File "network/configurators/ifcfg.py", line 409, in _persistentBackup
    with open(filename) as f:
IOError: [Errno 21] Is a directory: '/etc/sysconfig/network-scripts/ifcfg-dummy1'
>>> os.rmdir('/etc/sysconfig/network-scripts/ifcfg-dummy1')
>>> w.removeNic('dummy1')
WARNING:root:/etc/sysconfig/network-scripts/ifcfg-dummy1 doesn't exist, reading HWADDR from the system
>>> w.removeNic('dummy1')
>>> print open('/etc/sysconfig/network-scripts/ifcfg-dummy1').read()
# Generated by VDSM version 4.17.2-128.git2f04d9a.el7
DEVICE=dummy1
ONBOOT=yes
MTU=1500
HWADDR=0a:96:3e:cf:fc:50
NM_CONTROLLED=no

-- 
To view, visit https://gerrit.ovirt.org/46197
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice4d6b248e8ff43fc8b9deeef07484111a3a3ebd
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: No


More information about the vdsm-patches mailing list