Compare commits

..

2 commits

Author SHA1 Message Date
Federico Simoncelli
2b4a2bbcce update to vdsm-4.10.0-13
- setup: move the certificate generation
2013-01-03 15:12:29 +01:00
Federico Simoncelli
8575566491 update to vdsm-4.10.0-12
- configure selinux for sanlock on nfs

Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
2012-10-27 03:39:04 +02:00
50 changed files with 4108 additions and 1 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/vdsm-*.tar.gz

View file

@ -0,0 +1,70 @@
From 8cf22884c2134353981bca1cb0600451391dd0de Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Tue, 19 Jun 2012 00:17:13 +0300
Subject: [PATCH 01/17] deployUtil.yumFind: rename and simplify semantics
deployUtil.yumListPackages is a convenience wrapper around
yum.YumBase.pkgSack.searchNevra()
Change-Id: I5ad5405ae0f8548c0116ac5a8066325455aef13a
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5467
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Tested-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5542
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm_reg/deployUtil.py.in | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index 976295f..c80b487 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -1029,18 +1029,16 @@ def installAndVerify(pckgType, pckgName, action, args=None):
return fReturn, msg
-def yumFind(pkgName):
+def yumListPackages(pkgName):
"""
Returns a list of available packages exists in yum's db.
"""
import yum
- lReturn = None
my = yum.YumBase()
my.preconf.debuglevel = 0 # Remove yum noise
- lReturn = my.pkgSack.searchNevra(name=pkgName)
+ return my.pkgSack.searchNevra(name=pkgName)
- return lReturn
def yumSearch(pkgName):
"""
@@ -1048,8 +1046,8 @@ def yumSearch(pkgName):
"""
fReturn = False
- pkgs = yumFind(pkgName)
- if pkgs and len(pkgs)>0:
+ pkgs = yumListPackages(pkgName)
+ if pkgs:
fReturn = True
logging.debug("yumSearch: found " + str(pkgName) + " entries: " + str(pkgs))
else:
@@ -1064,8 +1062,8 @@ def yumSearchVersion(pkgName, ver, startWith=True):
"""
fReturn = False
- pkgs = yumFind(pkgName)
- if pkgs and len(pkgs)>0:
+ pkgs = yumListPackages(pkgName)
+ if pkgs:
for item in pkgs:
if startWith:
if str(item).startswith(ver):
--
1.7.1

View file

@ -0,0 +1,63 @@
From 5edbed09c4091959e569e8cccc888bb72958082b Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Tue, 19 Jun 2012 00:21:55 +0300
Subject: [PATCH 02/17] drop deployUtil.yumSearch
It was just a complex way of calculating bool(yumFind()).
Change-Id: Iafc9d67fef5cb348255b06a9e6b404a70ec35693
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5468
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Tested-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5543
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vds_bootstrap/vds_bootstrap.py | 2 +-
vdsm_reg/deployUtil.py.in | 16 ----------------
2 files changed, 1 insertions(+), 17 deletions(-)
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index 0df5023..12e127e 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -225,7 +225,7 @@ class Deploy:
rc = True
try:
- rc = deployUtil.yumSearch(VDSM_NAME)
+ rc = bool(deployUtil.yumListPackages(VDSM_NAME))
except:
rc = False
logging.error("checkRegistration: Error searching for VDSM package!",
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index c80b487..1adf1a5 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -1039,22 +1039,6 @@ def yumListPackages(pkgName):
my.preconf.debuglevel = 0 # Remove yum noise
return my.pkgSack.searchNevra(name=pkgName)
-
-def yumSearch(pkgName):
- """
- Returns True is package exists in yum's db.
- """
- fReturn = False
-
- pkgs = yumListPackages(pkgName)
- if pkgs:
- fReturn = True
- logging.debug("yumSearch: found " + str(pkgName) + " entries: " + str(pkgs))
- else:
- logging.debug("yumSearch: package " + str(pkgName) + " not found!")
-
- return fReturn
-
def yumSearchVersion(pkgName, ver, startWith=True):
"""
Returns True is package exists in yum's db with the given version.
--
1.7.1

View file

@ -0,0 +1,95 @@
From 67309fc8a7a4edd4996490b64f51ce37f0ed2327 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Tue, 19 Jun 2012 00:33:22 +0300
Subject: [PATCH 03/17] deployUtil.yumSearchVersion: compare versions sanely
Change-Id: I0aa40c3395ca012a21f148f20125b54e3ba16d8a
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5469
Reviewed-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Tested-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5544
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
---
vds_bootstrap/vds_bootstrap.py | 6 +++---
vdsm_reg/deployUtil.py.in | 31 +++++++------------------------
2 files changed, 10 insertions(+), 27 deletions(-)
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index 12e127e..9801459 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -80,13 +80,13 @@ fedorabased = deployUtil.versionCompare(deployUtil.getOSVersion(), "16") >= 0
if rhel6based:
VDSM_NAME = "vdsm"
- VDSM_MIN_VER = VDSM_NAME + "-4.9"
+ VDSM_MIN_VER = "4.9"
KERNEL_VER = "2.6.32-.*.el6"
KERNEL_MIN_VER = 150
MINIMAL_SUPPORTED_PLATFORM = "6.0"
else:
VDSM_NAME = "vdsm22"
- VDSM_MIN_VER = VDSM_NAME + "-4.5"
+ VDSM_MIN_VER = "4.5"
KERNEL_VER = "2.6.18-.*.el5"
KERNEL_MIN_VER = 159
MINIMAL_SUPPORTED_PLATFORM = "5.5"
@@ -250,7 +250,7 @@ class Deploy:
rc = True
try:
- rc = deployUtil.yumSearchVersion(VDSM_NAME, VDSM_MIN_VER, True)
+ rc = deployUtil.yumSearchVersion(VDSM_NAME, VDSM_MIN_VER)
except:
rc = False
logging.error("checkMajorVersion: Error searching for VDSM version!",
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index 1adf1a5..1474196 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -1039,32 +1039,15 @@ def yumListPackages(pkgName):
my.preconf.debuglevel = 0 # Remove yum noise
return my.pkgSack.searchNevra(name=pkgName)
-def yumSearchVersion(pkgName, ver, startWith=True):
- """
- Returns True is package exists in yum's db with the given version.
- Note: yum internal code has verEQ and verGT. We should use it ASAP.
- """
- fReturn = False
+def yumSearchVersion(pkgName, ver):
+ "Return True if package exists in yum's db with the given version or higer"
+ import rpmUtils.miscutils
- pkgs = yumListPackages(pkgName)
- if pkgs:
- for item in pkgs:
- if startWith:
- if str(item).startswith(ver):
- fReturn = True
- logging.debug("yumSearchVersion: pkg " + str(item) + " starts with: " + ver)
- else:
- logging.debug("yumSearchVersion: pkg " + str(item) + " does not start with: " + ver)
- else:
- if str(item) == ver:
- fReturn = True
- logging.debug("yumSearchVersion: pkg " + str(item) + " matches: " + ver)
- else:
- logging.debug("yumSearchVersion: pkg " + str(item) + " does not match: " + ver)
+ for pkg in yumListPackages(pkgName):
+ if rpmUtils.miscutils.compareVerOnly(pkg.ver, ver) >= 0:
+ return True
else:
- logging.debug("yumSearchVersion: package " + str(pkgName) + " not found!")
-
- return fReturn
+ return False
#############################################################################################################
# Host PKI functions.
--
1.7.1

View file

@ -0,0 +1,77 @@
From 165284de4e03fb72fb9e4ca811fbcc77618ff02d Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Mon, 4 Jun 2012 11:02:56 +0300
Subject: [PATCH 04/17] Iterates over delete candidates networks only once
Change-Id: Iec45c1cb3d76a70555e256f96c983e13a0518cbe
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5204
Reviewed-by: Livnat Peer <lpeer@redhat.com>
Reviewed-by: Shu Ming <shuming@linux.vnet.ibm.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5546
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 26 ++++++++++++--------------
1 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index b37ff0f..3f2e5fe 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1010,26 +1010,23 @@ def setupNetworks(networks={}, bondings={}, **options):
networksAdded = []
#bondingNetworks = {} # Reminder TODO
- logger.info("Setting up network")
- logger.debug("Setting up network according to configuration: networks:%r, bondings:%r, options:%r" % (networks, bondings, options))
+ logger.debug("Setting up network according to configuration: "
+ "networks:%r, bondings:%r, options:%r" % (networks,
+ bondings, options))
force = options.get('force', False)
if not utils.tobool(force):
logging.debug("Validating configuration")
- _validateNetworkSetup(dict(networks), dict(bondings), explicitBonding=options.get('explicitBonding', False))
+ _validateNetworkSetup(dict(networks), dict(bondings),
+ explicitBonding=options.get('explicitBonding',
+ False))
logger.debug("Applying...")
try:
- delnetworks = {}
- for network, networkAttrs in networks.iteritems():
+ # Remove networks with 'remove' attribute
+ for network, networkAttrs in networks.items():
if 'remove' in networkAttrs:
- delnetworks[network] = networkAttrs
-
- for network, networkAttrs in delnetworks.iteritems():
- if networkAttrs.pop('remove', False):
- assert not networkAttrs
-
- logger.debug('Removing network %r'%network)
+ logger.debug("Removing network %r" % network)
delNetwork(network, configWriter=configWriter, force=force)
del networks[network]
@@ -1041,12 +1038,13 @@ def setupNetworks(networks={}, bondings={}, **options):
d = dict(networkAttrs)
if 'bonding' in d:
d['nics'] = bondings[d['bonding']]['nics']
- d['bondingOptions'] = bondings[d['bonding']].get('options', None)
+ d['bondingOptions'] = bondings[d['bonding']].get('options',
+ None)
else:
d['nics'] = [d.pop('nic')]
d['force'] = force
- logger.debug('Adding network %r'%network)
+ logger.debug("Adding network %r" % network)
addNetwork(network, configWriter=configWriter, **d)
if utils.tobool(options.get('connectivityCheck', True)):
--
1.7.1

View file

@ -0,0 +1,33 @@
From 752dd81155caf00895d14fadc4aa1cbbc3e88364 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Mon, 4 Jun 2012 15:08:09 +0300
Subject: [PATCH 05/17] 'options' translation in setupNetworks is not relevant
Change-Id: I68871fe1a4112fd7223e794a1b67bf98e26c104c
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5205
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Lei Li <lilei@linux.vnet.ibm.com>
Tested-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-by: Livnat Peer <lpeer@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5547
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/API.py | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/vdsm/API.py b/vdsm/API.py
index c098b4b..70034aa 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1145,7 +1145,6 @@ class Global(object):
def setupNetworks(self, networks={}, bondings={}, options={}):
"""Add a new network to this vds, replacing an old one."""
- self._translateOptionsToNew(options)
if not self._cif._networkSemaphore.acquire(blocking=False):
self.log.warn('concurrent network verb already executing')
return errCode['unavail']
--
1.7.1

View file

@ -0,0 +1,97 @@
From 4accdc21e59f573ec0135ceb0faeda1b452acb22 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Mon, 4 Jun 2012 20:23:28 +0300
Subject: [PATCH 06/17] Minor optimization for delNetwork
Change-Id: I66a37cb1100411af13197642bdb13ae745bc6e53
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5207
Reviewed-by: Lei Li <lilei@linux.vnet.ibm.com>
Tested-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5548
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 31 +++++++++++++++++++------------
1 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 3f2e5fe..8d71375 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -736,22 +736,25 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
if not utils.tobool(options.get('skipLibvirt', False)):
if network not in _netinfo.networks:
- raise ConfigNetworkError(ne.ERR_BAD_BRIDGE, "Cannot delete network %r: It doesn't exist" % network)
+ raise ConfigNetworkError(ne.ERR_BAD_BRIDGE,
+ "Cannot delete network %r: It doesn't exist" % network)
nics, vlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(network)
bridged = _netinfo.networks[network]['bridged']
else:
bridged = True
- logging.info("Removing network %s with vlan=%s, bonding=%s, nics=%s. options=%s"%(network, vlan, bonding, nics, options))
+ logging.info("Removing network %s with vlan=%s, bonding=%s, nics=%s,"
+ "options=%s" % (network, vlan, bonding, nics, options))
if not utils.tobool(force):
if bonding:
validateBondingName(bonding)
if set(nics) != set(_netinfo.bondings[bonding]["slaves"]):
- raise ConfigNetworkError(ne.ERR_BAD_NIC, 'delNetwork: %s are not all nics enslaved to %s' % (nics, bonding))
+ raise ConfigNetworkError(ne.ERR_BAD_NIC,
+ "delNetwork: %s are not all nics enslaved to %s" % \
+ (nics, bonding))
if vlan:
- #assertVlan(vlan)
validateVlanId(vlan)
if bridged:
assertBridgeClean(network, vlan, bonding, nics)
@@ -763,30 +766,34 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
configWriter.setNewMtu(network)
removeLibvirtNetwork(network, log=False)
- # the deleted bridge should never be up at this stage.
+ # 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().networks:
- raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'delNetwork: bridge %s still exists' % network)
+ raise ConfigNetworkError(ne.ERR_USED_BRIDGE,
+ "delNetwork: bridge %s still exists" % network)
if network and bridged:
ifdown(network)
subprocess.call([constants.EXT_BRCTL, 'delbr', network])
configWriter.removeBridge(network)
+
if vlan:
vlandev = (bonding or nics[0]) + '.' + vlan
ifdown(vlandev)
- subprocess.call([constants.EXT_VCONFIG, 'rem', vlandev], stderr=subprocess.PIPE)
+ subprocess.call([constants.EXT_VCONFIG, 'rem', vlandev],
+ stderr=subprocess.PIPE)
configWriter.removeVlan(vlan, bonding or nics[0])
+
if bonding:
if not bridged or not bondingOtherUsers(network, vlan, bonding):
ifdown(bonding)
- if not bridged or not bondingOtherUsers(network, vlan, bonding):
configWriter.removeBonding(bonding)
+
for nic in nics:
- if not bridged or not nicOtherUsers(network, vlan, bonding, nic):
+ nicUsers = nicOtherUsers(network, vlan, bonding, nic)
+ if not nicUsers:
ifdown(nic)
- if bridged and nicOtherUsers(network, vlan, bonding, nic):
- continue
- configWriter.removeNic(nic)
+ configWriter.removeNic(nic)
def clientSeen(timeout):
start = time.time()
--
1.7.1

