Re: [PATCH] storage: Disallow wiping an extended disk partition

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10.06.2015 00:19, John Ferlan wrote:
> 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
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/storage/storage_backend_disk.c | 20 +++++++++++++++++++-
>  1 file changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
> index c4bd6fe..a283a86 100644
> --- a/src/storage/storage_backend_disk.c
> +++ b/src/storage/storage_backend_disk.c
> @@ -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 = {
>      .type = VIR_STORAGE_POOL_DISK,
>  
> @@ -862,5 +880,5 @@ virStorageBackend virStorageBackendDisk = {
>      .buildVolFrom = virStorageBackendDiskBuildVolFrom,
>      .uploadVol = virStorageBackendVolUploadLocal,
>      .downloadVol = virStorageBackendVolDownloadLocal,
> -    .wipeVol = virStorageBackendVolWipeLocal,
> +    .wipeVol = virStorageBackendDiskVolWipe,
>  };
> 

Correct, mangling partition table is not desired. BTW: couldn't
something similar happen with LVM?

ACK to this though.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]