Change in vdsm[master]: prepare for python 3's range

danken at redhat.com danken at redhat.com
Wed Apr 22 14:31:11 UTC 2015


Dan Kenigsberg has posted comments on this change.

Change subject: prepare for python 3's range
......................................................................


Patch Set 2:

(3 comments)

https://gerrit.ovirt.org/#/c/40079/2/vdsm/storage/threadPool.py
File vdsm/storage/threadPool.py:

Line 233:     # then sort them
Line 234: 
Line 235:     def sortTask(data):
Line 236:         print("SortTask starting for ", data)
Line 237:         numbers = list(range(data[0], data[1]))
> tuple
the no-op code below assumes sortable list. Let's not touch it in this patch.
Line 238:         for a in numbers:
Line 239:             rnd = randrange(0, len(numbers) - 1)
Line 240:             a, numbers[rnd] = numbers[rnd], a
Line 241:         print("SortTask sorting for ", data)


https://gerrit.ovirt.org/#/c/40079/2/vdsm/virt/guestagent.py
File vdsm/virt/guestagent.py:

Line 42:                               list(range(8 + 1)) +
Line 43:                               list(range(0xB, 0xC + 1)) +
Line 44:                               list(range(0xE, 0x1F + 1)) +
Line 45:                               list(range(0x7F, 0x84 + 1)) +
Line 46:                               list(range(0x86, 0x9F + 1)) +
> tuple
As much as I love tuples, I cannot concatenate so easily.
Line 47:                               [0xFFFE, 0xFFFF])
Line 48: 
Line 49: 
Line 50: def _filterXmlChars(u):


https://gerrit.ovirt.org/#/c/40079/2/vdsm_hooks/fakevmstats/after_get_all_vm_stats.py
File vdsm_hooks/fakevmstats/after_get_all_vm_stats.py:

Line 157:     # Each vm between 1 to 3 ifaces, not dynamic:
Line 158:     netIfaces = []
Line 159:     for i in range(1 + (vmDigest.next() % 3)):
Line 160:         netif = {}
Line 161:         hw = map(lambda x: vmDigest.next(), list(range(6)))
actually, an iterator is as good here. no change is required.
Line 162:         netif['hw'] = ETH_HW_ADDR_FORMAT % (hw[0], hw[1], hw[2], hw[3], hw[4],
Line 163:                                             hw[5])
Line 164:         inet = map(lambda x: vmDigest.next(), list(range(4)))
Line 165:         netif['inet'] = ['%d.%d.%d.%d' % (inet[0], inet[1], inet[2], inet[3])]


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I5adaec5e6829dd1d357ae2ef4ec646f625e0ebd4
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list