View file

@ -0,0 +1,38 @@
From b66fdcfbfe9022aa6ec33df274a5a81a73d1af5f Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Mon, 4 Jun 2012 19:24:12 +0300
Subject: [PATCH 07/17] Don't ignore bridgeless networks in ifaceUsers
Change-Id: Id45b37683d52feebd1b31421c2a717695394147a
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5206
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5549
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 8d71375..fc43d67 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -86,9 +86,11 @@ def ifaceUsers(iface):
"Returns a list of entities using the interface"
_netinfo = NetInfo()
users = set()
- for b, bdict in _netinfo.networks.iteritems():
- if bdict['bridged'] and iface in bdict['ports']:
- users.add(b)
+ for n, ndict in _netinfo.networks.iteritems():
+ if ndict['bridged'] and iface in ndict['ports']:
+ users.add(n)
+ elif not ndict['bridged'] and iface == ndict['interface']:
+ users.add(n)
for b, bdict in _netinfo.bondings.iteritems():
if iface in bdict['slaves']:
users.add(b)
--
1.7.1

View file

@ -0,0 +1,65 @@
From 5bdaa7c0a1cc696ed4e1d492d9af576fd8c8e4eb Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Wed, 6 Jun 2012 09:25:03 +0300
Subject: [PATCH 08/17] Minor optimization for addNetwork
Change-Id: I5506140ccd065d76a77414593635598f26289829
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5208
Reviewed-by: Lei Li <lilei@linux.vnet.ibm.com>
Tested-by: Lei Li <lilei@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5550
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index fc43d67..89b3047 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -613,32 +613,27 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
ifdown(nic)
if bridged:
- configWriter.addBridge(network, ipaddr=ipaddr, netmask=netmask, mtu=mtu,
- gateway=gateway, **options)
+ configWriter.addBridge(network, ipaddr=ipaddr, netmask=netmask,
+ mtu=mtu, gateway=gateway, **options)
ifdown(network)
- # since we have vlan device, it is connected to the bridge. other
- # interfaces should be connected to the bridge through vlan, and not directly.
- brName = network if bridged and not vlan else None
+ brName = network if bridged else None
# nics must be activated in the same order of boot time to expose the correct
# MAC address.
for nic in nicSort(nics):
- if not bonding and bridged:
- configWriter.addNic(nic, bridge=brName, mtu=max(prevmtu, mtu))
+ configWriter.addNic(nic, bonding=bonding, bridge=brName, mtu=max(prevmtu, mtu))
ifup(nic)
if bonding:
configWriter.addBonding(bonding, bridge=brName, bondingOptions=bondingOptions, mtu=mtu)
- for nic in nics:
- configWriter.addNic(nic, bonding=bonding, mtu=max(prevmtu, mtu))
ifup(bonding)
+
if vlan:
iface += '.' + vlan
- configWriter.addVlan(vlan, bonding or nics[0], network=network if bridged else None, mtu=mtu, bridged=bridged)
- # since we have vlan device, it is connected to the network. other
- # interfaces should be connected to the network through vlan, and not
- # directly.
+ configWriter.addVlan(vlan, bonding or nics[0], network=brName,
+ mtu=mtu, bridged=bridged)
ifup((bonding or nics[0]) + '.' + vlan)
+
if bridged:
if options.get('bootproto') == 'dhcp' and not utils.tobool(options.get('blockingdhcp')):
# wait for dhcp in another thread, so vdsm won't get stuck (BZ#498940)
--
1.7.1

View file

