Ondřej Svoboda has posted comments on this change.

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


Patch Set 2: Verified+1

The patch series behaves the same as in master and ovirt-3.6 so: it withstands 
missing ifcfg files but doesn't tolerate other IO errors.


# ip link add type dummy
# cd /usr/share/vdsm/
# python
>>> 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 680, in removeNic
    self._backup(cf)
  File "network/configurators/ifcfg.py", line 351, in _backup
    self._atomicBackup(filename)
  File "network/configurators/ifcfg.py", line 363, in _atomicBackup
    self._backups[filename] = open(filename).read()
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.16.27-3.git21403f5.el7
DEVICE=dummy1
ONBOOT=yes
MTU=1500
HWADDR=7a:42:93:76:6e:5a
NM_CONTROLLED=no

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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ice4d6b248e8ff43fc8b9deeef07484111a3a3ebd
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.5
Gerrit-Owner: Ondřej Svoboda <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Ido Barkan <[email protected]>
Gerrit-Reviewer: Ondřej Svoboda <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: No
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to