Re: [PATCH 1/3] storage: Introduce virStorageBackendZeroDeviceHeader

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

 



On Fri, Apr 07, 2017 at 07:49:57 -0400, John Ferlan wrote:
> Create a wrapper/helper that can be used to call the storage backend
> wipe helper - storageBackendVolWipeLocalFile for future use by logical
> and disk backends to clear out the partition table rather than having
> each open code the same algorithm.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/storage/storage_util.c | 18 ++++++++++++++++++
>  src/storage/storage_util.h |  4 ++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
> index 8e25984..784df7a 100644
> --- a/src/storage/storage_util.c
> +++ b/src/storage/storage_util.c
> @@ -4087,3 +4087,21 @@ virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
>  
>      return found;
>  }
> +
> +
> +/*
> + * @path: Path to the device to initialize
> + * @size: Size to be cleared
> + *
> + * Clear out device header for the purpose of being able to write
> + * some sort of partition to the device.
> + *
> + * Returns 0 on success, -1 on failure with error message set
> + */
> +int
> +virStorageBackendZeroDeviceHeader(const char *path,
> +                                  unsigned long long size)
> +{
> +    return storageBackendVolWipeLocalFile(path, VIR_STORAGE_VOL_WIPE_ALG_ZERO,
> +                                          size);

Do you plan on adding stuff here? otherwise it's quite useless.

> +}
> diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h
> index 602d3a0..756d140 100644
> --- a/src/storage/storage_util.h
> +++ b/src/storage/storage_util.h
> @@ -167,4 +167,8 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
>  int virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
>                                   uint32_t scanhost);
>  
> +int
> +virStorageBackendZeroDeviceHeader(const char *path,
> +                                  unsigned long long size);
> +
>  #endif /* __VIR_STORAGE_UTIL_H__ */
> -- 
> 2.9.3
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: PGP signature

--
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]
  Powered by Linux