@ -0,0 +1,37 @@
From 16e43715e9731db46b4ea519eb4c0c1294bf18a4 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Tue, 12 Jun 2012 15:38:27 +0300
Subject: [PATCH 09/17] Use already known iface in addNetwork
Change-Id: I085792401a04d7695855e81b16b442e4c31ab706
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5283
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5551
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 89b3047..87b32ed 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -629,10 +629,10 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
ifup(bonding)
if vlan:
- iface += '.' + vlan
- configWriter.addVlan(vlan, bonding or nics[0], network=brName,
+ configWriter.addVlan(vlan, iface, network=brName,
mtu=mtu, bridged=bridged)
- ifup((bonding or nics[0]) + '.' + vlan)
+ iface += '.' + vlan
+ ifup(iface)
if bridged:
if options.get('bootproto') == 'dhcp' and not utils.tobool(options.get('blockingdhcp')):
--
1.7.1

View file

@ -0,0 +1,39 @@
From 34a348e500b2c0f50f3de3095db8aa7d61f2953a Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Wed, 6 Jun 2012 14:16:37 +0300
Subject: [PATCH 10/17] Use proper MTU on bonding when add network
Change-Id: Id34f2462ddfc2c9f4a323235c79f919c0cce12a7
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5209
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5552
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 87b32ed..5353d0e 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -622,10 +622,13 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
# nics must be activated in the same order of boot time to expose the correct
# MAC address.
for nic in nicSort(nics):
- configWriter.addNic(nic, bonding=bonding, bridge=brName, mtu=max(prevmtu, mtu))
+ configWriter.addNic(nic, bonding=bonding, bridge=brName,
+ mtu=max(prevmtu, mtu))
ifup(nic)
if bonding:
- configWriter.addBonding(bonding, bridge=brName, bondingOptions=bondingOptions, mtu=mtu)
+ configWriter.addBonding(bonding, bridge=brName,
+ bondingOptions=bondingOptions,
+ mtu=max(prevmtu, mtu))
ifup(bonding)
if vlan:
--
1.7.1

View file

@ -0,0 +1,50 @@
From 69af2fcbdedfe6eab77c4c748a911caa78366590 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Tue, 12 Jun 2012 16:03:04 +0300
Subject: [PATCH 11/17] Add bridge on top of VLAN if exists
In VLAN case we should attach bridge only to the VLAN
rather than to underlying NICs or bond
Change-Id: I1c554853b5be9330933174da810b6d67c83eb96e
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5284
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5553
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 5353d0e..97aec7c 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -617,16 +617,19 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
mtu=mtu, gateway=gateway, **options)
ifdown(network)
+ # For VLAN we should attach bridge only to the VLAN device
+ # rather than to underlying NICs or bond
brName = network if bridged else None
+ bridgeForNic = None if vlan else brName
- # nics must be activated in the same order of boot time to expose the correct
- # MAC address.
+ # NICs must be activated in the same order of boot time
+ # to expose the correct MAC address.
for nic in nicSort(nics):
- configWriter.addNic(nic, bonding=bonding, bridge=brName,
+ configWriter.addNic(nic, bonding=bonding, bridge=bridgeForNic,
mtu=max(prevmtu, mtu))
ifup(nic)
if bonding:
- configWriter.addBonding(bonding, bridge=brName,
+ configWriter.addBonding(bonding, bridge=bridgeForNic,
bondingOptions=bondingOptions,
mtu=max(prevmtu, mtu))
ifup(bonding)
--
1.7.1

View file

@ -0,0 +1,30 @@
From b5198d7ea6325374ad166043cf8597a148870a14 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Mon, 11 Jun 2012 19:37:58 +0300
Subject: [PATCH 12/17] BZ#830485 - Add netConfigDirty bit to getVdsCaps report
Change-Id: Iba641a74d33157186ddc6ceb6196b531953c9c8b
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5257
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5554
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/API.py | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/vdsm/API.py b/vdsm/API.py
index 70034aa..abb3510 100644
--- a/vdsm/API.py
+++ b/vdsm/API.py
@@ -1073,6 +1073,7 @@ class Global(object):
Report host capabilities.
"""
c = caps.get()
+ c['netConfigDirty'] = str(self._cif._netConfigDirty)
return {'status': doneCode, 'info': c}
--
1.7.1

View file

@ -0,0 +1,132 @@
From 325aa66a2c32a6889f199628f2aedfaba742cb00 Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Wed, 13 Jun 2012 17:44:16 -0400
Subject: [PATCH 13/17] remove flag skipLibvirt
Currently, VDSM manage networks by it's own and uses libvirt to store the net definitions, not requiring any additional
flag as skipLibvirt. This patch will remove completely skipLibvirt flag.
Change-Id: Id87c89f04912976797d629344238749a8562382b
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5262
Reviewed-by: Shu Ming <shuming@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5555
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 29 ++++++++++-------------------
vdsm_reg/deployUtil.py.in | 5 ++---
2 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 97aec7c..effb279 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -238,8 +238,7 @@ class ConfigWriter(object):
s += 'NM_CONTROLLED=no\n'
BLACKLIST = ['TYPE', 'NAME', 'DEVICE', 'bondingOptions',
'force', 'blockingdhcp',
- 'connectivityCheck', 'connectivityTimeout',
- 'skipLibvirt']
+ 'connectivityCheck', 'connectivityTimeout']
for k in set(kwargs.keys()).difference(set(BLACKLIST)):
if re.match('^[a-zA-Z_]\w*$', k):
s += '%s=%s\n' % (k.upper(), pipes.quote(kwargs[k]))
@@ -493,7 +492,7 @@ def validateVlanId(vlan):
def _addNetworkValidation(_netinfo, bridge, vlan, bonding, nics, ipaddr, netmask, gateway,
- bondingOptions, bridged=True, skipLibvirt=False):
+ bondingOptions, bridged=True):
if (vlan or bonding) and not nics:
raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'vlan/bonding definition requires nics. got: %r'%(nics,))
@@ -502,12 +501,9 @@ def _addNetworkValidation(_netinfo, bridge, vlan, bonding, nics, ipaddr, netmask
validateBridgeName(bridge)
if bridge in _netinfo.networks:
raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'Bridge already exists')
- elif not skipLibvirt:
+
if bridge in _netinfo.getBridgelessNetworks():
raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'network already exists')
- else:
- raise ConfigNetworkError(ne.ERR_BAD_PARAMS,
- 'bridgeless network can not be added when skip libvirt')
# vlan
if vlan:
@@ -576,7 +572,6 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
gateway=None, force=False, configWriter=None, bondingOptions=None, bridged=True, **options):
nics = nics or ()
_netinfo = NetInfo()
- skipLibvirt = utils.tobool(options.get('skipLibvirt', False))
bridged = utils.tobool(bridged)
if mtu:
@@ -588,7 +583,7 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
_addNetworkValidation(_netinfo, bridge=network if bridged else None,
vlan=vlan, bonding=bonding, nics=nics, ipaddr=ipaddr,
netmask=netmask, gateway=gateway, bondingOptions=bondingOptions,
- bridged=bridged, skipLibvirt=skipLibvirt)
+ bridged=bridged)
logging.info("Adding network %s with vlan=%s, bonding=%s, nics=%s,"
" bondingOptions=%s, mtu=%s, bridged=%s, options=%s",
@@ -650,8 +645,7 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
ifup(network)
# add libvirt network
- if not skipLibvirt:
- createLibvirtNetwork(network, bridged, iface)
+ createLibvirtNetwork(network, bridged, iface)
def createLibvirtNetwork(network, bridged=True, iface=None):
conn = libvirtconnection.get()
@@ -737,15 +731,12 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
validateBridgeName(network)
- if not utils.tobool(options.get('skipLibvirt', False)):
- if network not in _netinfo.networks:
- raise ConfigNetworkError(ne.ERR_BAD_BRIDGE,
- "Cannot delete network %r: It doesn't exist" % network)
+ if network not in _netinfo.networks:
+ raise ConfigNetworkError(ne.ERR_BAD_BRIDGE,
+ "Cannot delete network %r: It doesn't exist" % network)
- nics, vlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(network)
- bridged = _netinfo.networks[network]['bridged']
- else:
- bridged = True
+ nics, vlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(network)
+ bridged = _netinfo.networks[network]['bridged']
logging.info("Removing network %s with vlan=%s, bonding=%s, nics=%s,"
"options=%s" % (network, vlan, bonding, nics, options))
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index 1474196..2f240cc 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -894,7 +894,7 @@ def makeBridge(vdcName, vdsmDir):
#Delete existing bridge in oVirt
if fReturn and fIsOvirt:
try:
- out, err, ret = _logExec([os.path.join(vdsmDir, SCRIPT_NAME_DEL), mgtBridge, vlan, bonding, nic] + ['skipLibvirt=True'])
+ out, err, ret = _logExec([os.path.join(vdsmDir, SCRIPT_NAME_DEL), mgtBridge, vlan, bonding, nic])
if ret:
if ret == 17: #ERR_BAD_BRIDGE
logging.debug("makeBridge Ignoring error of del existing bridge. out=" + out + "\nerr=" + str(err) + "\nret=" + str(ret))
@@ -909,8 +909,7 @@ def makeBridge(vdcName, vdsmDir):
if fReturn:
try:
lstBridgeOptions.append('blockingdhcp=true')
- out, err, ret = _logExec([os.path.join(vdsmDir, SCRIPT_NAME_ADD) , MGT_BRIDGE_NAME, vlan, bonding, nic] + lstBridgeOptions
- + ['skipLibvirt=True'])
+ out, err, ret = _logExec([os.path.join(vdsmDir, SCRIPT_NAME_ADD) , MGT_BRIDGE_NAME, vlan, bonding, nic] + lstBridgeOptions)
if ret:
fReturn = False
logging.debug("makeBridge Failed to add " + MGT_BRIDGE_NAME + " bridge out=" + out + "\nerr=" + str(err) + "\nret=" + str(ret))
--
1.7.1

View file

@ -0,0 +1,140 @@
From ca7a6b1244f7a400bf5dc51a5d59662e5602534b Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Wed, 13 Jun 2012 12:18:02 +0300
Subject: [PATCH 14/17] BZ#826873 - Allow to change bond without network attached to it
Change-Id: I3770017d8e633ccf5f9cf9b41a93df57229c443e
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5312
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5556
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++++-
vdsm/netinfo.py | 4 +++
2 files changed, 67 insertions(+), 1 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index effb279..fce3e71 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -958,6 +958,52 @@ def _validateNetworkSetup(networks={}, bondings={}, explicitBonding=False):
"Setup attached more than one network to bonding %s, some of which aren't vlans"%(bonding))
+def _editBondings(bondings, configWriter):
+ """ Add/Edit bond interface """
+ logger = logging.getLogger("_editBondings")
+
+ _netinfo = NetInfo()
+
+ for bond, bondAttrs in bondings.iteritems():
+ logger.debug("Creating/Editing bond %s with attributes %s",
+ bond, bondAttrs)
+ if bond in _netinfo.bondings:
+ ifdown(bond)
+ # Take down all bond's NICs.
+ for nic in _netinfo.getNicsForBonding(bond):
+ ifdown(nic)
+ configWriter.removeNic(nic)
+
+ # NICs must be activated in the same order of boot time
+ # to expose the correct MAC address.
+ for nic in nicSort(bondAttrs['nics']):
+ configWriter.addNic(nic, bonding=bond)
+ ifup(nic)
+
+ configWriter.addBonding(bond,
+ bondingOptions=bondAttrs.get('options', None))
+ ifup(bond)
+
+def _removeBondings(bondings, configWriter):
+ """ Add/Edit bond interface """
+ logger = logging.getLogger("_removeBondings")
+
+ _netinfo = NetInfo()
+
+ for bond, bondAttrs in bondings.items():
+ if 'remove' in bondAttrs:
+ nics = _netinfo.getNicsForBonding(bond)
+ logger.debug("Removing bond %r with nics = %s", bond, nics)
+ ifdown(bond)
+ configWriter.removeBonding(bond)
+
+ for nic in nics:
+ ifdown(nic)
+ configWriter.removeNic(nic)
+
+ del bondings[bond]
+
+
def setupNetworks(networks={}, bondings={}, **options):
"""Add/Edit/Remove configuration for networks and bondings.
@@ -1009,7 +1055,6 @@ def setupNetworks(networks={}, bondings={}, **options):
_netinfo = NetInfo()
configWriter = ConfigWriter()
networksAdded = []
- #bondingNetworks = {} # Reminder TODO
logger.debug("Setting up network according to configuration: "
"networks:%r, bondings:%r, options:%r" % (networks,
@@ -1031,16 +1076,21 @@ def setupNetworks(networks={}, bondings={}, **options):
delNetwork(network, configWriter=configWriter, force=force)
del networks[network]
+ handledBonds = set()
for network, networkAttrs in networks.items():
if network in _netinfo.networks:
delNetwork(network, configWriter=configWriter, force=force)
else:
networksAdded.append(network)
+
d = dict(networkAttrs)
if 'bonding' in d:
d['nics'] = bondings[d['bonding']]['nics']
d['bondingOptions'] = bondings[d['bonding']].get('options',
None)
+ # Don't remove bondX from the bonding list here,
+ # because it may be in use for other networks
+ handledBonds.add(d['bonding'])
else:
d['nics'] = [d.pop('nic')]
d['force'] = force
@@ -1048,6 +1098,18 @@ def setupNetworks(networks={}, bondings={}, **options):
logger.debug("Adding network %r" % network)
addNetwork(network, configWriter=configWriter, **d)
+ # Do not handle a bonding device twice.
+ # We already handled it before during addNetwork.
+ for bond in handledBonds:
+ del bondings[bond]
+
+ # We are now left with bondings whose network was not mentioned
+ # Remove bonds with 'remove' attribute
+ _removeBondings(bondings, configWriter)
+
+ # Check whether bonds should be resized
+ _editBondings(bondings, configWriter)
+
if utils.tobool(options.get('connectivityCheck', True)):
logger.debug('Checking connectivity...')
if not clientSeen(int(options.get('connectivityTimeout',
diff --git a/vdsm/netinfo.py b/vdsm/netinfo.py
index 05f8323..536b4c7 100644
--- a/vdsm/netinfo.py
+++ b/vdsm/netinfo.py
@@ -339,6 +339,10 @@ class NetInfo(object):
if nic in bdict['slaves']:
yield b
+ def getNicsForBonding(self, bond):
+ bondAttrs = self.bondings[bond]
+ return bondAttrs['slaves']
+
def getBondingForNic(self, nic):
bondings = list(self.getBondingsForNic(nic))
if bondings:
--
1.7.1

View file

@ -0,0 +1,47 @@
From d3c91bc345f27a78d17c836f04fe13f5d1be6856 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Sun, 10 Jun 2012 10:40:48 +0300
Subject: [PATCH 15/17] BZ#830486 - Allow to change network according the diffs from previous state
We may not receive any information about the bonding device if it is unchanged.
In this case vdsm shouldn't check the bond information of this network.
Change-Id: I1ece66a351576d5789a8968ccda9e67f423b860c
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5211
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5557
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index fce3e71..ab07da6 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1085,12 +1085,15 @@ def setupNetworks(networks={}, bondings={}, **options):
d = dict(networkAttrs)
if 'bonding' in d:
- d['nics'] = bondings[d['bonding']]['nics']
- d['bondingOptions'] = bondings[d['bonding']].get('options',
- None)
- # Don't remove bondX from the bonding list here,
- # because it may be in use for other networks
- handledBonds.add(d['bonding'])
+ # we may not receive any information
+ # about the bonding device if it is unchanged
+ if bondings:
+ d['nics'] = bondings[d['bonding']]['nics']
+ d['bondingOptions'] = bondings[d['bonding']].get('options',
+ None)
+ # Don't remove bondX from the bonding list here,
+ # because it may be in use for other networks
+ handledBonds.add(d['bonding'])
else:
d['nics'] = [d.pop('nic')]
d['force'] = force
--
1.7.1

View file

@ -0,0 +1,49 @@
From 990be7c6e07646fb176d90f679baa691b28d279f Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Wed, 13 Jun 2012 16:10:58 +0300
Subject: [PATCH 16/17] BZ#826467 - Allow to remove bond and attach network to NIC
Change-Id: I0be3dafe6a0a65a09bf268c8c8c6ee6fd7ba1084
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5323
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5558
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index ab07da6..0df6c8f 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1069,20 +1069,18 @@ def setupNetworks(networks={}, bondings={}, **options):
logger.debug("Applying...")
try:
- # Remove networks with 'remove' attribute
- for network, networkAttrs in networks.items():
- if 'remove' in networkAttrs:
- logger.debug("Removing network %r" % network)
- delNetwork(network, configWriter=configWriter, force=force)
- del networks[network]
-
- handledBonds = set()
+ # Remove edited networks and networks with 'remove' attribute
for network, networkAttrs in networks.items():
if network in _netinfo.networks:
+ logger.debug("Removing network %r" % network)
delNetwork(network, configWriter=configWriter, force=force)
+ if 'remove' in networkAttrs:
+ del networks[network]
else:
networksAdded.append(network)
+ handledBonds = set()
+ for network, networkAttrs in networks.iteritems():
d = dict(networkAttrs)
if 'bonding' in d:
# we may not receive any information
--
1.7.1

View file

@ -0,0 +1,31 @@
From 0329fec019726434a3313cc2acbd5f23480f365b Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Tue, 19 Jun 2012 17:32:55 +0300
Subject: [PATCH 17/17] Related to BZ#826873 - Allow to create bond without network
Change-Id: Ic4bfababbc9b81d921b2e26be9e70d07aee7124e
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5487
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5559
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/configNetwork.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 0df6c8f..8b831d6 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -950,7 +950,7 @@ def _validateNetworkSetup(networks={}, bondings={}, explicitBonding=False):
"Setup attached more than one network to nic %s, some of which aren't vlans"%(nic))
for bonding, bondingAttrs in bondings.iteritems():
- networks = bondingAttrs['_networks']
+ networks = bondingAttrs.get('_networks', {})
if len(networks) > 1:
for network, networkAttrs in networks.iteritems():
if not networkAttrs.get('vlan', None):
--
1.7.1

View file

@ -0,0 +1,38 @@
From 013b2208f20d1b7ce0b894fc54a41980c0afc62f Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Wed, 20 Jun 2012 15:48:03 -0400
Subject: [PATCH 18/19] BZ#832577: node can't be approved
Because of ovirt-node's readonly filesystem, directory creation at runtime has to be handled carefully.
/rhev/data-center used to be created by the vdsm rpm when it is installed.
It's now listed in vdsm.spec as %ghost which means it is *not* laid down by default.
At runtime, it fails to be created because of the read-only filesystem.
Regression introduced by commit ee1e68d3416d8fd728df75c0a41dd3db48f9138d
Patch provided by: Mike Burns <mburns@redhat.com>
Change-Id: I3818661c886118d34620e5308434e57bad92913f
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5567
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm.spec.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index c567e65..3fd404e 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -500,7 +500,7 @@ exit 0
/lib/systemd/systemd-vdsmd
%{_unitdir}/vdsmd.service
%endif
-%ghost %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@
+%dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@
%ghost %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@/hsm-tasks
%ghost %dir %attr(-, %{vdsm_user}, %{vdsm_group}) @vdsmrepo@/mnt
%dir %{_libexecdir}/%{vdsm_name}
--
1.7.10.2

View file

@ -0,0 +1,57 @@
From 5982cb826a56ee322c7e5d6fbee479ff5b996561 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Sat, 23 Jun 2012 18:46:51 +0300
Subject: [PATCH 19/19] BZ#824298 fix typo in keyword argument exc_info
Change-Id: Iff2ba114298bc1223ae4969f5da0eb5a5ce8672e
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5617
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5628
---
vdsm/configNetwork.py | 4 ++--
vdsm/storage/image.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 8b831d6..c535499 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1,4 +1,4 @@
-# Copyright 2011 Red Hat, Inc.
+# Copyright 2011-2012 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -673,7 +673,7 @@ def removeLibvirtNetwork(network, log=True):
except libvirt.libvirtError:
if log:
logging.debug('failed to remove libvirt network %s', netName,
- exec_info=True)
+ exc_info=True)
def assertBridgeClean(bridge, vlan, bonding, nics):
brifs = os.listdir('/sys/class/net/%s/brif/' % bridge)
diff --git a/vdsm/storage/image.py b/vdsm/storage/image.py
index 03c94dc..a868568 100644
--- a/vdsm/storage/image.py
+++ b/vdsm/storage/image.py
@@ -1,5 +1,5 @@
#
-# Copyright 2009-2011 Red Hat, Inc.
+# Copyright 2009-2012 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -676,7 +676,7 @@ class Image:
raise
except Exception, e:
self.__cleanupMultimove(sdUUID=dstSdUUID, imgList=cleanup_candidates, postZero=postZero)
- self.log.error(e, exec_info=True)
+ self.log.error(e, exc_info=True)
raise se.CopyImageError("image=%s, src domain=%s, dst domain=%s: msg %s" % (imgUUID, srcSdUUID, dstSdUUID, str(e)))
cleanup_candidates.append(imgUUID)
--
1.7.10.2

View file

@ -0,0 +1,63 @@
From 1be9207d91f1f3df02161356f0057c24b6a230c3 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Tue, 19 Jun 2012 00:52:25 +0300
Subject: [PATCH 20/25] deployUtil: use os.uname instead of /bin/uname
simpler, quicker, and less error-prone.
Change-Id: I7abc1f010bbf15b39d7590c4b55d1835c645a87f
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5636
Tested-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5749
---
configure.ac | 1 -
vdsm_reg/deployUtil.py.in | 11 ++---------
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index f3a609f..7b829f5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,7 +177,6 @@ AC_PATH_PROG([TC_PATH], [tc], [/sbin/tc])
AC_PATH_PROG([TUNE2FS_PATH], [tune2fs], [/sbin/tune2fs])
AC_PATH_PROG([UDEVADM_PATH], [udevadm], [/sbin/udevadm])
AC_PATH_PROG([UMOUNT_PATH], [umount], [/bin/umount])
-AC_PATH_PROG([UNAME_PATH], [uname], [/bin/uname])
AC_PATH_PROG([UNPERSIST_PATH], [unpersist], [/usr/sbin/unpersist])
AC_PATH_PROG([VCONFIG_PATH], [vconfig], [/sbin/vconfig])
AC_PATH_PROG([WGET_PATH], [wget], [/usr/bin/wget])
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index 2f240cc..7586aca 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -72,7 +72,6 @@ EX_RPM = '@RPM_PATH@'
EX_SED = '@SED_PATH@'
EX_SERVICE = '@SERVICE_PATH@'
EX_SYSTEMCTL = '@SYSTEMCTL_PATH@'
-EX_UNAME = '@UNAME_PATH@'
EX_YUM = '@YUM_PATH@'
# Other constants
@@ -400,15 +399,9 @@ def getOSVersion():
return "Unknown OS"
def getKernelVersion():
- """
- Return current kernel release.
- """
- strReturn = '0'
- out, err, rc = _logExec([EX_UNAME, "-r"])
- if not rc:
- strReturn = out
+ """Return current kernel version adn release."""
- return strReturn
+ return os.uname()[2]
def updateKernelArgs(arg):
"""
--
1.7.10.2

View file

@ -0,0 +1,125 @@
From 61672ca8a0d5140aa09ae79c5c0f7b962495a94e Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Tue, 19 Jun 2012 02:00:14 +0300
Subject: [PATCH 21/25] deployUtil: slightly saner kernel version comparison
Change-Id: If2348ce464943e873e31eb61d0aaaa8b936679b2
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5637
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Tested-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5750
---
vds_bootstrap/vds_bootstrap.py | 33 ++++++++-------------------------
vdsm_reg/deployUtil.py.in | 16 +++++++++++++---
2 files changed, 21 insertions(+), 28 deletions(-)
diff --git a/vds_bootstrap/vds_bootstrap.py b/vds_bootstrap/vds_bootstrap.py
index 9801459..5ddc950 100755
--- a/vds_bootstrap/vds_bootstrap.py
+++ b/vds_bootstrap/vds_bootstrap.py
@@ -48,7 +48,6 @@ import shutil
import logging
import logging.config
import random
-import re
import ConfigParser
import socket
import tempfile
@@ -81,14 +80,12 @@ fedorabased = deployUtil.versionCompare(deployUtil.getOSVersion(), "16") >= 0
if rhel6based:
VDSM_NAME = "vdsm"
VDSM_MIN_VER = "4.9"
- KERNEL_VER = "2.6.32-.*.el6"
- KERNEL_MIN_VER = 150
+ KERNEL_MIN_VR = ("2.6.32", "150")
MINIMAL_SUPPORTED_PLATFORM = "6.0"
else:
VDSM_NAME = "vdsm22"
VDSM_MIN_VER = "4.5"
- KERNEL_VER = "2.6.18-.*.el5"
- KERNEL_MIN_VER = 159
+ KERNEL_MIN_VR = ("2.6.18", "159")
MINIMAL_SUPPORTED_PLATFORM = "5.5"
# Required packages
@@ -300,7 +297,6 @@ class Deploy:
"""
Check the compatibility of OS and kernel
"""
- kernel_ver = None
os_status = "FAIL"
kernel_status = "FAIL"
os_message = "Unsupported platform version"
@@ -329,34 +325,21 @@ class Deploy:
os_status = "OK"
if self.rc:
- res = deployUtil.getKernelVersion()
- try:
- kernel_ver = res.split()[0]
- if re.match(KERNEL_VER, kernel_ver):
- kernel_ver = int(kernel_ver.split('-')[1].split('.')[0])
- else:
- kernel_ver = 0
- except:
- kernel_ver = 0
-
- if fedorabased:
- kernel_status = "OK"
- kernel_message = "Skipped kernel version check"
- elif kernel_ver >= KERNEL_MIN_VER:
+ kernel_vr = deployUtil.getKernelVR()
+ if deployUtil.compareVR(kernel_vr, KERNEL_MIN_VR) >= 0:
kernel_status = "OK"
- kernel_message = "Supported kernel version: " + str(kernel_ver)
+ kernel_message = "Supported kernel version: " + str(kernel_vr)
else:
kernel_status = "FAIL"
kernel_message = (
- "Unsupported kernel version: " + str(kernel_ver) +
- ". Minimal supported version: " + str(KERNEL_MIN_VER)
+ "Unsupported kernel version: " + str(kernel_vr) +
+ ". Minimal supported version: " + str(KERNEL_MIN_VR)
)
self.rc = False
if os_name is not None:
self._xmlOutput('OS', os_status, "type", os_name, os_message)
- if kernel_ver is not None:
- self._xmlOutput('KERNEL', kernel_status, "version", kernel_ver, kernel_message)
+ self._xmlOutput('KERNEL', kernel_status, "version", '-'.join(kernel_vr), kernel_message)
return self.rc
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index 7586aca..6bd4b3d 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -398,10 +398,20 @@ def getOSVersion():
logging.error('failed to parse os release from `%s`.', s, exc_info=True)
return "Unknown OS"
-def getKernelVersion():
- """Return current kernel version adn release."""
+def getKernelVR():
+ """Return current kernel version and release."""
- return os.uname()[2]
+ components = os.uname()[2].split('-', 1)
+ if len(components) == 2:
+ return components
+ else:
+ return components[0], '0'
+
+def compareVR(vr1, vr2):
+ import rpmUtils.miscutils
+
+ return rpmUtils.miscutils.compareEVR((0, vr1[0], vr1[1]),
+ (0, vr2[0], vr2[1]))
def updateKernelArgs(arg):
"""
--
1.7.10.2

View file

@ -0,0 +1,39 @@
From 44a2eba8d6c7a7ea9e78454388b859304398ec8d Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Wed, 27 Jun 2012 10:37:28 +0300
Subject: [PATCH 22/25] BZ#835784 - Allow to create a network on top of
existing bond in additional to create a new bond and
network
If we already have a bond0 with (eth1, eth2) and now we want to create
network "bridge_woVlan" on top of it and in additional we want to create
a new bond1 with (eth3, eth4) and create a network "bridge_woVlan_2" on
top of bond 1.
This patch will allow us to do it in the same setupNetwork command.
Change-Id: I67d24d656934ea9dcb0a8209c6a375e19c23f82b
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5737
Reviewed-on: http://gerrit.ovirt.org/5759
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm/configNetwork.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index c535499..d4e1177 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1085,7 +1085,7 @@ def setupNetworks(networks={}, bondings={}, **options):
if 'bonding' in d:
# we may not receive any information
# about the bonding device if it is unchanged
- if bondings:
+ if bondings.get(d['bonding']):
d['nics'] = bondings[d['bonding']]['nics']
d['bondingOptions'] = bondings[d['bonding']].get('options',
None)
--
1.7.10.2

View file

@ -0,0 +1,77 @@
From 16d2eff4fc41a2a8c87923ed9d5d97cca3037144 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Wed, 20 Jun 2012 16:36:08 +0300
Subject: [PATCH 23/25] BZ#833119 - Allow to create VLANed network on top of
existing bond
The (relatively) new setupNetwork verb allows to specify a network on
top of an existing bonding device. The nics of this bonds are taken
implictly from current host configuration.
Change-Id: If45aed68847f5a79380c629a70290a2c687cbd30
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5456
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5760
---
vdsm/configNetwork.py | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index d4e1177..8c4d36d 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -238,7 +238,8 @@ class ConfigWriter(object):
s += 'NM_CONTROLLED=no\n'
BLACKLIST = ['TYPE', 'NAME', 'DEVICE', 'bondingOptions',
'force', 'blockingdhcp',
- 'connectivityCheck', 'connectivityTimeout']
+ 'connectivityCheck', 'connectivityTimeout',
+ 'implicitBonding']
for k in set(kwargs.keys()).difference(set(BLACKLIST)):
if re.match('^[a-zA-Z_]\w*$', k):
s += '%s=%s\n' % (k.upper(), pipes.quote(kwargs[k]))
@@ -491,10 +492,17 @@ def validateVlanId(vlan):
raise ConfigNetworkError(ne.ERR_BAD_VLAN, 'vlan id must be a number')
-def _addNetworkValidation(_netinfo, bridge, vlan, bonding, nics, ipaddr, netmask, gateway,
- bondingOptions, bridged=True):
- if (vlan or bonding) and not nics:
- raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'vlan/bonding definition requires nics. got: %r'%(nics,))
+def _addNetworkValidation(_netinfo, bridge, vlan, bonding, nics, ipaddr,
+ netmask, gateway, bondingOptions, bridged=True,
+ implicitBonding=False):
+ # The (relatively) new setupNetwork verb allows to specify a network on
+ # top of an existing bonding device. The nics of this bonds are taken
+ # implictly from current host configuration
+ if bonding and implicitBonding:
+ pass
+ elif (vlan or bonding) and not nics:
+ raise ConfigNetworkError(ne.ERR_BAD_PARAMS,
+ 'vlan/bonding definition requires nics. got: %r' % (nics,))
# Check bridge
if bridged:
@@ -583,7 +591,7 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
_addNetworkValidation(_netinfo, bridge=network if bridged else None,
vlan=vlan, bonding=bonding, nics=nics, ipaddr=ipaddr,
netmask=netmask, gateway=gateway, bondingOptions=bondingOptions,
- bridged=bridged)
+ bridged=bridged, **options)
logging.info("Adding network %s with vlan=%s, bonding=%s, nics=%s,"
" bondingOptions=%s, mtu=%s, bridged=%s, options=%s",
@@ -1097,7 +1105,8 @@ def setupNetworks(networks={}, bondings={}, **options):
d['force'] = force
logger.debug("Adding network %r" % network)
- addNetwork(network, configWriter=configWriter, **d)
+ addNetwork(network, configWriter=configWriter,
+ implicitBonding=True, **d)
# Do not handle a bonding device twice.
# We already handled it before during addNetwork.
--
1.7.10.2

View file

@ -0,0 +1,72 @@
From 66cf76b0d2dc362bb698df2b0ec491a54dc55d5c Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Mon, 25 Jun 2012 17:46:43 +0300
Subject: [PATCH 24/25] BZ#833803 - Avoid bond breaking after network detach
The (relatively) new setupNetwork verb allows to remove a network
defined on top of an bonding device without break the bond itself.
Change-Id: Idebd0cd0a9d54ceb3714a8cd82fe042ed2c05f2e
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5711
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5761
---
vdsm/configNetwork.py | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 8c4d36d..96dd452 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -734,7 +734,7 @@ def listNetworks():
print "Bondings:", _netinfo.bondings.keys()
def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
- configWriter=None, **options):
+ configWriter=None, implicitBonding=True, **options):
_netinfo = NetInfo()
validateBridgeName(network)
@@ -786,16 +786,19 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
stderr=subprocess.PIPE)
configWriter.removeVlan(vlan, bonding or nics[0])
- if bonding:
- if not bridged or not bondingOtherUsers(network, vlan, bonding):
- ifdown(bonding)
- configWriter.removeBonding(bonding)
+ # The (relatively) new setupNetwork verb allows to remove a network
+ # defined on top of an bonding device without break the bond itself.
+ if implicitBonding:
+ if bonding:
+ if not bridged or not bondingOtherUsers(network, vlan, bonding):
+ ifdown(bonding)
+ configWriter.removeBonding(bonding)
- for nic in nics:
- nicUsers = nicOtherUsers(network, vlan, bonding, nic)
- if not nicUsers:
- ifdown(nic)
- configWriter.removeNic(nic)
+ for nic in nics:
+ nicUsers = nicOtherUsers(network, vlan, bonding, nic)
+ if not nicUsers:
+ ifdown(nic)
+ configWriter.removeNic(nic)
def clientSeen(timeout):
start = time.time()
@@ -1081,7 +1084,8 @@ def setupNetworks(networks={}, bondings={}, **options):
for network, networkAttrs in networks.items():
if network in _netinfo.networks:
logger.debug("Removing network %r" % network)
- delNetwork(network, configWriter=configWriter, force=force)
+ delNetwork(network, configWriter=configWriter, force=force,
+ implicitBonding=False)
if 'remove' in networkAttrs:
del networks[network]
else:
--
1.7.10.2

