'Assert the implementation of
``IBlockDeviceAPI.list_volumes`` returns ``BlockDeviceVolume``s
with the ``expected_volume_size`` and that
``IBlockDeviceAPI.create_volume`` creates devices with an
``expected_device_size`` (expected_volume_size plus platform
specific over allocation).
A device is created and attached, then ``lsblk`` is used to
measure the size of the block device, as reported by the
kernel of the machine to which the device is attached.
:param int requested_size: Requested size of created volume.
:param int expected_size: Expected size of created device.'

def _verify_volume_size(self, requested_size, expected_volume_size):

    dataset_id = uuid4()
    volume = self.api.create_volume(dataset_id=dataset_id, size=requested_size)
    expected_device_size = allocated_size(self.device_allocation_unit, expected_volume_size)
    self.api.attach_volume(volume.blockdevice_id, attach_to=self.this_node)
    def validate(volume):
        volume = get_blockdevice_volume(self.api, volume.blockdevice_id)
        device_path = self.api.get_device_path(volume.blockdevice_id).path
        command = ['/bin/lsblk', '--noheadings', '--bytes', '--output', 'SIZE', device_path.encode('ascii')]
        command_output = check_output(command).split('\n')[0]
        device_size = int(command_output.strip().decode('ascii'))
        self.assertEqual((expected_volume_size, expected_device_size), (volume.size, device_size))
    self.repeat_until_consistent(validate, volume)
