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

Re: [libvirt] [PATCH 3/3] Add virsh option for format flags



On Thu, Feb 18, 2010 at 05:58:07PM -0500, David Allan wrote:
> ---
>  tools/virsh.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index bd6b6be..de8c67d 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -4015,6 +4015,7 @@ static const vshCmdInfo info_pool_build[] = {
> 
>  static const vshCmdOptDef opts_pool_build[] = {
>      {"pool", VSH_OT_DATA, VSH_OFLAG_REQ, gettext_noop("pool name or uuid")},
> +    {"format", VSH_OT_BOOL, 0, gettext_noop("format the pool (destructive)")},
>      {NULL, 0, 0, NULL}
>  };
> 
> @@ -4023,6 +4024,7 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
>  {
>      virStoragePoolPtr pool;
>      int ret = TRUE;
> +    int flags = 0;
>      char *name;
> 
>      if (!vshConnectionUsability(ctl, ctl->conn, TRUE))
> @@ -4031,7 +4033,10 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd)
>      if (!(pool = vshCommandOptPool(ctl, cmd, "pool", &name)))
>          return FALSE;
> 
> -    if (virStoragePoolBuild(pool, 0) == 0) {
> +    if (vshCommandOptBool (cmd, "format"))
> +        flags |= VIR_STORAGE_POOL_CREATE_FORMAT;
> +
> +    if (virStoragePoolBuild(pool, flags) == 0) {
>          vshPrint(ctl, _("Pool %s built\n"), name);
>      } else {
>          vshError(ctl, _("Failed to build pool %s"), name);

  Same thing we probably need to extend this a bit for ext2/ext3/ext4/xfs
being able to format a pool with an FS supporting very fast fallocate()
for images can make a serious performance change, so I think it's worth
the extra work, no ?

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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