mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 22:25:25 +00:00
storage: Introduce virStorageBackendZeroPartitionTable
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.
This commit is contained in:
parent
859a2d162a
commit
e8b0212458
@ -4103,3 +4103,25 @@ virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
|
|||||||
|
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @path: Path to the device to initialize
|
||||||
|
* @size: Size to be cleared
|
||||||
|
*
|
||||||
|
* Zero out possible partition table information for the specified
|
||||||
|
* bytes from the start of the @path and from the end of @path
|
||||||
|
*
|
||||||
|
* Returns 0 on success, -1 on failure with error message set
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
virStorageBackendZeroPartitionTable(const char *path,
|
||||||
|
unsigned long long size)
|
||||||
|
{
|
||||||
|
if (storageBackendVolWipeLocalFile(path, VIR_STORAGE_VOL_WIPE_ALG_ZERO,
|
||||||
|
size, false) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return storageBackendVolWipeLocalFile(path, VIR_STORAGE_VOL_WIPE_ALG_ZERO,
|
||||||
|
size, true);
|
||||||
|
}
|
||||||
|
@ -167,4 +167,8 @@ virStorageBackendCreateQemuImgCmdFromVol(virConnectPtr conn,
|
|||||||
int virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
|
int virStorageBackendSCSIFindLUs(virStoragePoolObjPtr pool,
|
||||||
uint32_t scanhost);
|
uint32_t scanhost);
|
||||||
|
|
||||||
|
int
|
||||||
|
virStorageBackendZeroPartitionTable(const char *path,
|
||||||
|
unsigned long long size);
|
||||||
|
|
||||||
#endif /* __VIR_STORAGE_UTIL_H__ */
|
#endif /* __VIR_STORAGE_UTIL_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user