提交 84020f9a 编写于 作者: J John Ferlan

storage: Disallow wiping an extended disk partition

https://bugzilla.redhat.com/show_bug.cgi?id=1225694

Check if the disk partition to be wiped is the extended partition, if
so then disallow it. Do this via changing the wipeVol backend to check
the volume before passing to the common virStorageBackendVolWipeLocal
上级 243bbcc5
...@@ -851,6 +851,24 @@ virStorageBackendDiskBuildVolFrom(virConnectPtr conn, ...@@ -851,6 +851,24 @@ virStorageBackendDiskBuildVolFrom(virConnectPtr conn,
} }
static int
virStorageBackendDiskVolWipe(virConnectPtr conn,
virStoragePoolObjPtr pool,
virStorageVolDefPtr vol,
unsigned int algorithm,
unsigned int flags)
{
if (vol->source.partType != VIR_STORAGE_VOL_DISK_TYPE_EXTENDED)
return virStorageBackendVolWipeLocal(conn, pool, vol, algorithm, flags);
/* Wiping an extended partition is not support */
virReportError(VIR_ERR_NO_SUPPORT,
_("cannot wipe extended partition '%s'"),
vol->target.path);
return -1;
}
virStorageBackend virStorageBackendDisk = { virStorageBackend virStorageBackendDisk = {
.type = VIR_STORAGE_POOL_DISK, .type = VIR_STORAGE_POOL_DISK,
...@@ -862,5 +880,5 @@ virStorageBackend virStorageBackendDisk = { ...@@ -862,5 +880,5 @@ virStorageBackend virStorageBackendDisk = {
.buildVolFrom = virStorageBackendDiskBuildVolFrom, .buildVolFrom = virStorageBackendDiskBuildVolFrom,
.uploadVol = virStorageBackendVolUploadLocal, .uploadVol = virStorageBackendVolUploadLocal,
.downloadVol = virStorageBackendVolDownloadLocal, .downloadVol = virStorageBackendVolDownloadLocal,
.wipeVol = virStorageBackendVolWipeLocal, .wipeVol = virStorageBackendDiskVolWipe,
}; };
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册