diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 233e293dd597ed240143add36b7c17a041898b97..300aab3b73d67809e7a2acae378e18e4ef63451d 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -654,7 +654,7 @@ virStorageBackendDiskPartBoundaries(virStoragePoolObjPtr pool, static int -virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED, +virStorageBackendDiskDeleteVol(virConnectPtr conn, virStoragePoolObjPtr pool, virStorageVolDefPtr vol, unsigned int flags) @@ -721,6 +721,15 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED, goto cleanup; } + /* If this was the extended partition, then all the logical partitions + * are then lost. Make it easy on ourselves and just refresh the pool + */ + if (vol->source.partType == VIR_STORAGE_VOL_DISK_TYPE_EXTENDED) { + virStoragePoolObjClearVols(pool); + if (virStorageBackendDiskRefreshPool(conn, pool) < 0) + goto cleanup; + } + rc = 0; cleanup: VIR_FREE(devpath);