View file

@ -0,0 +1,70 @@
From 31eac2c98a865a94803785fa660b612d5231c5c4 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Tue, 26 Jun 2012 15:41:37 +0300
Subject: [PATCH 25/25] Handle bond properly if connectivity check fail.
We need to be able remove a new added network if connectivity check fail.
If a new network needs to be created on top of existing bond,
we will need to keep the bond on rollback flow,
else we will break the new created bond
Change-Id: I4bb04f6f3b8d5cdbfd9af8904570af071af6d4f4
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5712
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5762
---
vdsm/configNetwork.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 96dd452..af6c19d 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1065,7 +1065,13 @@ def setupNetworks(networks={}, bondings={}, **options):
try:
_netinfo = NetInfo()
configWriter = ConfigWriter()
- networksAdded = []
+ networksAdded = set()
+ # keep set netsWithNewBonds to be able remove
+ # a new added network if connectivity check fail.
+ # If a new network needs to be created on top of existing bond,
+ # we will need to keep the bond on rollback flow,
+ # else we will break the new created bond.
+ netsWithNewBonds = set()
logger.debug("Setting up network according to configuration: "
"networks:%r, bondings:%r, options:%r" % (networks,
@@ -1089,7 +1095,7 @@ def setupNetworks(networks={}, bondings={}, **options):
if 'remove' in networkAttrs:
del networks[network]
else:
- networksAdded.append(network)
+ networksAdded.add(network)
handledBonds = set()
for network, networkAttrs in networks.iteritems():
@@ -1104,6 +1110,9 @@ def setupNetworks(networks={}, bondings={}, **options):
# Don't remove bondX from the bonding list here,
# because it may be in use for other networks
handledBonds.add(d['bonding'])
+ # we create a new bond
+ if network in networksAdded:
+ netsWithNewBonds.add(network)
else:
d['nics'] = [d.pop('nic')]
d['force'] = force
@@ -1130,7 +1139,8 @@ def setupNetworks(networks={}, bondings={}, **options):
CONNECTIVITY_TIMEOUT_DEFAULT))):
logger.info('Connectivity check failed, rolling back')
for network in networksAdded:
- delNetwork(network, force=True)
+ delNetwork(network, force=True,
+ implicitBonding=network in netsWithNewBonds)
raise ConfigNetworkError(ne.ERR_LOST_CONNECTION,
'connectivity check failed')
except:
--
1.7.10.2

