storage: Add fs pool formatting

This patch adds the ability to make the filesystem for a filesystem
pool during a pool build.

The patch adds two new flags, no overwrite and overwrite, to control
when mkfs gets executed.  By default, the patch preserves the
current behavior, i.e., if no flags are specified, pool build on a
filesystem pool only makes the directory on which the filesystem
will be mounted.

If the no overwrite flag is specified, the target device is checked
to determine if a filesystem of the type specified in the pool is
present.  If a filesystem of that type is already present, mkfs is
not executed and the build call returns an error.  Otherwise, mkfs
is executed and any data present on the device is overwritten.

If the overwrite flag is specified, mkfs is always executed, and any
existing data on the target device is overwritten unconditionally.
This commit is contained in:
Osier Yang committed 2011-09-02 21:16:58 +08:00
1 parent 660cb2530f
commit 27758859c7
7 files changed
+215 -6

No files matched your search

+4 -2
View File
@@ -1670,8 +1670,10 @@ typedef enum {
typedef enum {
VIR_STORAGE_POOL_BUILD_NEW = 0, /* Regular build from scratch */
VIR_STORAGE_POOL_BUILD_REPAIR = 1, /* Repair / reinitialize */
VIR_STORAGE_POOL_BUILD_RESIZE = 2 /* Extend existing pool */
VIR_STORAGE_POOL_BUILD_REPAIR = (1 << 0), /* Repair / reinitialize */
VIR_STORAGE_POOL_BUILD_RESIZE = (1 << 1), /* Extend existing pool */
VIR_STORAGE_POOL_BUILD_NO_OVERWRITE = (1 << 2), /* Do not overwrite existing pool */
VIR_STORAGE_POOL_BUILD_OVERWRITE = (1 << 3), /* Overwrite data */
} virStoragePoolBuildFlags;
typedef enum {
+2
View File
@@ -235,6 +235,8 @@ typedef enum {
VIR_ERR_INVALID_STREAM = 73, /* stream pointer not valid */
VIR_ERR_ARGUMENT_UNSUPPORTED = 74, /* valid API use but unsupported by
the given driver */
VIR_ERR_STORAGE_PROBE_FAILED = 75, /* storage pool proble failed */
VIR_ERR_STORAGE_POOL_BUILT = 76, /* storage pool already built */
} virErrorNumber;
/**