Merge "libvirt: fixes python 3 related unit tests"

This commit is contained in:
Jenkins 2016-09-28 13:59:08 +00:00 committed by Gerrit Code Review
commit 02576d0237
5 changed files with 8 additions and 10 deletions

View File

@ -208,7 +208,7 @@ class HostInfo(object):
for cell_count in range(cpu_nodes): for cell_count in range(cpu_nodes):
cell = vconfig.LibvirtConfigCapsNUMACell() cell = vconfig.LibvirtConfigCapsNUMACell()
cell.id = cell_count cell.id = cell_count
cell.memory = kb_mem / cpu_nodes cell.memory = kb_mem // cpu_nodes
for socket_count in range(cpu_sockets): for socket_count in range(cpu_sockets):
for cpu_num in range(cpu_cores * cpu_threads): for cpu_num in range(cpu_cores * cpu_threads):
cpu = vconfig.LibvirtConfigCapsNUMACPU() cpu = vconfig.LibvirtConfigCapsNUMACPU()
@ -228,7 +228,7 @@ class HostInfo(object):
else: else:
mempages = vconfig.LibvirtConfigCapsNUMAPages() mempages = vconfig.LibvirtConfigCapsNUMAPages()
mempages.size = 4 mempages.size = 4
mempages.total = cell.memory / mempages.size mempages.total = cell.memory // mempages.size
mempages = [mempages] mempages = [mempages]
cell.mempages = mempages cell.mempages = mempages
topology.cells.append(cell) topology.cells.append(cell)

View File

@ -386,7 +386,7 @@ class FakeLibvirtTests(test.NoDBTestCase):
libvirt.VIR_CPU_COMPARE_IDENTICAL) libvirt.VIR_CPU_COMPARE_IDENTICAL)
def test_numa_topology_generation(self): def test_numa_topology_generation(self):
topology = """<topology> topology = b"""<topology>
<cells num="2"> <cells num="2">
<cell id="0"> <cell id="0">
<memory unit="KiB">7870000</memory> <memory unit="KiB">7870000</memory>

View File

@ -179,8 +179,8 @@ def _zero_volume(path, volume_size):
# and caters for versions of dd that don't have # and caters for versions of dd that don't have
# the easier to use iflag=count_bytes option. # the easier to use iflag=count_bytes option.
while remaining_bytes: while remaining_bytes:
zero_blocks = remaining_bytes / bs zero_blocks = remaining_bytes // bs
seek_blocks = (volume_size - remaining_bytes) / bs seek_blocks = (volume_size - remaining_bytes) // bs
zero_cmd = ('dd', 'bs=%s' % bs, zero_cmd = ('dd', 'bs=%s' % bs,
'if=/dev/zero', 'of=%s' % path, 'if=/dev/zero', 'of=%s' % path,
'seek=%s' % seek_blocks, 'count=%s' % zero_blocks) 'seek=%s' % seek_blocks, 'count=%s' % zero_blocks)
@ -189,7 +189,7 @@ def _zero_volume(path, volume_size):
if zero_blocks: if zero_blocks:
utils.execute(*zero_cmd, run_as_root=True) utils.execute(*zero_cmd, run_as_root=True)
remaining_bytes %= bs remaining_bytes %= bs
bs /= units.Ki # Limit to 3 iterations bs //= units.Ki # Limit to 3 iterations
# Use O_DIRECT with initial block size and fdatasync otherwise # Use O_DIRECT with initial block size and fdatasync otherwise
direct_flags = () direct_flags = ()
sync_flags = ('conv=fdatasync',) sync_flags = ('conv=fdatasync',)

View File

@ -182,7 +182,8 @@ class RBDDriver(object):
if not url.startswith(prefix): if not url.startswith(prefix):
reason = _('Not stored in rbd') reason = _('Not stored in rbd')
raise exception.ImageUnacceptable(image_id=url, reason=reason) raise exception.ImageUnacceptable(image_id=url, reason=reason)
pieces = map(urllib.parse.unquote, url[len(prefix):].split('/')) pieces = [urllib.parse.unquote(piece)
for piece in url[len(prefix):].split('/')]
if '' in pieces: if '' in pieces:
reason = _('Blank components') reason = _('Blank components')
raise exception.ImageUnacceptable(image_id=url, reason=reason) raise exception.ImageUnacceptable(image_id=url, reason=reason)

View File

@ -52,12 +52,10 @@ nova.tests.unit.test_wsgi.TestWSGIServerWithSSL
nova.tests.unit.virt.disk.mount.test_nbd.NbdTestCase nova.tests.unit.virt.disk.mount.test_nbd.NbdTestCase
nova.tests.unit.virt.ironic.test_driver.IronicDriverTestCase nova.tests.unit.virt.ironic.test_driver.IronicDriverTestCase
nova.tests.unit.virt.ironic.test_patcher.IronicDriverFieldsTestCase nova.tests.unit.virt.ironic.test_patcher.IronicDriverFieldsTestCase
nova.tests.unit.virt.libvirt.storage.test_lvm.LvmTestCase
nova.tests.unit.virt.libvirt.storage.test_rbd.RbdTestCase nova.tests.unit.virt.libvirt.storage.test_rbd.RbdTestCase
nova.tests.unit.virt.libvirt.test_driver.LibvirtConnTestCase nova.tests.unit.virt.libvirt.test_driver.LibvirtConnTestCase
nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase
nova.tests.unit.virt.libvirt.test_driver.LibvirtVolumeSnapshotTestCase nova.tests.unit.virt.libvirt.test_driver.LibvirtVolumeSnapshotTestCase
nova.tests.unit.virt.libvirt.test_fakelibvirt.FakeLibvirtTests.test_numa_topology_generation
nova.tests.unit.virt.libvirt.test_firewall.IptablesFirewallTestCase nova.tests.unit.virt.libvirt.test_firewall.IptablesFirewallTestCase
nova.tests.unit.virt.libvirt.test_imagebackend.EncryptedLvmTestCase nova.tests.unit.virt.libvirt.test_imagebackend.EncryptedLvmTestCase
nova.tests.unit.virt.libvirt.test_imagebackend.LvmTestCase nova.tests.unit.virt.libvirt.test_imagebackend.LvmTestCase
@ -65,7 +63,6 @@ nova.tests.unit.virt.libvirt.test_imagebackend.FlatTestCase
nova.tests.unit.virt.libvirt.test_imagebackend.RbdTestCase nova.tests.unit.virt.libvirt.test_imagebackend.RbdTestCase
nova.tests.unit.virt.libvirt.test_imagecache.ImageCacheManagerTestCase nova.tests.unit.virt.libvirt.test_imagecache.ImageCacheManagerTestCase
nova.tests.unit.virt.libvirt.test_imagecache.VerifyChecksumTestCase nova.tests.unit.virt.libvirt.test_imagecache.VerifyChecksumTestCase
nova.tests.unit.virt.libvirt.test_utils.LibvirtUtilsTestCase
nova.tests.unit.virt.libvirt.test_vif.LibvirtVifTestCase nova.tests.unit.virt.libvirt.test_vif.LibvirtVifTestCase
nova.tests.unit.virt.test_hardware.CPUPinningCellTestCase nova.tests.unit.virt.test_hardware.CPUPinningCellTestCase
nova.tests.unit.virt.test_hardware.CPUPinningTestCase nova.tests.unit.virt.test_hardware.CPUPinningTestCase