View file

@ -0,0 +1,38 @@
From b1a0e712b394496544bbb62f9466a8aa75f4c669 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Tue, 26 Jun 2012 15:43:33 +0300
Subject: [PATCH 26/26] BZ#806555 having /etc/ovirt-node-* means it is a node
Not vice versa.
This patch fixes http://gerrit.ovirt.org/3055 .
Change-Id: Id13c5621a2ff1c8bdcfc1e40a27951efb0d75cfe
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5713
Reviewed-by: Michael Burns <mburns@redhat.com>
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Tested-by: Ofer Schreiber <oschreib@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5768
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/caps.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/vdsm/caps.py b/vdsm/caps.py
index 5950ee9..5c9fa78 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -156,7 +156,7 @@ def _getIscsiIniName():
def getos():
if os.path.exists('/etc/rhev-hypervisor-release'):
return OSName.RHEVH
- elif len(glob.glob('/etc/ovirt-node-*-release')) == 0:
+ elif glob.glob('/etc/ovirt-node-*-release'):
return OSName.OVIRT
elif os.path.exists('/etc/fedora-release'):
return OSName.FEDORA
--
1.7.10.2

View file

@ -0,0 +1,32 @@
From ada1caae80ef463d511395ccbd0cb773b3e8b8b6 Mon Sep 17 00:00:00 2001
From: lvroyce <lvroyce@linux.vnet.ibm.com>
Date: Fri, 29 Jun 2012 13:13:52 +0800
Subject: [PATCH 27/40] bump libvirt version to fix readonly lease unsupported
issue
Change-Id: I116f3ce07fff8075902a862e0259198232efd2f4
Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Reviewed-on: http://gerrit.ovirt.org/5787
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm.spec.in | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 3fd404e..88fe373 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -63,7 +63,8 @@ Requires: e2fsprogs >= 1.41.12-11
Requires: python >= 2.7.3
Requires: qemu-kvm >= 2:0.15.0-4
Requires: qemu-img >= 2:0.15.0-4
-Requires: libvirt >= 0.9.10
+#readonly lease ignored by default on 0.9.11.4-3
+Requires: libvirt >= 0.9.11.4-3
Requires: libvirt-python, libvirt-lock-sanlock
Requires: iscsi-initiator-utils >= 6.2.0.872-14
Requires: device-mapper-multipath >= 0.4.9-18
--
1.7.7.6

View file

@ -0,0 +1,89 @@
From 16ad84b47fac0e325073e1b08e99a364c7850699 Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Fri, 6 Jul 2012 09:40:17 -0400
Subject: [PATCH 28/40] BZ#832199: move selinux from init to spec
To reduce the time during the init, transferring all the selinux
set to spec instead use it during the vdsm init.
Change-Id: Id515ddb96cbfb4f3a936336b3f7e261658df662a
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5614
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm.spec.in | 22 +++++++++++++++++++++-
vdsm/vdsmd.init.in | 8 --------
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 88fe373..6be7da4 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -78,6 +78,7 @@ Requires: sos
Requires: tree
Requires: dosfstools
Requires: policycoreutils-python
+Requires(pre,preun): policycoreutils-python
Requires: libselinux-python
Requires: kernel >= 2.6.32-198
Requires: %{name}-python = %{version}-%{release}
@@ -375,6 +376,23 @@ rm -rf %{buildroot}
/usr/sbin/usermod -a -G %{qemu_group},%{snlk_group} %{vdsm_user}
/usr/sbin/usermod -a -G %{qemu_group},%{vdsm_group} %{snlk_user}
+# vdsm makes extensive use of nfs-exported images
+# The next lines will collect the default selinux behaviour for the booleans
+virtNFS=$(/usr/sbin/semanage boolean -l | /bin/grep virt_use_nfs | cut -d ',' -f 2)
+virtSANLOCK=$(/usr/sbin/semanage boolean -l | /bin/grep virt_use_sanlock | cut -d ',' -f 2)
+
+if [[ "${virtNFS}" == *off* || "${virtSANLOCK}" == *off* ]]; then
+ /usr/sbin/semanage boolean -m -S targeted -F /dev/stdin << _EOF
+virt_use_nfs=1
+virt_use_sanlock=1
+_EOF
+fi
+
+if /usr/sbin/selinuxenabled; then
+ /usr/sbin/setsebool virt_use_nfs on
+ /usr/sbin/setsebool virt_use_sanlock on
+fi
+
%post
# update the vdsm "secret" password for libvirt
if [ -f /etc/pki/vdsm/keys/libvirt_password ]; then
@@ -415,10 +433,12 @@ then
/usr/sbin/semanage boolean -m -S targeted -F /dev/stdin << _EOF
virt_use_nfs=0
+virt_use_sanlock=0
_EOF
- if selinuxenabled; then
+ if /usr/sbin/selinuxenabled; then
/usr/sbin/setsebool virt_use_nfs off
+ /usr/sbin/setsebool virt_use_sanlock off
fi
/usr/sbin/saslpasswd2 -p -a libvirt -d vdsm@rhevh
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index ac3bd08..dd6f3c6 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -410,14 +410,6 @@ EOF
ovirt_store_config "$lconf" "$qconf" "$ldconf" "$llogr"
- # vdsm makes extensive use of nfs-exported images
- /usr/sbin/semanage boolean -m -S targeted -F /dev/stdin << _EOF
-virt_use_nfs=1
-virt_use_sanlock=1
-_EOF
- /usr/sbin/setsebool virt_use_nfs on
- /usr/sbin/setsebool virt_use_sanlock on
-
/sbin/initctl restart libvirtd 2>/dev/null || :
}
--
1.7.7.6

View file

@ -0,0 +1,34 @@
From 34f080dd8b7456248ed2e2693030cf736e097606 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Tue, 3 Jul 2012 10:53:37 +0300
Subject: [PATCH 29/40] BZ#838097 _addNetworkValidation: do not explode if
STP/DNS1 option passed
http://gerrit.ovirt.org/5456 has started passing all optional parameters
to _addNetworkValidation, but no one is expecting them there.
Change-Id: I071e6a7a53279c24d45ebec3858d9b0c0d6294ae
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5885
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6017
---
vdsm/configNetwork.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index af6c19d..961dd33 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -494,7 +494,7 @@ def validateVlanId(vlan):
def _addNetworkValidation(_netinfo, bridge, vlan, bonding, nics, ipaddr,
netmask, gateway, bondingOptions, bridged=True,
- implicitBonding=False):
+ implicitBonding=False, **options):
# The (relatively) new setupNetwork verb allows to specify a network on
# top of an existing bonding device. The nics of this bonds are taken
# implictly from current host configuration
--
1.7.7.6

View file

