Change in vdsm[master]: glusterHostsList verb returns local hostname as IP address o...
by barumuga@redhat.com
Hello Ayal Baron, Timothy Asir, Saggi Mizrahi, Federico Simoncelli, Dan Kenigsberg,
I'd like you to do a code review. Please visit
http://gerrit.ovirt.org/7617
to review the following change.
Change subject: glusterHostsList verb returns local hostname as IP address or FQDN
......................................................................
glusterHostsList verb returns local hostname as IP address or FQDN
Change-Id: Id0f96a6ac76fd9ac7ea30fa1c707d61e9f05eb42
Signed-off-by: Bala.FA <barumuga(a)redhat.com>
---
M vdsm/gluster/cli.py
M vdsm/gluster/exception.py
2 files changed, 5 insertions(+), 4 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/17/7617/1
diff --git a/vdsm/gluster/cli.py b/vdsm/gluster/cli.py
index dcd8eda..659eef3 100644
--- a/vdsm/gluster/cli.py
+++ b/vdsm/gluster/cli.py
@@ -732,7 +732,8 @@
"""
rc, out, err = _execGluster(_getGlusterPeerCmd() + ["status"])
if rc:
- raise ge.GlusterHostListFailedException(rc, out, err)
+ raise ge.GlusterHostsListFailedException(rc, out, err)
else:
- return _parsePeerStatus(out, _getGlusterHostName(),
+ return _parsePeerStatus(out,
+ _getLocalIpAddress() or _getGlusterHostName(),
_getGlusterUuid(), HostStatus.CONNECTED)
diff --git a/vdsm/gluster/exception.py b/vdsm/gluster/exception.py
index 3b8a978..abe2ffb 100644
--- a/vdsm/gluster/exception.py
+++ b/vdsm/gluster/exception.py
@@ -364,6 +364,6 @@
message = "Remove host failed"
-class GlusterHostListFailedException(GlusterHostException):
+class GlusterHostsListFailedException(GlusterHostException):
code = 4407
- message = "Host list failed"
+ message = "Hosts list failed"
--
To view, visit http://gerrit.ovirt.org/7617
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0f96a6ac76fd9ac7ea30fa1c707d61e9f05eb42
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Bala.FA <barumuga(a)redhat.com>
Gerrit-Reviewer: Ayal Baron <abaron(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Timothy Asir <tjeyasin(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: bootstrap: perform reboot asynchronously
by Alon Bar-Lev
Alon Bar-Lev has uploaded a new change for review.
Change subject: bootstrap: perform reboot asynchronously
......................................................................
bootstrap: perform reboot asynchronously
The use of /sbin/reboot may cause reboot to be performed at the middle
of script execution.
Reboot should be delayed in background so that script will have a fair
chance to terminate properly.
Change-Id: I0abb02ae4d5033a8b9f2d468da86fcdc53e2e1c2
Signed-off-by: Alon Bar-Lev <alonbl(a)redhat.com>
---
M vdsm_reg/deployUtil.py.in
1 file changed, 39 insertions(+), 5 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/83/7783/1
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index ebc7d36..b72cb44 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -166,13 +166,47 @@
def reboot():
"""
- This function reboots the machine.
+ This function reboots the machine async
"""
- fReturn = True
+ fReturn = False
- out, err, ret = _logExec([EX_REBOOT])
- if ret:
- fReturn = False
+ # Default maximum for the number of available file descriptors.
+ MAXFD = 1024
+
+ import resource # Resource usage information.
+ maxfd = resource.getrlimit(resource.RLIMIT_NOFILE)[1]
+ if (maxfd == resource.RLIM_INFINITY):
+ maxfd = MAXFD
+
+ try:
+ pid = os.fork()
+ if pid == 0:
+ try:
+ os.setsid()
+ for fd in range(0, maxfd):
+ try:
+ os.close(fd)
+ except OSError: # ERROR, fd wasn't open to begin with (ignored)
+ pass
+
+ os.open(os.devnull, os.O_RDWR) # standard input (0)
+ os.dup2(0, 1) # standard output (1)
+ os.dup2(0, 2) # standard error (2)
+
+ if os.fork() != 0:
+ os._exit(0)
+
+ time.sleep(10)
+ os.execl(EX_REBOOT, EX_REBOOT)
+ finally:
+ os._exit(1)
+
+ pid, status = os.waitpid(pid, 0)
+
+ if os.WIFEXITED(status) and os.WEXITSTATUS(status) == 0:
+ fReturn = True
+ except OSError:
+ pass
return fReturn
--
To view, visit http://gerrit.ovirt.org/7783
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0abb02ae4d5033a8b9f2d468da86fcdc53e2e1c2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <alonbl(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: remove the broken support for delivering video to local disp...
by zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has uploaded a new change for review.
Change subject: remove the broken support for delivering video to local display
......................................................................
remove the broken support for delivering video to local display
In vdsClient help message and sample VM configurations, it is said when
display is set to local, the VM video will go to local host. In fact
vdsm do not implement this. If the user use this feature, vdsm will
raise an exception in function getConfVideo() in vdsm/vm.py.
To implement this feature, we have to
1. deal with 'local' properly in getConfVideo() in vdsm/vm.py, add a
suitable video device when 'local' is set.
2. generate graphic discription XML node properly in vdsm libvirtvm.py,
like <graphics type="sdl" display=":0" xauth="blah">. Now we always
generate some attributes not related to SDL, and libvirt will complain.
We have to suppress generating those attributes when using local
display.
3. If we allocate a host display for the user qemu, then qemu can use sdl
to show the display in its own host display.
4. If we do not want to allocate a display for qemu, we have to use an
existing one, then we have to deal with the $DISPLAY(:0 ?) and
$XAUTHORITY. These two attributes can be set in the libvirt XML in the
graphics section
5. We often setup hosts without X support, it is not possible to
deliver the guest video to host display. In this situation, detect the
host X support and raises an exception properly to the user to describe
what's wrong.
If we are not going to do the work as written above, we'd better remove
the broken support for local display.
Change-Id: I4e655b7e03be74c5d9627ec03ac2baefcc379681
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
M vdsm/API.py
M vdsm/vmBootExample.conf
M vdsm/vmConfExample.conf
M vdsm_cli/vdsClient.py
4 files changed, 5 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/25/7725/1
diff --git a/vdsm/API.py b/vdsm/API.py
index 827f73b..566d6e5 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -222,7 +222,7 @@
'No space on /tmp?'}}
return errCode['createErr']
- if vmParams.get('display') not in ('vnc', 'qxl', 'qxlnc', 'local'):
+ if vmParams.get('display') not in ('vnc', 'qxl', 'qxlnc'):
return {'status': {'code': errCode['createErr']
['status']['code'],
'message': 'Unknown display type %s'
diff --git a/vdsm/vmBootExample.conf b/vdsm/vmBootExample.conf
index 62cdec3..9af2141 100644
--- a/vdsm/vmBootExample.conf
+++ b/vdsm/vmBootExample.conf
@@ -5,10 +5,9 @@
#The local hard drive image
imageFile="/tmp/WS2003.diskImage"
#Were do send the virtual machine display
-#If set to local then the display opens according to the $DISPLAY settings of the shell running the server
#If set to vnc then the server responds with a vnc display for the virtual machine
#access to the virtual machine is then <server>:<id set by the server>
-display=local
+display=vnc
#Use file CD-ROM image.
#You can use the host CD-ROM by using /dev/cdrom as filename
#omiting this parameter means no CDROM
diff --git a/vdsm/vmConfExample.conf b/vdsm/vmConfExample.conf
index 3000108..aa17ad9 100644
--- a/vdsm/vmConfExample.conf
+++ b/vdsm/vmConfExample.conf
@@ -11,7 +11,6 @@
imageFile="/data/images/for-qemu/fc5_migrate.vmdk"
#Were do send the virtual machine display
-#If set to local then the display opens according to the $DISPLAY settings of the shell running the server
#If set to vnc then the server responds with a vnc display for the virtual machine
#access to the virtual machine is then <server>:<id set by the server>
#display=local | vnc
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index cb90b8d..e7d51c7 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -1622,7 +1622,7 @@
' myVmConfigFile',
'Example with no file : vdsClient someServer create'
' /dev/null vmId=<uuid> memSize=256 '
- 'imageFile=someImage display=<vnc|local|qxl|qxlnc>',
+ 'imageFile=someImage display=<vnc|qxl|qxlnc>',
'Parameters list: r=required, o=optional',
'r vmId=<uuid> : Unique identification for the '
'created VM. Any additional operation on the VM must '
@@ -1636,8 +1636,8 @@
'machine',
'r macAddr=<aa:bb:cc:dd:ee:ff> : MAC address of the '
'machine',
- 'r display=<vnc|local|qxl|qxlnc> : send the machine '
- 'display to vnc, local host, spice, or spice with no '
+ 'r display=<vnc|qxl|qxlnc> : send the machine '
+ 'display to vnc, spice, or spice with no '
'image compression',
'o drive=pool:poolID,domain:domainID,image:imageID,'
'volume:volumeID[,boot:true,format:cow] : disk image '
--
To view, visit http://gerrit.ovirt.org/7725
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e655b7e03be74c5d9627ec03ac2baefcc379681
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: call sync before umount in mkFloppyFs
by zhshzhou@linux.vnet.ibm.com
Zhou Zheng Sheng has uploaded a new change for review.
Change subject: call sync before umount in mkFloppyFs
......................................................................
call sync before umount in mkFloppyFs
mkFloppyFs creates a floppy image, mount it, write some content, and
umount the image. On some systems, if we umount immediately after writing
content, umount will fail, because the data is not fully synced to disk,
and the device is still busy. This problem causes unit test test_mkFloppyFs
in mkimageTests.py fail.
To avoid the busy device problem, call /usr/bin/sync before umount.
Change-Id: I708e70aa1e898b32bb3c1009d411389d7adbe549
Signed-off-by: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
---
M configure.ac
M vdsm/constants.py.in
M vdsm/mkimage.py
M vdsm/storage/misc.py
4 files changed, 7 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/6995/1
--
To view, visit http://gerrit.ovirt.org/6995
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I708e70aa1e898b32bb3c1009d411389d7adbe549
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: Bug-Id: https://bugzilla.redhat.com/851839
by asegurap@redhat.com
Antoni Segura Puimedon has uploaded a new change for review.
Change subject: Bug-Id: https://bugzilla.redhat.com/851839
......................................................................
Bug-Id: https://bugzilla.redhat.com/851839
This patch expands the logging done in network and traffic control by means of
using vdsm.storage.misc.execCmd with a tailored logged that indicates which
module is the origin of the logging.
It also substitutes some of the already existant logging uses with the module-
specific logger created for the execCmd use.
Change-Id: I825431e4a2cbb603fea2b5472b072e5d6a3862e9
Signed-off-by: Antoni S. Puimedon <asegurap(a)redhat.com>
---
M vdsm/configNetwork.py
M vdsm/tc.py
M vdsm/utils.py
3 files changed, 48 insertions(+), 29 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/62/7662/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 58117f8..5c58e4a 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -17,7 +17,7 @@
# Refer to the README and COPYING files for full details of the license
#
-import sys, subprocess, os, re, traceback
+import sys, os, re, traceback
import pipes
import pwd
import time
@@ -42,6 +42,9 @@
MAX_BRIDGE_NAME_LEN = 15
ILLEGAL_BRIDGE_CHARS = frozenset(':. \t')
+configNetworkLogger = logging.getLogger('configNetwork')
+execCmd = utils.makeExecCmd(log=configNetworkLogger)
+
class ConfigNetworkError(Exception):
def __init__(self, errCode, message):
self.errCode = errCode
@@ -50,25 +53,22 @@
def ifdown(iface):
"Bring down an interface"
- p = subprocess.Popen([constants.EXT_IFDOWN, iface], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, close_fds=True)
- out, err = p.communicate()
+ rc, out, err = execCmd([constants.EXT_IFDOWN, iface], raw=True)
if out.strip():
logging.info(out)
if err.strip():
logging.warn('\n'.join([line for line in err.splitlines()
if not line.endswith(' does not exist!')]))
- return p.returncode
+ return rc
def ifup(iface):
"Bring up an interface"
- p = subprocess.Popen([constants.EXT_IFUP, iface], stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, close_fds=True)
- out, err = p.communicate()
+ rc, out, err = execCmd([constants.EXT_IFUP, iface], raw=True)
if out.strip():
logging.info(out)
if err.strip():
logging.warn(err)
+ return rc
def ifaceUsers(iface):
"Returns a list of entities using the interface"
@@ -157,8 +157,9 @@
mounts = open('/proc/mounts').read()
if ' /config ext3' in mounts and ' %s ext3' % filename in mounts:
- subprocess.call([constants.EXT_UMOUNT, '-n', filename])
+ execCmd([constants.EXT_UMOUNT, '-n', filename])
utils.rmFile(filename)
+ configNetworkLogger.debug("Removed file %s", filename)
def _createNetwork(self, netXml):
conn = libvirtconnection.get()
@@ -291,6 +292,8 @@
for confFile, content in self._backups.iteritems():
if content is None:
utils.rmFile(confFile)
+ configNetworkLogger.debug(
+ 'Removing empty configuration backup %s', confFile)
else:
open(confFile, 'w').write(content)
logging.info('Restored %s', confFile)
@@ -299,9 +302,9 @@
def _persistentBackup(cls, filename):
""" Persistently backup ifcfg-* config files """
if os.path.exists('/usr/libexec/ovirt-functions'):
- subprocess.call([constants.EXT_SH, '/usr/libexec/ovirt-functions',
+ execCmd([constants.EXT_SH, '/usr/libexec/ovirt-functions',
'unmount_config', filename])
- logging.debug("unmounted %s using ovirt", filename)
+ configNetworkLogger.debug("unmounted %s using ovirt", filename)
(dummy, basename) = os.path.split(filename)
if os.path.exists(filename):
@@ -309,7 +312,7 @@
else:
# For non-exists ifcfg-* file use predefined header
content = cls.DELETED_HEADER + '\n'
- logging.debug("backing up %s: %s", basename, content)
+ configNetworkLogger.debug("backing up %s: %s", basename, content)
cls.writeBackupFile(netinfo.NET_CONF_BACK_DIR, basename, content)
@@ -349,16 +352,12 @@
if not self._backups and not self._networksBackups:
return
- subprocess.Popen(['/etc/init.d/network', 'stop'],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).communicate()
+ execCmd(['/etc/init.d/network', 'stop'])
self.restoreAtomicNetworkBackup()
self.restoreAtomicBackup()
- subprocess.Popen(['/etc/init.d/network', 'start'],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE).communicate()
+ execCmd(['/etc/init.d/network', 'start'])
@classmethod
def clearBackups(cls):
@@ -374,8 +373,8 @@
try:
selinux.restorecon(fileName)
except:
- logging.debug('ignoring restorecon error in case SElinux is '
- 'disabled', exc_info=True)
+ configNetworkLogger.debug('ignoring restorecon error in case '
+ 'SElinux is disabled', exc_info=True)
def _createConfFile(self, conf, name, ipaddr=None, netmask=None,
gateway=None, bootproto=None, mtu=None, onboot='yes', **kwargs):
@@ -405,7 +404,7 @@
if re.match('^[a-zA-Z_]\w*$', k):
cfg += '%s=%s\n' % (k.upper(), pipes.quote(kwargs[k]))
else:
- logging.debug('ignoring variable %s', k)
+ configNetworkLogger.debug('ignoring variable %s', k)
self.writeConfFile(self.NET_CONF_PREF + name, cfg)
@@ -499,8 +498,7 @@
def removeVlan(self, vlan, iface):
vlandev = iface + '.' + vlan
ifdown(vlandev)
- subprocess.call([constants.EXT_IPROUTE, 'link', 'del', vlandev],
- stderr=subprocess.PIPE)
+ execCmd([constants.EXT_IPROUTE, 'link', 'del', vlandev])
self._backup(self.NET_CONF_PREF + iface + '.' + vlan)
self._removeFile(self.NET_CONF_PREF + iface + '.' + vlan)
@@ -510,7 +508,7 @@
def removeBridge(self, bridge):
ifdown(bridge)
- subprocess.call([constants.EXT_BRCTL, 'delbr', bridge])
+ execCmd([constants.EXT_BRCTL, 'delbr', bridge])
self._backup(self.NET_CONF_PREF + bridge)
self._removeFile(self.NET_CONF_PREF + bridge)
@@ -829,7 +827,7 @@
# Validation
if not utils.tobool(force):
- logging.debug('validating network...')
+ configNetworkLogger.debug('validating network...')
_addNetworkValidation(_netinfo, network=network,
vlan=vlan, bonding=bonding, nics=nics, ipaddr=ipaddr,
netmask=netmask, gateway=gateway, bondingOptions=bondingOptions,
@@ -1172,7 +1170,8 @@
for bond, bondAttrs in bondings.items():
if 'remove' in bondAttrs:
nics = _netinfo.getNicsForBonding(bond)
- logger.debug("Removing bond %r with nics = %s", bond, nics)
+ logger.debug("Removing bond %r with nics = %s", bond,
+ nics)
ifdown(bond)
configWriter.removeBonding(bond)
@@ -1312,7 +1311,7 @@
def setSafeNetworkConfig():
"""Declare current network configuration as 'safe'"""
- subprocess.Popen([constants.EXT_VDSM_STORE_NET_CONFIG])
+ execCmd([constants.EXT_VDSM_STORE_NET_CONFIG])
def usage():
print """Usage:
diff --git a/vdsm/tc.py b/vdsm/tc.py
index 570c410..83593e9 100644
--- a/vdsm/tc.py
+++ b/vdsm/tc.py
@@ -18,14 +18,18 @@
# Refer to the README and COPYING files for full details of the license
#
+import logging
from collections import namedtuple
-import storage.misc
+import utils
from vdsm.constants import EXT_TC, EXT_IFCONFIG
ERR_DEV_NOEXIST = 2
QDISC_INGRESS = 'ffff:'
+
+tcLogger = logging.getLogger('trafficControl')
+execCmd = utils.makeExecCmd(log=tcLogger)
class TrafficControlException(Exception):
@@ -81,7 +85,7 @@
def _process_request(command):
- retcode, out, err = storage.misc.execCmd(command, raw=True, sudo=False)
+ retcode, out, err = execCmd(command, raw=True, sudo=False)
if retcode != 0:
raise TrafficControlException(retcode, err, command)
return out
diff --git a/vdsm/utils.py b/vdsm/utils.py
index 5e2d4e5..9383171 100644
--- a/vdsm/utils.py
+++ b/vdsm/utils.py
@@ -596,6 +596,22 @@
else:
return val
+
+def makeExecCmd(log=None):
+ from storage.misc import execCmd
+ if log is None:
+ return execCmd
+ else:
+ def _execCmd(*args, **kwargs):
+ originalLogger = execCmd.func_globals['execCmdLogger']
+ execCmd.func_globals['execCmdLogger'] = log
+ try:
+ return execCmd(*args, **kwargs)
+ finally:
+ execCmd.func_globals['execCmdLogger'] = originalLogger
+ return _execCmd
+
+
def execCmd(*args, **kwargs):
# import only after config as been initialized
from storage.misc import execCmd
--
To view, visit http://gerrit.ovirt.org/7662
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I825431e4a2cbb603fea2b5472b072e5d6a3862e9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: vdsm-tool/load_needed_modules: fix creation of legacy bonds
by Dan Kenigsberg
Dan Kenigsberg has uploaded a new change for review.
Change subject: vdsm-tool/load_needed_modules: fix creation of legacy bonds
......................................................................
vdsm-tool/load_needed_modules: fix creation of legacy bonds
Fix commit 816238891be which has failed to open MASTER_FILE for writing
before wrting to it.
Change-Id: I82dd48d52541b6d35606fd8358cd98cd9f46fed5
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M vdsm-tool/load_needed_modules.py.in
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/79/7879/1
diff --git a/vdsm-tool/load_needed_modules.py.in b/vdsm-tool/load_needed_modules.py.in
index ba80c72..675a172 100644
--- a/vdsm-tool/load_needed_modules.py.in
+++ b/vdsm-tool/load_needed_modules.py.in
@@ -45,7 +45,7 @@
# @ENGINENAME@ currently assumes that all bonding devices pre-exist
existing = set(file(MASTER_FILE).read().split())
- with open(MASTER_FILE) as f:
+ with open(MASTER_FILE, 'w') as f:
for bond in REQUIRED - existing:
f.write('+%s\n' % bond)
--
To view, visit http://gerrit.ovirt.org/7879
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82dd48d52541b6d35606fd8358cd98cd9f46fed5
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: Related to BZ#815359 - Improve log on qemu-convert error.
by ewarszaw@redhat.com
Eduardo has uploaded a new change for review.
Change subject: Related to BZ#815359 - Improve log on qemu-convert error.
......................................................................
Related to BZ#815359 - Improve log on qemu-convert error.
Change-Id: I7e9e139f3254953577cfebe048ea89a2ababf2a6
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/image.py
1 file changed, 2 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/76/7476/1
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 74ee79e..d004046 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -1020,6 +1020,8 @@
srcVolParams['volFormat'], volParams['volFormat'], vars.task.aborting,
size=volParams['apparentsize'], dstvolType=newVol.getType())
if rc:
+ self.log.error("qemu-img convert failed: rc=%s, out=%s, err=%s",
+ rc, out, err)
raise se.MergeSnapshotsError(newUUID)
newVol.teardown(sdUUID=newVol.sdUUID, volUUID=newVol.volUUID)
--
To view, visit http://gerrit.ovirt.org/7476
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e9e139f3254953577cfebe048ea89a2ababf2a6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: Make vdsm/configNetwork.py PEP8 clean
by wudxw@linux.vnet.ibm.com
Mark Wu has uploaded a new change for review.
Change subject: Make vdsm/configNetwork.py PEP8 clean
......................................................................
Make vdsm/configNetwork.py PEP8 clean
Change-Id: I02be4c0cdb1868a8518a73e22dfb77adedc08f3f
Signed-off-by: Mark Wu <wudxw(a)linux.vnet.ibm.com>
---
M Makefile.am
M vdsm/configNetwork.py
2 files changed, 106 insertions(+), 42 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/7758/1
diff --git a/Makefile.am b/Makefile.am
index 40d7658..4900cc5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -47,6 +47,7 @@
vdsm/blkid.py \
vdsm/caps.py \
vdsm/clientIF.py \
+ vdsm/configNetwork.py \
vdsm/constants.py.in \
vdsm/debugPluginClient.py \
vdsm/define.py \
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 74d19c7..df807bf 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -17,7 +17,11 @@
# Refer to the README and COPYING files for full details of the license
#
-import sys, subprocess, os, re, traceback
+import sys
+import subprocess
+import os
+import re
+import traceback
import pipes
import pwd
import time
@@ -42,11 +46,13 @@
MAX_BRIDGE_NAME_LEN = 15
ILLEGAL_BRIDGE_CHARS = frozenset(':. \t')
+
class ConfigNetworkError(Exception):
def __init__(self, errCode, message):
self.errCode = errCode
self.message = message
Exception.__init__(self, self.errCode, self.message)
+
def ifdown(iface):
"Bring down an interface"
@@ -60,6 +66,7 @@
if not line.endswith(' does not exist!')]))
return p.returncode
+
def ifup(iface):
"Bring up an interface"
p = subprocess.Popen([constants.EXT_IFUP, iface], stdout=subprocess.PIPE,
@@ -69,6 +76,7 @@
logging.info(out)
if err.strip():
logging.warn(err)
+
def ifaceUsers(iface):
"Returns a list of entities using the interface"
@@ -87,8 +95,12 @@
users.add(v)
return users
+
def nicOtherUsers(bridge, vlan, bonding, nic):
- "Returns a list of interfaces using a nic, other than the specified one (used for validation)"
+ """
+ Returns a list of interfaces using a nic,
+ other than the specified one (used for validation)
+ """
if bonding:
owner = bonding
elif vlan:
@@ -101,8 +113,12 @@
users.discard(owner)
return users
+
def bondingOtherUsers(bridge, vlan, bonding):
- "Return a list of nics/interfaces using a bonding, other than the specified one (used for validation)"
+ """
+ Return a list of nics/interfaces using a bonding,
+ other than the specified one (used for validation)
+ """
if vlan:
owner = bonding + '.' + vlan
else:
@@ -123,6 +139,8 @@
# nicSort(["p33p2", "p33p10"]) => ["p33p10", "p33p2"]
# nicSort(["p331", "p33p1"]) => ["p33p1", "p331"]
#
+
+
def nicSort(nics):
"Return a list of nics/interfaces ordered by name"
@@ -141,6 +159,7 @@
nics_list.append((prefix, intidx, stridx + postfix))
return [x + z for x, y, z in sorted(nics_list)]
+
class ConfigWriter(object):
NET_CONF_PREF = netinfo.NET_CONF_DIR + 'ifcfg-'
@@ -274,7 +293,10 @@
self._persistentBackup(filename)
def _atomicBackup(self, filename):
- """Backs up configuration to memory, for a later rollback in case of error."""
+ """
+ Backs up configuration to memory,
+ for a later rollback in case of error.
+ """
if filename not in self._backups:
try:
@@ -378,8 +400,9 @@
'disabled', exc_info=True)
def _createConfFile(self, conf, name, ipaddr=None, netmask=None,
- gateway=None, bootproto=None, mtu=None, onboot='yes', **kwargs):
+ gateway=None, bootproto=None, mtu=None, onboot='yes', **kwargs):
""" Create ifcfg-* file with proper fields per device """
+
cfg = """DEVICE=%s\nONBOOT=%s\n""" % (pipes.quote(name),
pipes.quote(onboot))
cfg += conf
@@ -454,8 +477,9 @@
bootproto, mtu, onboot, **kwargs)
# create the bonding device to avoid initscripts noise
- if bonding not in open('/sys/class/net/bonding_masters').read().split():
- open('/sys/class/net/bonding_masters', 'w').write('+%s\n' % bonding)
+ bondMastersPath = '/sys/class/net/bonding_masters'
+ if bonding not in open(bondMastersPath).read().split():
+ open(bondMastersPath, 'w').write('+%s\n' % bonding)
def addNic(self, nic, bonding=None, bridge=None, mtu=None,
ipaddr=None, netmask=None, gateway=None, bootproto=None,
@@ -489,8 +513,8 @@
cf = self.NET_CONF_PREF + nic
self._backup(cf)
try:
- hwlines = [ line for line in open(cf).readlines()
- if line.startswith('HWADDR=') ]
+ hwlines = [line for line in open(cf).readlines()
+ if line.startswith('HWADDR=')]
l = ['DEVICE=%s\n' % nic, 'ONBOOT=yes\n'] + hwlines
open(cf, 'w').writelines(l)
except IOError:
@@ -528,8 +552,8 @@
its value or None if not found
"""
with open(conffile) as f:
- entries = [ line for line in f.readlines()
- if line.startswith(entry + '=') ]
+ entries = [line for line in f.readlines()
+ if line.startswith(entry + '=')]
if len(entries) != 0:
value = entries[0].split('=', 1)[1]
return value.strip()
@@ -554,8 +578,8 @@
the configuration file
"""
with open(conffile) as f:
- entries = [ line for line in f.readlines()
- if not line.startswith(entry + '=') ]
+ entries = [line for line in f.readlines()
+ if not line.startswith(entry + '=')]
if not delete:
entries.append('\n' + entry + '=' + value)
@@ -606,12 +630,14 @@
else:
return
- nics, delvlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(bridge)
+ nics, delvlan, bonding = (_netinfo
+ .getNicsVlanAndBondingForNetwork(bridge))
if delvlan is None:
return
if bonding:
- iface_bridged = _netinfo.getBridgedNetworksAndVlansForIface(bonding)
+ iface_bridged = (_netinfo
+ .getBridgedNetworksAndVlansForIface(bonding))
vlans = [v for (_, v) in iface_bridged]
iface = bonding
else:
@@ -641,14 +667,18 @@
cf = self.NET_CONF_PREF + nics[0]
self._updateConfigValue(cf, 'MTU', str(newmtu), newmtu is None)
+
def isBridgeNameValid(bridgeName):
return bridgeName and len(bridgeName) <= MAX_BRIDGE_NAME_LEN and \
len(set(bridgeName) & ILLEGAL_BRIDGE_CHARS) == 0 and \
not bridgeName.startswith('-')
+
def validateBridgeName(bridgeName):
if not isBridgeNameValid(bridgeName):
- raise ConfigNetworkError(ne.ERR_BAD_BRIDGE, "Bridge name isn't valid: %r"%bridgeName)
+ raise ConfigNetworkError(ne.ERR_BAD_BRIDGE,
+ "Bridge name isn't valid: %r" % bridgeName)
+
def _validateIpAddress(address):
try:
@@ -662,27 +692,36 @@
return False
return True
+
def validateIpAddress(ipAddr):
if not _validateIpAddress(ipAddr):
- raise ConfigNetworkError(ne.ERR_BAD_ADDR, "Bad IP address: %r"%ipAddr)
+ raise ConfigNetworkError(ne.ERR_BAD_ADDR,
+ "Bad IP address: %r" % ipAddr)
+
def validateNetmask(netmask):
if not _validateIpAddress(netmask):
- raise ConfigNetworkError(ne.ERR_BAD_ADDR, "Bad netmask: %r"%netmask)
+ raise ConfigNetworkError(ne.ERR_BAD_ADDR,
+ "Bad netmask: %r" % netmask)
+
def validateGateway(gateway):
if not _validateIpAddress(gateway):
- raise ConfigNetworkError(ne.ERR_BAD_ADDR, "Bad gateway: %r"%gateway)
+ raise ConfigNetworkError(ne.ERR_BAD_ADDR,
+ "Bad gateway: %r" % gateway)
+
def validateBondingName(bonding):
if not re.match('^bond[0-9]+$', bonding):
- raise ConfigNetworkError(ne.ERR_BAD_BONDING, '%r is not a valid bonding device name' % bonding)
+ raise ConfigNetworkError(ne.ERR_BAD_BONDING,
+ '%r is not a valid bonding device name' % bonding)
+
def validateBondingOptions(bonding, bondingOptions):
'Example: BONDING_OPTS="mode=802.3ad miimon=150"'
try:
for option in bondingOptions.split():
- key,value = option.split('=')
+ key, value = option.split('=')
if not os.path.exists('/sys/class/net/%(bonding)s/bonding/%(key)s'
% locals()):
raise ConfigNetworkError(ne.ERR_BAD_BONDING,
@@ -691,12 +730,15 @@
raise ConfigNetworkError(ne.ERR_BAD_BONDING,
"Error parsing bonding options: %r" % bondingOptions)
+
def validateVlanId(vlan):
try:
if not 0 <= int(vlan) <= MAX_VLAN_ID:
- raise ConfigNetworkError(ne.ERR_BAD_VLAN, 'vlan id out of range: %r, must be 0..%s' % (vlan, MAX_VLAN_ID))
+ raise ConfigNetworkError(ne.ERR_BAD_VLAN,
+ 'vlan id out of range: %r, must be 0..%s' % (vlan, MAX_VLAN_ID))
except ValueError:
raise ConfigNetworkError(ne.ERR_BAD_VLAN, 'vlan id must be a number')
+
def _validateInterNetworkCompatibility(ni, vlan, iface, bridged):
"""
@@ -737,6 +779,7 @@
raise ConfigNetworkError(ne.ERR_BAD_PARAMS,
"interface %r already has networks" % \
(iface))
+
def _addNetworkValidation(_netinfo, network, vlan, bonding, nics, ipaddr,
netmask, gateway, bondingOptions, bridged=True,
@@ -817,9 +860,11 @@
else:
_validateInterNetworkCompatibility(_netinfo, vlan, nic, bridged)
+
def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None,
netmask=None, mtu=None, gateway=None, force=False,
- configWriter=None, bondingOptions=None, bridged=True, **options):
+ configWriter=None, bondingOptions=None, bridged=True,
+ **options):
nics = nics or ()
_netinfo = netinfo.NetInfo()
bridged = utils.tobool(bridged)
@@ -831,9 +876,9 @@
if not utils.tobool(force):
logging.debug('validating network...')
_addNetworkValidation(_netinfo, network=network,
- vlan=vlan, bonding=bonding, nics=nics, ipaddr=ipaddr,
- netmask=netmask, gateway=gateway, bondingOptions=bondingOptions,
- bridged=bridged, **options)
+ vlan=vlan, bonding=bonding, nics=nics, ipaddr=ipaddr,
+ netmask=netmask, gateway=gateway, bondingOptions=bondingOptions,
+ bridged=bridged, **options)
logging.info("Adding network %s with vlan=%s, bonding=%s, nics=%s,"
" bondingOptions=%s, mtu=%s, bridged=%s, options=%s",
@@ -932,6 +977,7 @@
# add libvirt network
configWriter.createLibvirtNetwork(network, bridged, iface)
+
def assertBridgeClean(bridge, vlan, bonding, nics):
brifs = os.listdir('/sys/class/net/%s/brif/' % bridge)
for nic in nics:
@@ -949,7 +995,9 @@
pass
if brifs:
- raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'bridge %s has interfaces %s connected' % (bridge, brifs))
+ raise ConfigNetworkError(ne.ERR_USED_BRIDGE,
+ 'bridge %s has interfaces %s connected' % (bridge, brifs))
+
def showNetwork(network):
_netinfo = netinfo.NetInfo()
@@ -975,12 +1023,14 @@
print "vlan=%s, bonding=%s, nics=%s" % (vlan, bonding, nics)
+
def listNetworks():
_netinfo = netinfo.NetInfo()
print "Networks:", _netinfo.networks.keys()
print "Vlans:", _netinfo.vlans.keys()
print "Nics:", _netinfo.nics.keys()
print "Bondings:", _netinfo.bondings.keys()
+
def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
configWriter=None, implicitBonding=True, **options):
@@ -1069,6 +1119,7 @@
ifdown(name)
ifup(name)
+
def clientSeen(timeout):
start = time.time()
while timeout >= 0:
@@ -1079,19 +1130,23 @@
return False
-def editNetwork(oldBridge, newBridge, vlan=None, bonding=None, nics=None, **options):
+def editNetwork(oldBridge, newBridge, vlan=None, bonding=None, nics=None,
+ **options):
configWriter = ConfigWriter()
try:
delNetwork(oldBridge, configWriter=configWriter, **options)
- addNetwork(newBridge, vlan=vlan, bonding=bonding, nics=nics, configWriter=configWriter, **options)
+ addNetwork(newBridge, vlan=vlan, bonding=bonding, nics=nics,
+ configWriter=configWriter, **options)
except:
configWriter.restoreBackups()
raise
if utils.tobool(options.get('connectivityCheck', False)):
- if not clientSeen(int(options.get('connectivityTimeout', CONNECTIVITY_TIMEOUT_DEFAULT))):
+ if not clientSeen(int(options.get('connectivityTimeout',
+ CONNECTIVITY_TIMEOUT_DEFAULT))):
delNetwork(newBridge, force=True)
configWriter.restoreBackups()
return define.errCode['noConPeer']['status']['code']
+
def _validateNetworkSetup(networks={}, bondings={}):
_netinfo = netinfo.NetInfo()
@@ -1099,7 +1154,8 @@
for network, networkAttrs in networks.iteritems():
if networkAttrs.get('remove', False):
if set(networkAttrs) - set(['remove']):
- raise ConfigNetworkError(ne.ERR_BAD_PARAMS, "Cannot specify any attribute when removing")
+ raise ConfigNetworkError(ne.ERR_BAD_PARAMS,
+ "Cannot specify any attribute when removing")
for bonding, bondingAttrs in bondings.iteritems():
validateBondingName(bonding)
@@ -1108,14 +1164,17 @@
if bondingAttrs.get('remove', False):
if bonding not in _netinfo.bondings:
- raise ConfigNetworkError(ne.ERR_BAD_BONDING, 'Cannot remove bonding %s: Doesn\'t exist' % bonding)
+ raise ConfigNetworkError(ne.ERR_BAD_BONDING,
+ 'Cannot remove bonding %s: Doesn\'t exist' % bonding)
continue
nics = bondingAttrs.get('nics', None)
if not nics:
- raise ConfigNetworkError(ne.ERR_BAD_PARAMS, "Must specify nics for bonding")
+ raise ConfigNetworkError(ne.ERR_BAD_PARAMS,
+ "Must specify nics for bonding")
if not set(nics).issubset(set(_netinfo.nics)):
- raise ConfigNetworkError(ne.ERR_BAD_NIC, "Unknown nics in: %r"%list(nics))
+ raise ConfigNetworkError(ne.ERR_BAD_NIC,
+ "Unknown nics in: %r" % list(nics))
def _editBondings(bondings, configWriter):
@@ -1166,6 +1225,7 @@
for nic in nicSort(bondAttrs['nics']):
ifup(nic)
+
def _removeBondings(bondings, configWriter):
""" Remove bond interface """
logger = logging.getLogger("_removeBondings")
@@ -1191,7 +1251,7 @@
Params:
networks - dict of key=network, value=attributes
- where 'attributes' is a dict with the following optional items:
+ where 'attributes' is a dict with the following optional items:
vlan=<id>
bonding="<name>" | nic="<name>"
(bonding and nics are mutually exclusive)
@@ -1206,7 +1266,7 @@
remove=True (other attributes can't be specified)
bondings - dict of key=bonding, value=attributes
- where 'attributes' is a dict with the following optional items:
+ where 'attributes' is a dict with the following optional items:
nics=["<nic1>" , "<nic2>", ...]
options="<bonding-options>"
-- OR --
@@ -1283,9 +1343,8 @@
elif d['bonding'] in _ni.bondings:
logger.debug("Updating bond %r info", d['bonding'])
d['nics'] = _ni.bondings[d['bonding']]['slaves']
- d['bondingOptions'] = \
- _ni.bondings[d['bonding']]['cfg'].get('BONDING_OPTS',
- None)
+ d['bondingOptions'] = (_ni.bondings[d['bonding']]
+ ['cfg'].get('BONDING_OPTS', None))
else:
d['nics'] = [d.pop('nic')]
d['force'] = force
@@ -1313,16 +1372,19 @@
logger.error(e, exc_info=True)
raise
+
def setSafeNetworkConfig():
"""Declare current network configuration as 'safe'"""
subprocess.Popen([constants.EXT_VDSM_STORE_NET_CONFIG])
+
def usage():
print """Usage:
./configNetwork.py add Network <attributes> <options>
edit oldNetwork newNetwork <attributes> <options>
del Network <options>
- setup Network [None|attributes] [++ Network [None|attributes] [++ ...]] [:: <options>]
+ setup Network [None|attributes] \
+[++ Network [None|attributes] [++ ...]] [:: <options>]
attributes = [vlan=...] [bonding=...] [nics=<nic1>,...]
options = [Force=<True|False>] [bridged=<True|False>]...
@@ -1336,6 +1398,7 @@
API.Global.translateNetOptionsToNew(kwargs)
return kwargs
+
def main():
if len(sys.argv) <= 1:
@@ -1367,9 +1430,9 @@
kwargs['nics'] = kwargs['nics'].split(',')
editNetwork(oldBridge, newBridge, **kwargs)
elif sys.argv[1] == 'setup':
- batchCommands, options = utils.listSplit( sys.argv[2:], '::', 1 )
+ batchCommands, options = utils.listSplit(sys.argv[2:], '::', 1)
d = {}
- for batchCommand in utils.listSplit( batchCommands, '++' ):
+ for batchCommand in utils.listSplit(batchCommands, '++'):
d[batchCommand[0]] = _parseKwargs(batchCommand[1:]) or None
setupNetworks(d, **_parseKwargs(options))
elif sys.argv[1] == 'show':
--
To view, visit http://gerrit.ovirt.org/7758
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I02be4c0cdb1868a8518a73e22dfb77adedc08f3f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Mark Wu <wudxw(a)linux.vnet.ibm.com>
11 years, 2 months
Change in vdsm[master]: Set right MTU when removing bridgeless networks
by Igor Lvovsky
Igor Lvovsky has uploaded a new change for review.
Change subject: Set right MTU when removing bridgeless networks
......................................................................
Set right MTU when removing bridgeless networks
Bug-Id: https://bugzilla.redhat.com/show_bug.cgi?id=854919
Change-Id: I63003d5e2dd48f1eedc8f355705eefaa7ae81bd7
Signed-off-by: Igor Lvovsky <ilvovsky(a)redhat.com>
---
M vdsm/configNetwork.py
1 file changed, 33 insertions(+), 27 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/11/7811/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 1ee4c4e..6fe7ac7 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -587,48 +587,55 @@
mtu = mtuval
return mtu
- def setNewMtu(self, bridge):
+ def setNewMtu(self, network, bridged):
"""
- Set new MTU value to bridge and its interfaces
+ Set new MTU value to network and its interfaces
- :param bridge: bridge name
- :type bridge: string
+ :param network: network name
+ :type network: string
+ :param bridged: network type (bridged or bridgeless)
+ :type bridged: bool
- Update MTU to devices (bridge, interfaces, bonds and vlans)
- Or added a new value,
- also set the bridge to the higher value if its under vlans or bond
+ Update MTU to devices (vlans, bonds and nics)
+ or added a new value
"""
_netinfo = netinfo.NetInfo()
- cf = self.NET_CONF_PREF + bridge
- currmtu = self._getConfigValue(cf, 'MTU')
- if currmtu:
- currmtu = int(currmtu)
- else:
- return
+ currmtu = None
+ if bridged:
+ cf = self.NET_CONF_PREF + network
+ currmtu = self._getConfigValue(cf, 'MTU')
+ if currmtu:
+ currmtu = int(currmtu)
+ else:
+ # Optimization: if network hasn't custom MTU, do nothing
+ return
- nics, delvlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(bridge)
+ nics, delvlan, bonding = \
+ _netinfo.getNicsVlanAndBondingForNetwork(network)
if delvlan is None:
return
- if bonding:
- iface_bridged = _netinfo.getBridgedNetworksAndVlansForIface(bonding)
- vlans = [v for (_, v) in iface_bridged]
- iface = bonding
- else:
- vlans = _netinfo.getVlansForIface(nics[0])
- iface = nics[0]
+ iface = bonding if bonding else nics[0]
+ vlans = _netinfo.getVlansForIface(iface)
newmtu = None
for vlan in vlans:
- if vlan == delvlan:
- continue
cf = self.NET_CONF_PREF + iface + '.' + vlan
mtu = self._getConfigValue(cf, 'MTU')
if mtu:
mtu = int(mtu)
+
+ if vlan == delvlan:
+ # For VLANed bridgeless networks use MTU of delvlan
+ # as current MTU
+ if not bridged and mtu:
+ currmtu = mtu
+ continue
+
newmtu = max(newmtu, mtu)
- if newmtu != currmtu:
+ # Optimization: if network hasn't custom MTU (currmtu), do nothing
+ if currmtu and newmtu != currmtu:
if bonding:
cf = self.NET_CONF_PREF + bonding
self._updateConfigValue(cf, 'MTU', str(newmtu), newmtu is None)
@@ -1021,10 +1028,9 @@
if bridged:
assertBridgeClean(network, vlan, bonding, nics)
- if bridged:
- configWriter.setNewMtu(network)
-
+ configWriter.setNewMtu(network=network, bridged=bridged)
configWriter.removeLibvirtNetwork(network)
+
# We need to gather NetInfo again to refresh networks info from libvirt.
# The deleted bridge should never be up at this stage.
if network in netinfo.NetInfo().networks:
--
To view, visit http://gerrit.ovirt.org/7811
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I63003d5e2dd48f1eedc8f355705eefaa7ae81bd7
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Igor Lvovsky <ilvovsky(a)redhat.com>
11 years, 2 months
Change in vdsm[master]: Continue support nicless bridge.
by Igor Lvovsky
Igor Lvovsky has uploaded a new change for review.
Change subject: Continue support nicless bridge.
......................................................................
Continue support nicless bridge.
In general we can define bridge without connect it to any interface (nic/bond).
This behaviour was broken mistakenly in previous commits, fixed now.
Change-Id: Ief7138b659370fef9b38987980216dd8453cfee1
Signed-off-by: Igor Lvovsky <ilvovsky(a)redhat.com>
---
M vdsm/configNetwork.py
1 file changed, 15 insertions(+), 13 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/31/7831/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 6fe7ac7..0afc012 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1040,20 +1040,22 @@
if network and bridged:
configWriter.removeBridge(network)
- iface = bonding if bonding else nics[0]
- if vlan:
- configWriter.removeVlan(vlan, iface)
- else:
- cf = configWriter.NET_CONF_PREF + iface
- if not bridged:
- # When removing bridgeless non-VLANed network
- # we need to remove IP/NETMASK from the cfg file
- for key in ('IPADDR', 'NETMASK', 'GATEWAY', 'BOOTPROTO'):
- configWriter._updateConfigValue(cf, key, '', True)
+ nic = nics[0] if nics else None
+ iface = bonding if bonding else nic
+ if iface:
+ if vlan:
+ configWriter.removeVlan(vlan, iface)
else:
- # When removing bridged non-VLANed network
- # we need to remove BRIDGE from the cfg file
- configWriter._updateConfigValue(cf, 'BRIDGE', '', True)
+ cf = configWriter.NET_CONF_PREF + iface
+ if not bridged:
+ # When removing bridgeless non-VLANed network
+ # we need to remove IP/NETMASK from the cfg file
+ for key in ('IPADDR', 'NETMASK', 'GATEWAY', 'BOOTPROTO'):
+ configWriter._updateConfigValue(cf, key, '', True)
+ else:
+ # When removing bridged non-VLANed network
+ # we need to remove BRIDGE from the cfg file
+ configWriter._updateConfigValue(cf, 'BRIDGE', '', True)
# The (relatively) new setupNetwork verb allows to remove a network
# defined on top of an bonding device without break the bond itself.
--
To view, visit http://gerrit.ovirt.org/7831
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ief7138b659370fef9b38987980216dd8453cfee1
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Igor Lvovsky <ilvovsky(a)redhat.com>
11 years, 2 months