Dan Kenigsberg has uploaded a new change for review.
Change subject: tc: Give a clearer name to qdisc_get_devid
......................................................................
tc: Give a clearer name to qdisc_get_devid
While at it, extend the function to return all associated qdiscs per
device.
Change-Id: If835917172ff8a6d68a9c9bbc1d6454b7137bf2a
Signed-off-by: Dan Kenigsberg <danken(a)redhat.com>
---
M tests/tcTests.py
M vdsm/tc.py
2 files changed, 10 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/38/7538/1
diff --git a/tests/tcTests.py b/tests/tcTests.py
index cba0d75..db6304f 100644
--- a/tests/tcTests.py
+++ b/tests/tcTests.py
@@ -172,9 +172,10 @@
self.assertFalse("qdisc ingress" in self._showQdisc(),
"Could not remove an ingress qdisc from the device.")
- def testGetDevID(self):
+ def testQdiscsOfDevice(self):
self._addIngress()
- self.assertTrue("ffff:" in tc.qdisc_get_devid(self._bridge.devName))
+ self.assertEquals(("ffff:", ),
+ tuple(tc._qdiscs_of_device(self._bridge.devName)))
def testReplacePrio(self):
self._addIngress()
diff --git a/vdsm/tc.py b/vdsm/tc.py
index 69f8625..570c410 100644
--- a/vdsm/tc.py
+++ b/vdsm/tc.py
@@ -61,7 +61,7 @@
_addTarget(network, QDISC_INGRESS, target)
qdisc_replace_prio(network)
- qdisc_id = qdisc_get_devid(network)
+ qdisc_id = _qdiscs_of_device(network).next()
_addTarget(network, qdisc_id, target)
set_promisc(network, True)
@@ -71,7 +71,7 @@
# TODO handle the case where we have partial definitions on device due to
# vdsm crash
acts = _delTarget(network, QDISC_INGRESS, target)
- qdisc_id = qdisc_get_devid(network)
+ qdisc_id = _qdiscs_of_device(network).next()
acts += _delTarget(network, qdisc_id, target)
if not acts:
@@ -122,12 +122,14 @@
_process_request(command)
-def qdisc_get_devid(dev):
- "Return qdisc_id of the first qdisc associated with dev"
+def _qdiscs_of_device(dev):
+ "Return an iterator of qdisc_ids associated with dev"
command = [EXT_TC, 'qdisc', 'show', 'dev', dev]
out = _process_request(command)
- return out.split(' ')[2]
+
+ for line in out.splitlines():
+ yield line.split(' ')[2]
def qdisc_del(dev, queue):
--
To view, visit http://gerrit.ovirt.org/7538
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If835917172ff8a6d68a9c9bbc1d6454b7137bf2a
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken(a)redhat.com>
Dan Yasny has uploaded a new change for review.
Change subject: Removed trailing spaces and added extra traceback logging
......................................................................
Removed trailing spaces and added extra traceback logging
Change-Id: Ifbce514ffb5547aa90e56495771802409cbc0dbc
Signed-off-by: Dan Yasny <dyasny(a)gmail.com>
---
M vdsm_hooks/vmfex/Makefile.am
M vdsm_hooks/vmfex/README
M vdsm_hooks/vmfex/before_vm_migrate_destination.py
M vdsm_hooks/vmfex/before_vm_start.py
4 files changed, 32 insertions(+), 40 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/7548/1
diff --git a/vdsm_hooks/vmfex/Makefile.am b/vdsm_hooks/vmfex/Makefile.am
index b921275..2a6c244 100644
--- a/vdsm_hooks/vmfex/Makefile.am
+++ b/vdsm_hooks/vmfex/Makefile.am
@@ -22,7 +22,7 @@
before_vm_migrate_destination.py \
before_vm_start.py \
-install-data-local:
+install-data-local:
$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
$(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
$(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_vmfex
diff --git a/vdsm_hooks/vmfex/README b/vdsm_hooks/vmfex/README
index 1eb7629..030f145 100644
--- a/vdsm_hooks/vmfex/README
+++ b/vdsm_hooks/vmfex/README
@@ -7,8 +7,8 @@
Will add 2 virtual nics attached to profile1 and profile2 using the vnic
MAC addresses specified, replacing the actual NICs assigned to the VM.
- The mapping is by order of NIC<number> in the parameters, mapped to the
- order of the "interface" elements in the devices of the VM xml, as well
+ The mapping is by order of NIC<number> in the parameters, mapped to the
+ order of the "interface" elements in the devices of the VM xml, as well
as the NICs defined for a VM in the RHEV-M admin GUI.
Libvirt internals:
@@ -18,7 +18,7 @@
<model type="virtio"/>
<source bridge="<logical network>"/>
</interface>
-
+
with the following interface xml:
<interface type='network'>
<mac address='<mac>'/>
@@ -28,7 +28,7 @@
</virtualport>
<model type='virtio'/>
</interface>
-
+
Dynamic network with libvirt (define a NIC pool, so libvirt can assign VMs to NICs dynamically):
<network>
diff --git a/vdsm_hooks/vmfex/before_vm_migrate_destination.py b/vdsm_hooks/vmfex/before_vm_migrate_destination.py
index a80df7f..301f015 100755
--- a/vdsm_hooks/vmfex/before_vm_migrate_destination.py
+++ b/vdsm_hooks/vmfex/before_vm_migrate_destination.py
@@ -3,7 +3,6 @@
import os
import subprocess
import sys
-import hooking
import traceback
import libvirtconnection
@@ -46,13 +45,13 @@
'''
def getUsableNics():
- # Scan localhost for physical NICs and return list of physical nics
+ # Scan localhost for physical NICs and return list of physical nics
# that have all zeroes MAC
# Example ['eth0','eth1']
nics = []
cmd = "find /sys/devices/pci* | grep '/net/' |grep address"
p = subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True)
- s = p.stdout.read().split()
+ s = p.stdout.read().split()
for i in s:
mac = open(i).read().strip()
if mac == '00:00:00:00:00:00':
@@ -64,42 +63,40 @@
for i in getUsableNics():
s = '<interface dev="' + str(i) + '"/> \n'
xmlstr += s
-
+
xmlstr += """ </forward> \n </network> """
conn.networkDefineXML(xmlstr)
dpool = conn.networkLookupByName('direct-pool')
dpool.setAutostart(1)
dpool.create()
-
-
if os.environ.has_key('vmfex'):
try:
#connect to libvirtd
conn = libvirtconnection.get('qemu:///system')
-
+
#check for running VMs. If there are VMs running, skip creating a dNIC pool
if len(conn.listDomainsID()) == 0:
#check if direct-pool is created
if 'direct-pool' not in conn.listNetworks():
createDirectPool(conn)
- else:
+ else:
if conn.networkLookupByName('direct-pool').isActive() == 0:
conn.networkLookupByName('direct-pool').create()
conn.networkLookupByName('direct-pool').setAutostart(1)
-
+
#check if the defined dNIC pool didn't change
dpool = conn.networkLookupByName('direct-pool')
definedNics = []
for i in dpool.split():
if 'dev=' in i:
definedNics.append(str(i.split('=')[1].split('/')[0].strip("'")))
- #if the defined NIC pool doesn't match the usable NIC list, recreate the network
+ #if the defined NIC pool doesn't match the usable NIC list, recreate the network
if set(definedNics) != set(getUsableNics()):
conn.networkLookupByName('direct-pool').destroy()
conn.networkLookupByName('direct-pool').undefine()
createDirectPool(conn)
-
+
if 'direct-pool' not in conn.listNetworks():
createDirectPool(conn)
diff --git a/vdsm_hooks/vmfex/before_vm_start.py b/vdsm_hooks/vmfex/before_vm_start.py
index 9002e3f..dc32f8d 100755
--- a/vdsm_hooks/vmfex/before_vm_start.py
+++ b/vdsm_hooks/vmfex/before_vm_start.py
@@ -3,10 +3,8 @@
import os
import subprocess
import sys
-import xml
import hooking
import traceback
-from xml.dom import minidom
import libvirtconnection
'''
@@ -19,8 +17,8 @@
Will add 2 virtual nics attached to profile1 and profile2 using the vnic
MAC addresses specified, replacing the actual NICs assigned to the VM.
- The mapping is by order of NIC<number> in the parameters, mapped to the
- order of the "interface" elements in the devices of the VM xml, as well
+ The mapping is by order of NIC<number> in the parameters, mapped to the
+ order of the "interface" elements in the devices of the VM xml, as well
as the NICs defined for a VM in the RHEV-M admin GUI.
Libvirt internals:
@@ -30,7 +28,7 @@
<model type="virtio"/>
<source bridge="<logical network>"/>
</interface>
-
+
with the following interface xml:
<interface type='network'>
<mac address='<mac>'/>
@@ -40,7 +38,7 @@
</virtualport>
<model type='virtio'/>
</interface>
-
+
Dynamic network with libvirt (define a NIC pool, so libvirt can assign VMs to NICs dynamically):
<network>
@@ -75,13 +73,13 @@
'''
def getUsableNics():
- # Scan localhost for physical NICs and return list of physical nics
+ # Scan localhost for physical NICs and return list of physical nics
# that have all zeroes MAC
# Example ['eth0','eth1']
nics = []
cmd = "find /sys/devices/pci* | grep '/net/' |grep address"
p = subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True)
- s = p.stdout.read().split()
+ s = p.stdout.read().split()
for i in s:
mac = open(i).read().strip()
if mac == '00:00:00:00:00:00':
@@ -102,37 +100,35 @@
for i in getUsableNics():
s = '<interface dev="' + str(i) + '"/> \n'
xmlstr += s
-
+
xmlstr += """ </forward> \n </network> """
conn.networkDefineXML(xmlstr)
dpool = conn.networkLookupByName('direct-pool')
dpool.setAutostart(1)
dpool.create()
-
-
if os.environ.has_key('vmfex'):
try:
#connect to libvirtd
conn = libvirtconnection.get('qemu:///system')
-
+
#check for running VMs. If there are VMs running, skip creating a dNIC pool
if len(conn.listDomainsID()) == 0:
#check if direct-pool is created
if 'direct-pool' not in conn.listNetworks():
createDirectPool(conn)
- else:
+ else:
if conn.networkLookupByName('direct-pool').isActive() == 0:
conn.networkLookupByName('direct-pool').create()
conn.networkLookupByName('direct-pool').setAutostart(1)
-
+
#check if the defined dNIC pool didn't change
dpool = conn.networkLookupByName('direct-pool')
definedNics = []
for i in dpool.split():
if 'dev=' in i:
definedNics.append(str(i.split('=')[1].split('/')[0].strip("'")))
- #if the defined NIC pool doesn't match the usable NIC list, recreate the network
+ #if the defined NIC pool doesn't match the usable NIC list, recreate the network
if set(definedNics) != set(getUsableNics()):
conn.networkLookupByName('direct-pool').destroy()
conn.networkLookupByName('direct-pool').undefine()
@@ -140,11 +136,11 @@
if 'direct-pool' not in conn.listNetworks():
createDirectPool(conn)
-
+
except:
- pass
-
-
+ sys.stderr.write('vmfex: Error in libvirt network definition: %s\n' % entry)
+ sys.exit(2)
+
try:
#Get the vmfex line
vmfex = os.environ['vmfex']
@@ -153,12 +149,11 @@
domxml = hooking.read_domxml()
devices = domxml.getElementsByTagName('devices')[0]
vnicmap = enumNics(devices)
-
+
counter = 0
-
for entry in vmfex.split(','):
sys.stderr.write('vmfex: adding interface to profile: %s\n' % entry)
- try:
+ try:
nicnum = int(entry.split(':')[0][3:])
profile = entry.split(':')[1]
mynic = vnicmap[nicnum]
@@ -168,7 +163,7 @@
source = mynic.getElementsByTagName('source')[0]
source.removeAttribute('bridge')
source.setAttribute('network', 'direct-pool')
-
+
virtualport = domxml.createElement('virtualport')
virtualport.setAttribute('type', '802.1Qbh')
mynic.appendChild(virtualport)
@@ -176,7 +171,7 @@
parameters = domxml.createElement('parameters')
parameters.setAttribute('profileid', profile)
virtualport.appendChild(parameters)
-
+
except:
sys.stderr.write('vmfex: Error in vmfex custom property line: %s\n' % entry)
sys.exit(2)
--
To view, visit http://gerrit.ovirt.org/7548
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbce514ffb5547aa90e56495771802409cbc0dbc
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Yasny <dyasny(a)gmail.com>
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Correct vdsClient's help for the verb getVmsInfo
......................................................................
Patch Set 2:
Build Failed
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/740/ : ABORTED
--
To view, visit http://gerrit.ovirt.org/7560
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I152f28dea29f6ac6bb61c0597dbd3b596646c569
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhu Bo <bozhu(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Zhu Bo <bozhu(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Zhou Zheng Sheng has posted comments on this change.
Change subject: Correct vdsClient's help for the verb getVmsInfo
......................................................................
Patch Set 1: I would prefer that you didn't submit this
(2 inline comments)
....................................................
File vdsm_cli/vdsClient.py
Line 1372: return 0, ''
Line 1373:
Line 1374: def do_getVmsInfo(self, args):
Line 1375: spUUID = args[0]
Line 1376: if len(args) >= 2:
>From this code we can see, if vm id list is given, then the sdUUID must be given as well. If sdUUID is not given, then vm id list must not be given too.
Line 1377: sdUUID = args[1]
Line 1378: else:
Line 1379: sdUUID = BLANK_UUID
Line 1380: if len(args) >= 3:
Line 2220: 'Send a string containing monitor command to the '
Line 2221: 'desktop'
Line 2222: )),
Line 2223: 'getVmsInfo': (serv.do_getVmsInfo,
Line 2224: ('<spUUID> [sdUUID] [vmList](vmId1,vmId2,...)',
After reading the implementation of do_getVmsInfo, I think the command format is as follow.
<spUUID> [<sdUUID> [vmList](vmId1,vmId2,...)]
Due to the implementation limit, we can not ignore the second parameter and just pass the third parameter.
Line 2225: 'Return info of VMs from the pool or a backup domain '
Line 2226: 'if it\'s sdUUID given. If vmList also given, only get '
Line 2227: 'info for these VMs.'
Line 2228: )),
--
To view, visit http://gerrit.ovirt.org/7560
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I152f28dea29f6ac6bb61c0597dbd3b596646c569
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhu Bo <bozhu(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Mark Wu <wudxw(a)linux.vnet.ibm.com>
Gerrit-Reviewer: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Correct vdsClient's help for the verb getVmsInfo
......................................................................
Patch Set 1:
Build Failed
http://jenkins.ovirt.info/job/patch_vdsm_unit_tests/737/ : ABORTED
--
To view, visit http://gerrit.ovirt.org/7560
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I152f28dea29f6ac6bb61c0597dbd3b596646c569
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Zhu Bo <bozhu(a)linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
Moti Asayag has uploaded a new change for review.
Change subject: BZ#811807 Libvirt service engagement workaround
......................................................................
BZ#811807 Libvirt service engagement workaround
The patch intended to bypass a false report of libvirt service as
started (when started with initctl). Instead of relying on initctl,
vdsm awaits few seconds till the service is reported with its allocated
process id (by 'pgrep').
Change-Id: I7f6fb1ef12caeca3a47adec206b653932026634f
Signed-off-by: Moti Asayag <masayag(a)redhat.com>
---
M vdsm/vdsmd.init.in
1 file changed, 14 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/61/7361/1
diff --git a/vdsm/vdsmd.init.in b/vdsm/vdsmd.init.in
index d34b48d..fd09394 100755
--- a/vdsm/vdsmd.init.in
+++ b/vdsm/vdsmd.init.in
@@ -440,6 +440,20 @@
startout=`/sbin/initctl start libvirtd 2>&1`
if [[ "$?" -eq 0 || "$startout" =~ .*already\ running.* ]];
then
+
+ # Begin workaround
+ # Libvirt reports its service status as responsive despite its socket
+ # is not yet ready. Once issue fixed on libvirt, this WA shouls be removed.
+ for i in {1..20}
+ do
+ if pgrep libvirtd > /dev/null 2>&1;
+ then
+ return 0
+ fi
+ sleep 1
+ done
+ # End workaround
+
return 0
else
echo "$startout" >&2
--
To view, visit http://gerrit.ovirt.org/7361
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f6fb1ef12caeca3a47adec206b653932026634f
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Moti Asayag <masayag(a)redhat.com>
Adam Litke has uploaded a new change for review.
Change subject: [WIP] vdsm API and libvdsm
......................................................................
[WIP] vdsm API and libvdsm
This work-in-progress patch demonstrates the mechanics of generating a working
C API and remote transport from a schema definition. The "C" API is written in
Vala to more easily take advantage of GObjects and reduce the amount of
boilerplate code that we need to generate and maintain. The API has a static
part and a dynamically generated part. I generate the dynamic part by using the
same technique employed by qemu for generating the qapi bindings (python format
strings). The build system produces libvdsm and a C test program. An included
python program demonstrates how the automatic python bindings work. A test
server is included to enable the test programs to function. We use JSON for
internal object storage and also as the wire format.
Thank you Saggi for sharing some great ideas (many of which are
incorporated into this patch).
TODO:
- Fix issues in the main schema
* Return values must be anonymous, singular types
* Remove 'IntStr' and friends in favor of native representation
- Support generation for the entire schema
* Mapping types
* Enums with non-C string values
* Finish array support
* Generate the command sub-classes (VM, Volume, StorageDomain, etc)
- Connect the server to the real vdsm API
* Functions must map from the new schema to the old implementation
- Validate argument and return types on the server side
- Probably a few more things I haven't yet thought of
Signed-off-by: Adam Litke <agl(a)us.ibm.com>
Change-Id: I7c7427ea3f757135c9919fd65603495878fe3ae6
---
M Makefile.am
M build-aux/gitlog-to-changelog
M configure.ac
A vdsm_api/Makefile.am
A vdsm_api/generate.py
A vdsm_api/libvdsm-base.vala
A vdsm_api/schema.json
A vdsm_api/test.c
A vdsm_api/test.py
A vdsm_api/test_serv.py
10 files changed, 1,524 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/63/6863/1
--
To view, visit http://gerrit.ovirt.org/6863
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7c7427ea3f757135c9919fd65603495878fe3ae6
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <agl(a)us.ibm.com>