@ -0,0 +1,39 @@
From fe88d1834032776638fc41c9fc96123923e1432a Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Mon, 9 Jul 2012 10:49:24 -0400
Subject: [PATCH 30/40] ovirt_functions: fix elif statement
Identify correctly the ovirt Node and fix the error message from vdsm-reg logs:
[: /etc/ovirt-node-image-release: binary operator expected
Change-Id: I4eae7e64361d148d60c50dbacd273de7a2490be2
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6072
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm/ovirt_functions.sh | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/vdsm/ovirt_functions.sh b/vdsm/ovirt_functions.sh
index 84cf686..b1e3ef2 100644
--- a/vdsm/ovirt_functions.sh
+++ b/vdsm/ovirt_functions.sh
@@ -9,10 +9,12 @@
#
function isOvirt() {
+ for f in /etc/ovirt-node-*-release; do
+ [ -f "$f" ] && return 0
+ done
+
if [ -f /etc/rhev-hypervisor-release ]; then
return 0
- elif [ -f /etc/ovirt-node-*-release ]; then
- return 0
else
return 1
fi
--
1.7.7.6

View file

@ -0,0 +1,44 @@
From f1792cfb33bff5ef5c9a8c1f938ff92b00d192a8 Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Mon, 9 Jul 2012 17:20:35 -0400
Subject: [PATCH 31/40] BZ#837443: removeBridge() drop/remove interface
Move ifdown() and brctl delbr to removeBridge(). We need a generic
function to be called multiple times. For example, removing a bridge listed
or not listed in libvirt database.
Change-Id: Iea798b2ddf6413b58dbfc3d8d11dc4bf54c592fc
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5914
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6204
---
vdsm/configNetwork.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 961dd33..51471bc 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -321,6 +321,8 @@ class ConfigWriter(object):
self._removeFile(self.NET_CONF_PREF + bonding)
def removeBridge(self, bridge):
+ ifdown(bridge)
+ subprocess.call([constants.EXT_BRCTL, 'delbr', bridge])
self._backup(self.NET_CONF_PREF + bridge)
self._removeFile(self.NET_CONF_PREF + bridge)
@@ -775,8 +777,6 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
"delNetwork: bridge %s still exists" % network)
if network and bridged:
- ifdown(network)
- subprocess.call([constants.EXT_BRCTL, 'delbr', network])
configWriter.removeBridge(network)
if vlan:
--
1.7.7.6

View file

@ -0,0 +1,199 @@
From a2e8aa85f270d5bd2390b07ac82710fa398c755b Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Thu, 12 Jul 2012 17:01:22 -0400
Subject: [PATCH 32/40] BZ#837443: replace the netinfo import
We will use functions like netinfo.bridges() to
verify if there is any bridge listed in the system
but not in the libvirt database.
Change-Id: I76ac6f21267f9e2c26f032dbe0334aeaa59aa030
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6205
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm/configNetwork.py | 42 +++++++++++++++++++++---------------------
1 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 51471bc..bddf71c 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -33,7 +33,7 @@ from vdsm import constants
from vdsm import utils
import neterrors as ne
from vdsm import define
-from vdsm.netinfo import NetInfo, NET_CONF_DIR, NET_CONF_BACK_DIR, LIBVIRT_NET_PREFIX
+from vdsm import netinfo
from vdsm import libvirtconnection
CONNECTIVITY_TIMEOUT_DEFAULT = 4
@@ -84,7 +84,7 @@ def ifup(iface):
def ifaceUsers(iface):
"Returns a list of entities using the interface"
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
users = set()
for n, ndict in _netinfo.networks.iteritems():
if ndict['bridged'] and iface in ndict['ports']:
@@ -155,7 +155,7 @@ def nicSort(nics):
return [x + z for x, y, z in sorted(nics_list)]
class ConfigWriter(object):
- NET_CONF_PREF = NET_CONF_DIR + 'ifcfg-'
+ NET_CONF_PREF = netinfo.NET_CONF_DIR + 'ifcfg-'
CONFFILE_HEADER = '# automatically generated by vdsm'
DELETED_HEADER = '# original file did not exist'
@@ -168,7 +168,7 @@ class ConfigWriter(object):
def _atomicBackup(self, filename):
"""Backs up configuration to memory, for a later rollback in case of error."""
- confFile = os.path.join(NET_CONF_DIR, filename)
+ confFile = os.path.join(netinfo.NET_CONF_DIR, filename)
if confFile not in self._backups:
try:
self._backups[confFile] = open(confFile).read()
@@ -201,7 +201,7 @@ class ConfigWriter(object):
logging.debug("unmounted %s using ovirt" % filename)
(dummy, basename) = os.path.split(filename)
- backup = os.path.join(NET_CONF_BACK_DIR, basename)
+ backup = os.path.join(netinfo.NET_CONF_BACK_DIR, basename)
if os.path.exists(backup):
# original copy already backed up
return
@@ -209,9 +209,9 @@ class ConfigWriter(object):
vdsm_uid = pwd.getpwnam('vdsm').pw_uid
# make directory (if it doesn't exist) and assign it to vdsm
- if not os.path.exists(NET_CONF_BACK_DIR):
- os.mkdir(NET_CONF_BACK_DIR)
- os.chown(NET_CONF_BACK_DIR, vdsm_uid, 0)
+ if not os.path.exists(netinfo.NET_CONF_BACK_DIR):
+ os.mkdir(netinfo.NET_CONF_BACK_DIR)
+ os.chown(netinfo.NET_CONF_BACK_DIR, vdsm_uid, 0)
if os.path.exists(filename):
shutil.copy2(filename, backup)
@@ -285,7 +285,7 @@ class ConfigWriter(object):
"Based on addNetwork"
conffile = self.NET_CONF_PREF + nic
self._backup(conffile)
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
hwaddr = _netinfo.nics[nic].get('permhwaddr') or \
_netinfo.nics[nic]['hwaddr']
with open(conffile, 'w') as f:
@@ -413,7 +413,7 @@ class ConfigWriter(object):
Or added a new value,
also set the bridge to the higher value if its under vlans or bond
"""
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
cf = self.NET_CONF_PREF + bridge
currmtu = self._getConfigValue(cf, 'MTU')
if currmtu is None:
@@ -581,7 +581,7 @@ def _addNetworkValidation(_netinfo, bridge, vlan, bonding, nics, ipaddr,
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):
nics = nics or ()
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
bridged = utils.tobool(bridged)
if mtu:
@@ -659,7 +659,7 @@ def addNetwork(network, vlan=None, bonding=None, nics=None, ipaddr=None, netmask
def createLibvirtNetwork(network, bridged=True, iface=None):
conn = libvirtconnection.get()
- netName = LIBVIRT_NET_PREFIX + network
+ netName = netinfo.LIBVIRT_NET_PREFIX + network
if bridged:
netXml = '''<network><name>%s</name><forward mode='bridge'/>
<bridge name='%s'/></network>''' % (escape(netName), escape(network))
@@ -672,7 +672,7 @@ def createLibvirtNetwork(network, bridged=True, iface=None):
net.setAutostart(1)
def removeLibvirtNetwork(network, log=True):
- netName = LIBVIRT_NET_PREFIX + network
+ netName = netinfo.LIBVIRT_NET_PREFIX + network
conn = libvirtconnection.get()
try:
net = conn.networkLookupByName(netName)
@@ -705,7 +705,7 @@ def assertBridgeClean(bridge, vlan, bonding, nics):
raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'bridge %s has interfaces %s connected' % (bridge, brifs))
def showNetwork(network):
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
if network not in _netinfo.networks:
print "Network %r doesn't exist" % network
return
@@ -729,7 +729,7 @@ def showNetwork(network):
print "vlan=%s, bonding=%s, nics=%s" % (vlan, bonding, nics)
def listNetworks():
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
print "Networks:", _netinfo.networks.keys()
print "Vlans:", _netinfo.vlans.keys()
print "Nics:", _netinfo.nics.keys()
@@ -737,7 +737,7 @@ def listNetworks():
def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
configWriter=None, implicitBonding=True, **options):
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
validateBridgeName(network)
@@ -772,7 +772,7 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
removeLibvirtNetwork(network, log=False)
# 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().networks:
+ if network in netinfo.NetInfo().networks:
raise ConfigNetworkError(ne.ERR_USED_BRIDGE,
"delNetwork: bridge %s still exists" % network)
@@ -825,7 +825,7 @@ def editNetwork(oldBridge, newBridge, vlan=None, bonding=None, nics=None, **opti
return define.errCode['noConPeer']['status']['code']
def _validateNetworkSetup(networks={}, bondings={}, explicitBonding=False):
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
# Step 1: Initial validation (validate names, existence of params, etc.)
for network, networkAttrs in networks.iteritems():
@@ -973,7 +973,7 @@ def _editBondings(bondings, configWriter):
""" Add/Edit bond interface """
logger = logging.getLogger("_editBondings")
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
for bond, bondAttrs in bondings.iteritems():
logger.debug("Creating/Editing bond %s with attributes %s",
@@ -999,7 +999,7 @@ def _removeBondings(bondings, configWriter):
""" Add/Edit bond interface """
logger = logging.getLogger("_removeBondings")
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
for bond, bondAttrs in bondings.items():
if 'remove' in bondAttrs:
@@ -1063,7 +1063,7 @@ def setupNetworks(networks={}, bondings={}, **options):
logger = logging.getLogger("setupNetworks")
try:
- _netinfo = NetInfo()
+ _netinfo = netinfo.NetInfo()
configWriter = ConfigWriter()
networksAdded = set()
# keep set netsWithNewBonds to be able remove
--
1.7.7.6

View file

@ -0,0 +1,32 @@
From ce31be09f8e1ae3decaa5219d6ffdfb9a39115f9 Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Thu, 12 Jul 2012 16:09:50 -0400
Subject: [PATCH 33/40] configNetwork: fix NetInfo call
Commit 9be0497ba77333577e3f5e8738c9efd8794e7a36 changed the import of
netinfo. This patch fix a NetInfo call missed from the previous patch.
Change-Id: I962cbd39d601300d10a25f5ccb36875b2e544cf1
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6206
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm/configNetwork.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index bddf71c..5d2469d 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -440,7 +440,7 @@ class ConfigWriter(object):
if newmtu != currmtu:
if bonding:
- slaves = NetInfo.slaves(bonding)
+ slaves = netinfo.NetInfo.slaves(bonding)
for slave in slaves:
cf = self.NET_CONF_PREF + slave
self._updateConfigValue(cf, 'MTU', newmtu, newmtu is None)
--
1.7.7.6

View file

@ -0,0 +1,55 @@
From 229e294cf3649e03df7b9d876a918c9604ebbdc5 Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Mon, 9 Jul 2012 17:27:35 -0400
Subject: [PATCH 34/40] BZ#837443: removeVlan() drop/remove interface
Move ifdown() and vconfig rm to removeVlan(). We need a generic
function to be called multiple times. For example, removing a vlan listed
or not listed in libvirt database.
Change-Id: I2db7d26e3bb7fda62f1a8fcdbd0445554df20ad7
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6090
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6207
---
vdsm/configNetwork.py | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index 5d2469d..dabd219 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -312,9 +312,13 @@ class ConfigWriter(object):
except IOError:
pass
- def removeVlan(self, vlanId, iface):
- self._backup(self.NET_CONF_PREF + iface + '.' + vlanId)
- self._removeFile(self.NET_CONF_PREF + iface + '.' + vlanId)
+ def removeVlan(self, vlan, iface):
+ vlandev = iface + '.' + vlan
+ ifdown(vlandev)
+ subprocess.call([constants.EXT_VCONFIG, 'rem', vlandev],
+ stderr=subprocess.PIPE)
+ self._backup(self.NET_CONF_PREF + iface + '.' + vlan)
+ self._removeFile(self.NET_CONF_PREF + iface + '.' + vlan)
def removeBonding(self, bonding):
self._backup(self.NET_CONF_PREF + bonding)
@@ -780,10 +784,6 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
configWriter.removeBridge(network)
if vlan:
- vlandev = (bonding or nics[0]) + '.' + vlan
- ifdown(vlandev)
- subprocess.call([constants.EXT_VCONFIG, 'rem', vlandev],
- stderr=subprocess.PIPE)
configWriter.removeVlan(vlan, bonding or nics[0])
# The (relatively) new setupNetwork verb allows to remove a network
--
1.7.7.6

View file

@ -0,0 +1,64 @@
From dbe23c6eb50b6dc59738dceb0ece78221cadcfd3 Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Wed, 11 Jul 2012 11:18:42 -0400
Subject: [PATCH 35/40] BZ#837443: remove bridge before add VDSM bridge
Related to BZ#837443: ovirt-node fails to register with ovirt-engine
oVirt Node when installed manually creates a bridge to be consumed.
VDSM should remove any bridge (listed or not listed in libvirt)
to create it's own bridge.
Change-Id: Ibc2842db371483225042d511c6495df1bc5047de
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6016
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-by: Mark Wu <wudxw@linux.vnet.ibm.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6208
---
vdsm/configNetwork.py | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index dabd219..c94648c 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -745,9 +745,22 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
validateBridgeName(network)
+ if configWriter is None:
+ configWriter = ConfigWriter()
+
if network not in _netinfo.networks:
- raise ConfigNetworkError(ne.ERR_BAD_BRIDGE,
- "Cannot delete network %r: It doesn't exist" % network)
+ logging.info("Network %r: doesn't exist in libvirt database", network)
+ if network in netinfo.bridges():
+ configWriter.removeBridge(network)
+ else:
+ raise ConfigNetworkError(ne.ERR_BAD_BRIDGE,
+ "Cannot delete network %r: It doesn't exist "
+ "in the system" % network)
+
+ if vlan:
+ configWriter.removeVlan(vlan, bonding or nics[0])
+
+ return
nics, vlan, bonding = _netinfo.getNicsVlanAndBondingForNetwork(network)
bridged = _netinfo.networks[network]['bridged']
@@ -767,9 +780,6 @@ def delNetwork(network, vlan=None, bonding=None, nics=None, force=False,
if bridged:
assertBridgeClean(network, vlan, bonding, nics)
- if configWriter is None:
- configWriter = ConfigWriter()
-
if bridged:
configWriter.setNewMtu(network)
--
1.7.7.6

View file

@ -0,0 +1,47 @@
From ee31f19b5340506bc73d9f2fc27366d5241c3ca2 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Mon, 2 Jul 2012 13:00:19 +0300
Subject: [PATCH 36/40] BZ#836954 - Allow to break bond and create a new
network on its interface in single action.
Assume we have a bond0 on (eth1, eth2) with defined network brNet on it.
This patch will allow to break the bond0 and create a new network brNet2 on one
of its interfaces (e.g. eth2) with single setupNetworks operation
Change-Id: Iaa6459ec24f9c81a2cfbc107b5e3548126903357
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5841
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6210
Tested-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm/configNetwork.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index c94648c..d277cd6 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -1107,6 +1107,9 @@ def setupNetworks(networks={}, bondings={}, **options):
else:
networksAdded.add(network)
+ # Remove bonds with 'remove' attribute
+ _removeBondings(bondings, configWriter)
+
handledBonds = set()
for network, networkAttrs in networks.iteritems():
d = dict(networkAttrs)
@@ -1137,9 +1140,6 @@ def setupNetworks(networks={}, bondings={}, **options):
del bondings[bond]
# We are now left with bondings whose network was not mentioned
- # Remove bonds with 'remove' attribute
- _removeBondings(bondings, configWriter)
-
# Check whether bonds should be resized
_editBondings(bondings, configWriter)
--
1.7.7.6

View file

@ -0,0 +1,47 @@
From 3060b9110bb37ee2b05356b37fde4d79b1e46c5f Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Thu, 5 Jul 2012 15:05:14 +0300
Subject: [PATCH 37/40] BZ#837054 - Do not detach network from the bond during
bond resize
Let's say you have bond and bridged non-VLANed network on it.
This patch will fix detaching such network from the bond during bond resizing.
Change-Id: Idf2a7f73b23dc9692bec9cc3fad01e947a7294af
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5970
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6213
Tested-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm/configNetwork.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index d277cd6..eb140f8 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -988,6 +988,11 @@ def _editBondings(bondings, configWriter):
for bond, bondAttrs in bondings.iteritems():
logger.debug("Creating/Editing bond %s with attributes %s",
bond, bondAttrs)
+
+ brNets = list(_netinfo.getBridgedNetworksForNic(bond))
+ # Only one bridged-non-VLANed network allowed on same nic/bond
+ bridge = brNets[0] if brNets else None
+
if bond in _netinfo.bondings:
ifdown(bond)
# Take down all bond's NICs.
@@ -1001,7 +1006,7 @@ def _editBondings(bondings, configWriter):
configWriter.addNic(nic, bonding=bond)
ifup(nic)
- configWriter.addBonding(bond,
+ configWriter.addBonding(bond, bridge=bridge,
bondingOptions=bondAttrs.get('options', None))
ifup(bond)
--
1.7.7.6

View file

@ -0,0 +1,115 @@
From 5cb2be8ed2406928525072360c3a2571229415f9 Mon Sep 17 00:00:00 2001
From: Igor Lvovsky <ilvovsky@redhat.com>
Date: Mon, 2 Jul 2012 12:40:54 +0300
Subject: [PATCH 38/40] Remove redundant 'explicitBonding' parameter from
setupNetworks
Change-Id: Id8cd878109ab5fe9d082412f6d05e1c964823779
Signed-off-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5840
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6209
---
vdsm/configNetwork.py | 34 ++++++++--------------------------
1 files changed, 8 insertions(+), 26 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index eb140f8..d8cad5d 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -834,7 +834,7 @@ def editNetwork(oldBridge, newBridge, vlan=None, bonding=None, nics=None, **opti
configWriter.restoreAtomicBackup()
return define.errCode['noConPeer']['status']['code']
-def _validateNetworkSetup(networks={}, bondings={}, explicitBonding=False):
+def _validateNetworkSetup(networks={}, bondings={}):
_netinfo = netinfo.NetInfo()
# Step 1: Initial validation (validate names, existence of params, etc.)
@@ -897,7 +897,6 @@ def _validateNetworkSetup(networks={}, bondings={}, explicitBonding=False):
# Step 2: Make sure we have complete information about the Setup, more validation
- # (if explicitBonding==False we complete the missing information ourselves, else we raise an exception)
nics = defaultdict(lambda: {'networks':{}, 'bonding':None})
for network, networkAttrs in networks.iteritems():
if networkAttrs.get('remove', False):
@@ -908,10 +907,6 @@ def _validateNetworkSetup(networks={}, bondings={}, explicitBonding=False):
bonding = networkAttrs['bonding']
if bonding not in bondings:
- if explicitBonding:
- raise ConfigNetworkError(ne.ERR_BAD_PARAMS, "Network %s requires unspecified bonding %s"%(
- network, bonding))
-
# fill in bonding info
bondings[bonding] = {'nics':_netinfo.bondings[bonding]['slaves']}
@@ -930,9 +925,6 @@ def _validateNetworkSetup(networks={}, bondings={}, explicitBonding=False):
for network in connectedNetworks:
if network not in networks:
- if explicitBonding:
- raise ConfigNetworkError(ne.ERR_BAD_PARAMS, "Bonding %s is associated with unspecified network %s"%(
- bonding, network))
# fill in network info
_, vlan, bonding2 = _netinfo.getNicsVlanAndBondingForNetwork(network)
assert bonding == bonding2
@@ -1035,7 +1027,7 @@ def setupNetworks(networks={}, bondings={}, **options):
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)
@@ -1050,7 +1042,7 @@ def setupNetworks(networks={}, bondings={}, **options):
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 --
@@ -1060,20 +1052,12 @@ def setupNetworks(networks={}, bondings={}, **options):
force=0|1
connectivityCheck=0|1
connectivityTimeout=<int>
- explicitBonding=0|1
-
Notes:
- Bondings are removed when they change state from 'used' to 'unused'.
-
- By default, if you edit a network that is attached to a bonding, it's not
- necessary to re-specify the bonding (you need only to note the attachment
- in the network's attributes). Similarly, if you edit a bonding, it's not
- necessary to specify its networks.
- However, if you specify the 'explicitBonding' option as true, the function
- will expect you to specify all networks that are attached to a specified
- bonding, and vice-versa, the bonding attached to a specified network.
-
+ When you edit a network that is attached to a bonding, it's not
+ necessary to re-specify the bonding (you need only to note
+ the attachment in the network's attributes). Similarly, if you edit
+ a bonding, it's not necessary to specify its networks.
"""
logger = logging.getLogger("setupNetworks")
@@ -1095,9 +1079,7 @@ def setupNetworks(networks={}, bondings={}, **options):
force = options.get('force', False)
if not utils.tobool(force):
logging.debug("Validating configuration")
- _validateNetworkSetup(dict(networks), dict(bondings),
- explicitBonding=options.get('explicitBonding',
- False))
+ _validateNetworkSetup(dict(networks), dict(bondings))
logger.debug("Applying...")
try:
--
1.7.7.6

View file

@ -0,0 +1,41 @@
From df7e06353bcd1c48304884384e5d8575747a3b7a Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Wed, 4 Jul 2012 17:25:55 +0300
Subject: [PATCH 39/40] configNet: clear up atomicBackup arg
Apparently, os.path.join('/a/b/', '/a/b/c') == '/a/b/c'.
Let us not trust this peculiarity, and have atomicBackup
expect a full path to the config file.
Change-Id: Id4f4fc8dd1db785837d868a45787b3fa5be901a6
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5953
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6211
---
vdsm/configNetwork.py | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index d8cad5d..dbec079 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -168,11 +168,11 @@ class ConfigWriter(object):
def _atomicBackup(self, filename):
"""Backs up configuration to memory, for a later rollback in case of error."""
- confFile = os.path.join(netinfo.NET_CONF_DIR, filename)
- if confFile not in self._backups:
+
+ if filename not in self._backups:
try:
- self._backups[confFile] = open(confFile).read()
- logging.debug("Backed up %s" % confFile)
+ self._backups[filename] = open(filename).read()
+ logging.debug("Backed up %s", filename)
except IOError:
pass
--
1.7.7.6

View file

@ -0,0 +1,51 @@
From 72580d30893de15fea9af0050e989bc6d33e3216 Mon Sep 17 00:00:00 2001
From: Dan Kenigsberg <danken@redhat.com>
Date: Wed, 4 Jul 2012 16:36:05 +0300
Subject: [PATCH 40/40] configNet: atomicBackup: remove new files upon restore
Files that are created by ConfigWriter._atomicBackup() should be removed
by restoreAtomicBackup, not forgotten on disk.
Change-Id: I66bdb20b6e7e78be198f2616aa0ef7a8efeec18a
Signed-off-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/5952
Reviewed-by: Igor Lvovsky <ilvovsky@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6212
---
vdsm/configNetwork.py | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py
index dbec079..bb4e81e 100755
--- a/vdsm/configNetwork.py
+++ b/vdsm/configNetwork.py
@@ -173,16 +173,22 @@ class ConfigWriter(object):
try:
self._backups[filename] = open(filename).read()
logging.debug("Backed up %s", filename)
- except IOError:
- pass
+ except IOError, e:
+ if e.errno == os.errno.ENOENT:
+ self._backups[filename] = None
+ else:
+ raise
def restoreAtomicBackup(self):
logging.info("Rolling back configuration (restoring atomic backup)")
if not self._backups:
return
for confFile, content in self._backups.iteritems():
- open(confFile, 'w').write(content)
- logging.debug('Restored %s', confFile)
+ if content is None:
+ utils.rmFile(confFile)
+ else:
+ open(confFile, 'w').write(content)
+ logging.info('Restored %s', confFile)
subprocess.Popen(['/etc/init.d/network', 'start'])
@staticmethod
--
1.7.7.6

View file

@ -0,0 +1,33 @@
From 15d46e0809e27eb39fde58fb47a0b3914f1d0c90 Mon Sep 17 00:00:00 2001
From: Douglas Schilling Landgraf <dougsland@redhat.com>
Date: Tue, 31 Jul 2012 19:36:53 -0400
Subject: [PATCH 41/41] BZ#842948: deployUtil - safely remove bridge
deployUtil calls /usr/share/vdsm/delNetwork to remove previously created bridge.
This patch will add ovirtfunctions.ovirt_safe_delete_config() to safely remove
bridge config files in oVirt Node.
Change-Id: I6e9b00ee4a38ebe7d5011e36bd9d3f7362cf26cd
Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/6798
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
---
vdsm_reg/deployUtil.py.in | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/vdsm_reg/deployUtil.py.in b/vdsm_reg/deployUtil.py.in
index 6bd4b3d..62aef01 100644
--- a/vdsm_reg/deployUtil.py.in
+++ b/vdsm_reg/deployUtil.py.in
@@ -904,6 +904,8 @@ def makeBridge(vdcName, vdsmDir):
else:
fReturn = False
logging.debug("makeBridge Failed to del existing bridge. out=" + out + "\nerr=" + str(err) + "\nret=" + str(ret))
+ else:
+ ovirtfunctions.ovirt_safe_delete_config(IFACE_CONFIG + mgtBridge)
except:
fReturn = False
logging.debug("makeBridge Failed to del existing bridge. out=" + out + "\nerr=" + str(err) + "\nret=" + str(ret))
--
1.7.7.6

View file

@ -0,0 +1,147 @@
From 0b3cd04300005c995d20306446a2ab804d74b6be Mon Sep 17 00:00:00 2001
From: Federico Simoncelli <fsimonce@redhat.com>
Date: Fri, 17 Aug 2012 05:23:38 -0400
Subject: [PATCH] Ship the version file with the tarballs
Shipping the VERSION file allows running the autoreconf tool also from a
tarball package (no need of the entire git repository).
In this patch:
* generate and ship the VERSION file
* move, unify (and ship) version.sh and release.sh in pkg-version
* use the VERSION file when the git repository is not available
(eg: tarball)
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Change-Id: I8b72a1740803a9401e4b5a4504a4faa07c29f2b9
Reviewed-on: http://gerrit.ovirt.org/7295
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-by: Alon Bar-Lev <alonbl@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Dan Kenigsberg <danken@redhat.com>
---
Makefile.am | 13 +++++++++++--
build-aux/pkg-version | 39 +++++++++++++++++++++++++++++++++++++++
configure.ac | 4 ++--
VERSION | 1 +
4 files changed, 52 insertions(+), 34 deletions(-)
create mode 100755 build-aux/pkg-version
create mode 100644 VERSION
delete mode 100755 build-aux/release.sh
delete mode 100755 build-aux/version.sh
diff --git a/Makefile.am b/Makefile.am
index ab9b240..2b6d273 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -25,6 +25,7 @@ include $(top_srcdir)/build-aux/Makefile.subs
# This is an *exception*, we ship also vdsm.spec so it's possible to build the
# rpm from the tarball.
EXTRA_DIST = \
+ build-aux/pkg-version \
vdsm.spec \
vdsm.spec.in
@@ -80,11 +81,11 @@ rpm: dist
rpmbuild -ta $(if $(BUILDID),--define="extra_release .$(BUILDID)") \
$(WITH_HOOKS) $(DIST_ARCHIVES)
-dist-hook: gen-ChangeLog
+dist-hook: gen-VERSION gen-ChangeLog
+.PHONY: gen-VERSION gen-ChangeLog
# Generate the ChangeLog file and insert it into the directory
# we're about to use to create a tarball.
-.PHONY: gen-ChangeLog
gen-ChangeLog:
if test -d .git; then \
$(top_srcdir)/build-aux/gitlog-to-changelog \
@@ -92,3 +93,11 @@ gen-ChangeLog:
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
+
+gen-VERSION:
+ if test -d .git; then \
+ $(top_srcdir)/build-aux/pkg-version --full \
+ > $(distdir)/ve-t; \
+ rm -f $(distdir)/VERSION; \
+ mv $(distdir)/ve-t $(distdir)/VERSION; \
+ fi
diff --git a/build-aux/pkg-version b/build-aux/pkg-version
new file mode 100755
index 0000000..a8d9d77
--- /dev/null
+++ b/build-aux/pkg-version
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# tags and output versions:
+# - v4.9.0 => 4.9.0 (upstream clean)
+# - v4.9.0-1 => 4.9.0 (downstream clean)
+# - v4.9.0-2-g34e62f => 4.9.0 (upstream dirty)
+# - v4.9.0-1-2-g34e62f => 4.9.0 (downstream dirty)
+AWK_VERSION='
+ BEGIN { FS="-" }
+ /^v[0-9]/ {
+ sub(/^v/,"") ; print $1
+ }'
+
+# tags and output releases:
+# - v4.9.0 => 0 (upstream clean)
+# - v4.9.0-1 => 1 (downstream clean)
+# - v4.9.0-2-g34e62f1 => 0.2.git34e62f1 (upstream dirty)
+# - v4.9.0-1-2-g34e62f1 => 1.2.git34e62f1 (downstream dirty)
+AWK_RELEASE='
+ BEGIN { FS="-"; OFS="." }
+ /^v[0-9]/ {
+ if (NF == 1) print 0
+ else if (NF == 2) print $2
+ else if (NF == 3) print 0, $2, "git" substr($3, 2)
+ else if (NF == 4) print $2, $3, "git" substr($4, 2)
+ }'
+
+PKG_VERSION=`cat VERSION 2> /dev/null || git describe --match "v[0-9]*"`
+
+if test "x$1" == "x--full"; then
+ echo $PKG_VERSION | tr -d '[:space:]'
+elif test "x$1" == "x--version"; then
+ echo $PKG_VERSION | awk "$AWK_VERSION" | tr -cd '[:alnum:].'
+elif test "x$1" == "x--release"; then
+ echo $PKG_VERSION | awk "$AWK_RELEASE" | tr -cd '[:alnum:].'
+else
+ echo "usage: $0 [--full|--version|--release]"
+ exit 1
+fi
diff --git a/configure.ac b/configure.ac
index 7b829f5..cb1dc56 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,7 +20,7 @@
# Autoconf initialization
AC_INIT([vdsm],
- [m4_esyscmd([build-aux/version.sh])],
+ [m4_esyscmd([build-aux/pkg-version --version])],
[vdsm-devel@lists.fedorahosted.org])
AC_CONFIG_AUX_DIR([build-aux])
@@ -28,7 +28,7 @@ m4_include([m4/ax_python_module.m4])
# Package release
AC_SUBST([PACKAGE_RELEASE],
- [m4_esyscmd([build-aux/release.sh])])
+ [m4_esyscmd([build-aux/pkg-version --release])])
# Testing for version and release
AS_IF([test "x$PACKAGE_VERSION" = x],
diff --git a/VERSION b/VERSION
new file mode 100644
index 0000000..bbc89f8
--- /dev/null
+++ b/VERSION
@@ -0,0 +1,1 @@
+v4.10.0
--
1.7.1

View file

@ -0,0 +1,59 @@
From b4f0985266f5fba817602e8af9ad900425c5a853 Mon Sep 17 00:00:00 2001
From: Saggi Mizrahi <smizrahi@redhat.com>
Date: Mon, 24 Sep 2012 01:28:38 +0200
Subject: [PATCH] Use the recommended alignment instead of using pagesize
Page size is the usual recommended alignment but when it isn't using it
can cause memory corruption.
Change-Id: If9da41a2f74d3cea7300df9606c78eebcc9927a9
Signed-off-by: Saggi Mizrahi <smizrahi@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/8143
Tested-by: Noam Slomianko <nslomian@redhat.com>
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/8174
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/storage/fileUtils.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index 020f16d..511dff9 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -45,9 +45,10 @@ NFS_OPTIONS = "".join(config.get('irs', 'nfs_mount_options').split())
log = logging.getLogger('fileUtils')
-PAGESIZE = libc.getpagesize()
CharPointer = ctypes.POINTER(ctypes.c_char)
+_PC_REC_XFER_ALIGN = 17
+
class TarCopyFailed(RuntimeError): pass
def tarCopy(src, dst, exclude=[]):
@@ -71,7 +72,8 @@ def isStaleHandle(path):
os.listdir(path)
except OSError as ex:
if ex.errno in (errno.EIO, errno.ESTALE):
- return True
+ return True
+
# We could get contradictory results because of
# soft mounts
if (exists or st) and ex.errno == errno.ENOENT:
@@ -262,7 +264,8 @@ class DirectFile(object):
ppbuff = ctypes.pointer(pbuff)
# Because we usually have fixed sizes for our reads, caching
# buffers might give a slight performance boost.
- rc = libc.posix_memalign(ppbuff, PAGESIZE, size)
+ alignment = libc.fpathconf(self.fileno(), _PC_REC_XFER_ALIGN)
+ rc = libc.posix_memalign(ppbuff, alignment, size)
if rc:
raise OSError(rc, "Could not allocate aligned buffer")
try:
--
1.7.11.4

View file

@ -0,0 +1,50 @@
From c219c4455bb93d9f136849b58ceb0255e407fdbe Mon Sep 17 00:00:00 2001
From: Saggi Mizrahi <smizrahi@redhat.com>
Date: Thu, 4 Oct 2012 13:14:21 +0200
Subject: [PATCH] Use buffer size in multiplies of the recommended transfer
size
Using the recommended transfer size fixes the memory corruption for NFS.
Bug-Id: http://bugzilla.redhat.com/845660
Change-Id: Iadea310039b30073197b7ad90afb930c460bda17
Signed-off-by: Saggi Mizrahi <smizrahi@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/8356
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Tested-by: Jason Brooks <jbrooks@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/8369
Reviewed-by: Federico Simoncelli <fsimonce@redhat.com>
Tested-by: Federico Simoncelli <fsimonce@redhat.com>
---
vdsm/storage/fileUtils.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/vdsm/storage/fileUtils.py b/vdsm/storage/fileUtils.py
index 511dff9..ccc2bfe 100644
--- a/vdsm/storage/fileUtils.py
+++ b/vdsm/storage/fileUtils.py
@@ -48,6 +48,7 @@ log = logging.getLogger('fileUtils')
CharPointer = ctypes.POINTER(ctypes.c_char)
_PC_REC_XFER_ALIGN = 17
+_PC_REC_MIN_XFER_SIZE = 16
class TarCopyFailed(RuntimeError): pass
@@ -265,6 +266,13 @@ class DirectFile(object):
# Because we usually have fixed sizes for our reads, caching
# buffers might give a slight performance boost.
alignment = libc.fpathconf(self.fileno(), _PC_REC_XFER_ALIGN)
+ minXferSize = libc.fpathconf(self.fileno(), _PC_REC_MIN_XFER_SIZE)
+ chunks, remainder = divmod(size, minXferSize)
+ if remainder > 0:
+ chunks += 1
+
+ size = chunks * minXferSize
+
rc = libc.posix_memalign(ppbuff, alignment, size)
if rc:
raise OSError(rc, "Could not allocate aligned buffer")
--
1.7.11.4

View file

@ -0,0 +1,59 @@
From 59722223c4d241a47ba8b4cf9f5281996b2db374 Mon Sep 17 00:00:00 2001
From: Federico Simoncelli <fsimonce@redhat.com>
Date: Thu, 27 Sep 2012 08:31:08 -0400
Subject: [PATCH] setup: configure selinux for sanlock on nfs
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Change-Id: Id9005d23d009c65770b7836feb81ab97206e9a8a
Reviewed-on: http://gerrit.ovirt.org/8255
Reviewed-by: Douglas Schilling Landgraf <dougsland@redhat.com>
Reviewed-by: Ayal Baron <abaron@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/8755
---
vdsm.spec.in | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 6be7da4..5f5f989 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -380,17 +380,21 @@ rm -rf %{buildroot}
# The next lines will collect the default selinux behaviour for the booleans
virtNFS=$(/usr/sbin/semanage boolean -l | /bin/grep virt_use_nfs | cut -d ',' -f 2)
virtSANLOCK=$(/usr/sbin/semanage boolean -l | /bin/grep virt_use_sanlock | cut -d ',' -f 2)
+snlkNFS=$(/usr/sbin/semanage boolean -l | /bin/grep sanlock_use_nfs | cut -d ',' -f 2)
-if [[ "${virtNFS}" == *off* || "${virtSANLOCK}" == *off* ]]; then
+if [[ "${virtNFS}" == *off* || "${virtSANLOCK}" == *off* || \
+ "${snlkNFS}" == *off* ]]; then
/usr/sbin/semanage boolean -m -S targeted -F /dev/stdin << _EOF
virt_use_nfs=1
virt_use_sanlock=1
+sanlock_use_nfs=1
_EOF
fi
if /usr/sbin/selinuxenabled; then
/usr/sbin/setsebool virt_use_nfs on
/usr/sbin/setsebool virt_use_sanlock on
+ /usr/sbin/setsebool sanlock_use_nfs on
fi
%post
@@ -434,11 +438,13 @@ then
/usr/sbin/semanage boolean -m -S targeted -F /dev/stdin << _EOF
virt_use_nfs=0
virt_use_sanlock=0
+sanlock_use_nfs=0
_EOF
if /usr/sbin/selinuxenabled; then
/usr/sbin/setsebool virt_use_nfs off
/usr/sbin/setsebool virt_use_sanlock off
+ /usr/sbin/setsebool sanlock_use_nfs off
fi
/usr/sbin/saslpasswd2 -p -a libvirt -d vdsm@rhevh
--
1.7.11.7

View file

@ -0,0 +1,76 @@
From b59c8430b2a511bcea3bc1a954eee4ca1c0f4861 Mon Sep 17 00:00:00 2001
From: Federico Simoncelli <fsimonce@redhat.com>
Date: Mon, 15 Oct 2012 12:09:17 -0400
Subject: [PATCH] setup: move the certificate generation
Generating the certificate at the service startup (instead of during the
rpm installation) has a better chance to succeed (and a better recovery
process). Moreover this allows appliances (like ovirt-node) to postpone
the certificate generation when the service is actually used for the
first time.
In this patch:
* Move the certificate generation from the spec file to the init file
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=860067
Signed-off-by: Federico Simoncelli <fsimonce@redhat.com>
Change-Id: I40fa3d9a6a54e312e399af3f87ac67e843078360
Reviewed-on: http://gerrit.ovirt.org/8368
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Michael Burns <mburns@redhat.com>
Tested-by: Michael Burns <mburns@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/10615
---
vdsm.spec.in | 3 ---
vdsm/vdsm-gencerts.sh.in | 4 ++++
vdsm/vdsmd.init.in | 5 +++++
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 5f5f989..572b338 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -404,9 +404,6 @@ if [ -f /etc/pki/vdsm/keys/libvirt_password ]; then
/etc/pki/vdsm/keys/libvirt_password
fi
-# generate the vdsm certificates (if missing)
-%{_libexecdir}/%{vdsm_name}/vdsm-gencerts.sh
-
%if 0%{?rhel}
if [ "$1" -eq 1 ] ; then
/sbin/chkconfig --add vdsmd
diff --git a/vdsm/vdsm-gencerts.sh.in b/vdsm/vdsm-gencerts.sh.in
index 1e11b69..3ee38c3 100755
--- a/vdsm/vdsm-gencerts.sh.in
+++ b/vdsm/vdsm-gencerts.sh.in
@@ -33,6 +33,10 @@ VDSM_PERMS="@VDSMUSER@:@VDSMGROUP@"
umask 077
+if [ "$1" = "--check" ]; then
+ [ -s "$VDSM_KEY" -a -s "$VDSM_CA" -a -s "$VDSM_CRT" ] && exit 0 || exit 1
+fi
+
if [ ! -f "$VDSM_KEY" ]; then
/usr/bin/certtool --generate-privkey --outfile "$VDSM_KEY" 2> /dev/null
/bin/chown "$VDSM_PERMS" "$VDSM_KEY"
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index dd6f3c6..a288c16 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -498,6 +498,11 @@ start() {
shutdown_conflicting_srv && stop_libvirtd_sysv
+ if ! @LIBEXECDIR@/vdsm-gencerts.sh --check; then
+ echo -n $"Configuring a self-signed VDSM host certificate: "
+ @LIBEXECDIR@/vdsm-gencerts.sh && success || failure ; echo
+ fi
+
reconfigure noforce
ret_val=$?
if [ $ret_val -ne 0 ]
--
1.7.11.7

View file

@ -1 +0,0 @@
vdsm fails to build from source: https://bugzilla.redhat.com/show_bug.cgi?id=1676186

1
sources Normal file
View file

@ -0,0 +1 @@
e8ab5eccdea0b4a4da2e812174971393 vdsm-4.10.0.tar.gz

1121
vdsm.spec Normal file

File diff suppressed because it is too large Load diff