humble devassy has uploaded a new change for review.
Change subject: hooks: macbind - This hook support binding specified mac address to custom/other bridge than the currently defined bridge in ovirt. This hook is also capable of binding a mac address to openvswitch bridge.
......................................................................
hooks: macbind - This hook support binding specified
mac address to custom/other bridge than the currently defined
bridge in ovirt. This hook is also capable of binding
a mac address to openvswitch bridge.
Change-Id: I0356dfab224a9082b44aae1c66df050f7456301c
Signed-off-by: Humble Chirammal <hchiramm(a)redhat.com>
---
A vdsm_hooks/macbind/Makefile.am
A vdsm_hooks/macbind/README
A vdsm_hooks/macbind/before_vm_start.py
3 files changed, 187 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/95/17895/1
diff --git a/vdsm_hooks/macbind/Makefile.am b/vdsm_hooks/macbind/Makefile.am
new file mode 100644
index 0000000..27dc5af
--- /dev/null
+++ b/vdsm_hooks/macbind/Makefile.am
@@ -0,0 +1,30 @@
+#
+# Copyright 2013 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+EXTRA_DIST = \
+ before_vm_start.py
+
+install-data-local:
+ $(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
+ $(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
+ $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_macbind
+
+uninstall-local:
+ $(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_macbind
diff --git a/vdsm_hooks/macbind/README b/vdsm_hooks/macbind/README
new file mode 100644
index 0000000..15bcfeb
--- /dev/null
+++ b/vdsm_hooks/macbind/README
@@ -0,0 +1,39 @@
+macbind vdsm hook:
+============
+This hook goes through all of the VM's interfaces and manipulate its
+XML file acccording to the input. This can be used to attach a VM nic
+to a specific bridge which is available in the hypervisor for 'that' VM run
+or permanently.
+
+
+One specific use case being attach a virtual network interface to an
+openvswitch bridge. Other being, attach vm nic to a different bridge
+than the defined/default bridge for that NIC.
+
+
+Syntax:
+ macbind=macaddress-brName-portType,...
+
+where:
+
+macaddress: specify a macaddress which need to be attached to the VM
+brName : Bridge Name available in hypervisor
+portType : This have to either 'ovs' or 'lb' or ''
+
+For ex:
+
+macbind= 00:1a:4a:41:d2:5f-ovsbr0-ovs,00:1a:4a:41:d2:b8-br88-lb
+
+Installation:
+* Use the engine-config to append the appropriate custom property as such:
+ sudo engine-config -s UserDefinedVMProperties=
+ 'previousProperties;macbind=^.*$' --cver=3.2
+
+* Verify that the macbind custom property was properly added:
+ sudo engine-config -g UserDefinedVMProperties
+
+Usage:
+In the VM configuration window, open the custom properites tab
+and add macbind=
+
+NOTE: Live migration is **not** tested.
diff --git a/vdsm_hooks/macbind/before_vm_start.py b/vdsm_hooks/macbind/before_vm_start.py
new file mode 100755
index 0000000..5606614
--- /dev/null
+++ b/vdsm_hooks/macbind/before_vm_start.py
@@ -0,0 +1,118 @@
+#!/usr/bin/python
+
+import os
+import sys
+import hooking
+import traceback
+
+'''
+
+macbind:
+
+syntax:
+macbind=macaddress-brName-portType,...
+refer README for more details.
+
+
+if 'ovs' as portType:
+
+<interface type='bridge'>
+ <mac address='00:1a:4a:41:d2:5f'/>
+ <source bridge='ovsbr0'/>
+ <model type='virtio'/>
+ <virtualport type='openvswitch'/>
+ <filterref filter='vdsm-no-mac-spoofing'/>
+ <link state='up'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+</interface>
+
+If 'lb' or '' as portType:
+The given bridge will be replaced with current bridge:
+
+<interface type='bridge'>
+ <mac address='00:1a:4a:41:d2:b8'/>
+ <source bridge='br0'/>
+ <model type='virtio'/>
+ <filterref filter='vdsm-no-mac-spoofing'/>
+ <link state='up'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+</interface>
+
+'''
+
+
+def createVportElement(domxml, porttype):
+ vPort = domxml.createElement('virtualport')
+ vPort.setAttribute('type', 'openvswitch')
+ return vPort
+
+
+def createSbridgeElement(domxml, brName):
+ sBridge = domxml.createElement('source')
+ sBridge.setAttribute('bridge', brName)
+ return sBridge
+
+
+def removeElement(interface, Element):
+ interface.removeChild(Element)
+
+
+if 'macbind' in os.environ:
+ try:
+
+ macbinds = os.environ['macbind']
+ domxml = hooking.read_domxml()
+ macAddr = ''
+ brName = ''
+ pType = ''
+
+ for nic in macbinds.split(','):
+ try:
+ macAddr, brName, pType = nic.split('-')
+ macAddr = macAddr.strip()
+ brName = brName.strip()
+ pType = pType.strip()
+
+ except ValueError:
+ sys.stderr.write('macbind: input error, expected '
+ 'macbind:macAddr:brName:pType,'
+ 'where brName is bridgename'
+ 'pType can be ovs|lb')
+ sys.exit(2)
+ if pType == "ovs":
+ command = ['/usr/bin/ovs-vsctl', 'br-exists %s' % (brName)]
+ retcode, out, err = hooking.execCmd(
+ command, sudo=False, raw=True)
+ if retcode != 0:
+ sys.stderr.write('macbind: Error in finding ovsbridge:'
+ '%s: %s, err = %s' %
+ (brName, ' '.join(command), err))
+ continue
+ if pType == "lb" or pType == '':
+ command = ['/usr/sbin/brctl', 'show', brName]
+ retcode, out, err = hooking.execCmd(
+ command, sudo=False, raw=True)
+
+ if err or retcode != 0:
+ sys.stderr.write('macbind: Error in finding Linuxbridge:'
+ ' %s \n: %s, err = %s\n' %
+ (brName, ' '.join(command), err))
+ continue
+
+ for interface in domxml.getElementsByTagName('interface'):
+ for macaddress in interface.getElementsByTagName('mac'):
+ addr = macaddress.getAttribute('address')
+ if addr == macAddr:
+ for bridge in interface.getElementsByTagName('source'):
+ interface.removeChild(bridge)
+ interface.appendChild(
+ createSbridgeElement(domxml, brName))
+ if pType == "ovs":
+ interface.appendChild(
+ createVportElement(domxml, 'openvswitch'))
+
+ hooking.write_domxml(domxml)
+ except:
+ sys.stderr.write('macbind: [unexpected error]: %s\n' %
+ traceback.format_exc())
+ sys.exit(2)
--
To view, visit http://gerrit.ovirt.org/17895
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I0356dfab224a9082b44aae1c66df050f7456301c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: humble devassy <hchiramm(a)redhat.com>
Saggi Mizrahi has uploaded a new change for review.
Change subject: (Schema) Change ConnectionRef actions to work on a single connection
......................................................................
(Schema) Change ConnectionRef actions to work on a single connection
This was the original intention of the API. The reason we started
supporting multiple connections in a single call is because of the
overhead inherent in XML-RPC. The new API can multiplex calls and has
practically no overhead per call.
Also, refID is not an UUID
Change-Id: I5747f2161d039cfaa82c0797e63ff58dbffbe8ac
Signed-off-by: Saggi Mizrahi <smizrahi(a)redhat.com>
---
M vdsm_api/vdsmapi-schema.json
1 file changed, 21 insertions(+), 44 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/7148/1
diff --git a/vdsm_api/vdsmapi-schema.json b/vdsm_api/vdsmapi-schema.json
index e782613..b103b28 100644
--- a/vdsm_api/vdsmapi-schema.json
+++ b/vdsm_api/vdsmapi-schema.json
@@ -2250,16 +2250,16 @@
{'command': {'class': 'Global', 'name': 'setSafeNetworkConfig'}}
-## Category: @ConnectionRefs ##################################################
+## Category: @ConnectionRef ##################################################
##
-# @ConnectionRefs.init:
+# @ConnectionRef.init:
#
-# Initialize a ConnectionRefs API object.
+# Initialize a ConnectionRef API object.
#
# Since: 4.10.0
# XXX: Extension: object constructors
##
-{'init': 'ConnectionRefs'}
+{'init': 'ConnectionRef'}
##
# @IscsiPortal:
@@ -2444,60 +2444,37 @@
'connectionInfo': 'ConnectionRefParameters'}}
##
-# @ConnectionRefArgsMap:
-#
-# A mapping of connection arguments indexed by ConnectionRef UUID.
-#
-# Since: 4.10.0
-##
-{'map': 'ConnectionRefArgsMap',
- 'key': 'UUID', 'value': 'ConnectionRefArgs'}
-
-##
-# @ConnectionRefArgsStatusMap:
-#
-# A mapping of status codes indexed by ConnectionRef UUID.
-#
-# Since: 4.10.0
-##
-{'map': 'ConnectionRefArgsStatusMap',
- 'key': 'UUID', 'value': 'int'}
-
-##
-# @ConnectionRefs.acquire:
+# @ConnectionRef.acquire:
#
# Acquire one or more new storage connection references.
#
-# @conRefArgs: Connection parameters
+# @refID: The identifier to be assigned to the new connection reference.
+# Users are encouraged to mangle they information into the string
+# to prevent collisions and declare ownership.
+# eg.
+# ENGINE_CONNECTION_3213
#
-# Returns:
-# @results: A dictionary of status codes indexed by the same @UUID values in
-# @conRefArgs.
+# This way managers can tell which connections are owned by whome.
+# @conRefArgs: Connection parameters.
#
# Since: 4.10.0
# XXX: Extension: map data type ['key type', 'val type']
##
-{'command': {'class': 'ConnectionRefs', 'name': 'acquire'},
- 'data': {'conRefArgs': 'ConnectionRefArgsMap'},
- 'returns': {'results': 'ConnectionRefArgsStatusMap'}}
+{'command': {'class': 'ConnectionRef', 'name': 'acquire'},
+ 'data': {'refID', 'str', 'conRefArgs': 'ConnectionRefArgs'}}
##
-# @ConnectionRefs.release:
+# @ConnectionRef.release:
#
# Release one or more storage connection references.
#
-# @refIDs: A list of @UUID values
-#
-# Returns:
-# @results: A dictionary of status codes indexed by the same @UUID values that
-# were passed in @0.
+# @refIDs: A list of string values.
#
# Since: 4.10.0
# XXX: Extension: list data type
##
-{'command': {'class': 'ConnectionRefs', 'name': 'release'},
- 'data': {'refIDs': ['UUID']},
- 'returns': {'results': 'ConnectionRefArgsStatusMap'}}
+{'command': {'class': 'ConnectionRef', 'name': 'release'},
+ 'data': {'refID': 'str'}}
##
# @ConnectionRefMap:
@@ -2507,10 +2484,10 @@
# Since: 4.10.0
##
{'map': 'ConnectionRefMap',
- 'key': 'UUID', 'value': 'ConnectionRef'}
+ 'key': 'str', 'value': 'ConnectionRef'}
##
-# @ConnectionRefs.statuses:
+# @ConnectionRef.statuses:
#
# Get information about all registered storage connection references.
#
@@ -2519,7 +2496,7 @@
#
# Since: 4.10.0
##
-{'command': {'class': 'ConnectionRefs', 'name': 'statuses'},
+{'command': {'class': 'ConnectionRef', 'name': 'statuses'},
'returns': {'connectionslist': 'ConnectionRefMap'}}
## Category: @ISCSIConnection ##################################################
--
To view, visit http://gerrit.ovirt.org/7148
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5747f2161d039cfaa82c0797e63ff58dbffbe8ac
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <smizrahi(a)redhat.com>
Eduardo has uploaded a new change for review.
Change subject: Revert "pool: ignore refreshStoragePool calls on the SPM"
......................................................................
Revert "pool: ignore refreshStoragePool calls on the SPM"
This reverts commit 7d8f85547e5f56d3eefc91f330e29458a7b8ac27.
Change-Id: I660b8d01844520b43998b7081ca02ef06a5acd93
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 0 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/27/13927/1
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index f3a702e..b560ea4 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -788,22 +788,8 @@
se.StoragePoolActionError(
"spUUID=%s, msdUUID=%s, masterVersion=%s" %
(spUUID, msdUUID, masterVersion)))
-
vars.task.getSharedLock(STORAGE, spUUID)
-
- try:
- # The refreshStoragePool command is an HSM command and
- # should not be issued (and executed) on the SPM. At the
- # moment we just ignore it for legacy reasons but in the
- # future vdsm could raise an exception.
- self.validateNotSPM(spUUID)
- except se.IsSpm:
- self.log.info("Ignoring the refreshStoragePool request "
- "(the host is the SPM)")
- return
-
pool = self.getPool(spUUID)
-
try:
self.validateSdUUID(msdUUID)
pool.refresh(msdUUID, masterVersion)
--
To view, visit http://gerrit.ovirt.org/13927
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I660b8d01844520b43998b7081ca02ef06a5acd93
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>
Eduardo has uploaded a new change for review.
Change subject: Remove force parameter in StoragePool.spmStop()
......................................................................
Remove force parameter in StoragePool.spmStop()
Change-Id: I7eaf8883e62a72445e27f0bc9876fe61a10bcb3f
Signed-off-by: Eduardo <ewarszaw(a)redhat.com>
---
M vdsm/storage/sp.py
1 file changed, 20 insertions(+), 18 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/29/13929/1
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index ca20f9a..70c5802 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -340,8 +340,8 @@
except Exception as e:
self.log.error("Unexpected error", exc_info=True)
- self.log.error("failed: %s" % str(e))
- self.stopSpm(force=True, __securityOverride=True)
+ self.log.error("failed: spmRole:%s %s", self.spmRole, str(e))
+ self.stopSpm(__securityOverride=True)
raise
@unsecured
@@ -392,44 +392,46 @@
else:
cls.log.debug("master `%s` is not mounted, skipping", master)
- def stopSpm(self, force=False):
+ def stopSpm(self):
with self.lock:
- if not force and self.spmRole == SPM_FREE:
+ if self.spmRole == SPM_FREE:
return True
self._shutDownUpgrade()
self._setUnsafe()
- stopFailed = False
-
+ failedStops = []
try:
self.cleanupMasterMount()
except:
# If unmounting fails the vdsm panics.
- stopFailed = True
+ failedStops.append("cleanupMasterMount")
- try:
- if self.spmMailer:
+ if self.spmMailer:
+ try:
self.spmMailer.stop()
- except:
- # Here we are just begin polite.
- # SPM will also clean this on start up.
- pass
+ except:
+ # Here we are just begin polite.
+ # SPM will also clean this on start up.
+ self.log.debug("fail: spmMailer %s", self.spmMailer)
- if not stopFailed:
+ if not failedStops:
try:
self.setMetaParam(PMDK_SPM_ID, SPM_ID_FREE,
__securityOverride=True)
except:
- pass # The system can handle this inconsistency
+ # The system can handle this inconsistency
+ self.log.debug("fail: reset %s to %s",
+ PMDK_SPM_ID, SPM_ID_FREE)
try:
self.masterDomain.releaseClusterLock()
except:
- stopFailed = True
+ failedStops.append("releaseClusterLock")
- if stopFailed:
- misc.panic("Unrecoverable errors during SPM stop process.")
+ if failedStops:
+ misc.panic("Unrecoverable errors during SPM stop process: %s.",
+ ", ".join(failedStops))
self.spmRole = SPM_FREE
--
To view, visit http://gerrit.ovirt.org/13929
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7eaf8883e62a72445e27f0bc9876fe61a10bcb3f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw(a)redhat.com>