[libvirt] [PATCH] storage: Fix iscsi-direct volume size for volumes > 4GiB

Both block_size and nb_block are unit32_t. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/storage/storage_backend_iscsi_direct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c index 20997d5c5d..78dc4bd100 100644 --- a/src/storage/storage_backend_iscsi_direct.c +++ b/src/storage/storage_backend_iscsi_direct.c @@ -321,8 +321,8 @@ virISCSIDirectRefreshVol(virStoragePoolObjPtr pool, if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block) < 0) return -1; - vol->target.capacity = block_size * nb_block; - vol->target.allocation = block_size * nb_block; + vol->target.capacity = (unsigned long long)block_size * nb_block; + vol->target.allocation = (unsigned long long)block_size * nb_block; def->capacity += vol->target.capacity; def->allocation += vol->target.allocation; -- 2.21.0

On Thu, Feb 28, 2019 at 15:22:00 +0100, Jiri Denemark wrote:
Both block_size and nb_block are unit32_t.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/storage/storage_backend_iscsi_direct.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/storage/storage_backend_iscsi_direct.c b/src/storage/storage_backend_iscsi_direct.c index 20997d5c5d..78dc4bd100 100644 --- a/src/storage/storage_backend_iscsi_direct.c +++ b/src/storage/storage_backend_iscsi_direct.c @@ -321,8 +321,8 @@ virISCSIDirectRefreshVol(virStoragePoolObjPtr pool, if (virISCSIDirectGetVolumeCapacity(iscsi, lun, &block_size, &nb_block) < 0) return -1;
- vol->target.capacity = block_size * nb_block; - vol->target.allocation = block_size * nb_block; + vol->target.capacity = (unsigned long long)block_size * nb_block; + vol->target.allocation = (unsigned long long)block_size * nb_block; def->capacity += vol->target.capacity; def->allocation += vol->target.allocation;
Self-NACK. We need a little bit more invasive approach to also support volumes larger than 2TiB (with 512B block size). Jirka
participants (1)
-
Jiri Denemark