Re: [PATCH 1/2] Add --source-format argument to virsh pool-define-as and pool-create-as

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

 



On 05/30/2010 10:24 AM, Justin Clift wrote:
> Hi all,
> 
> When creating pools from dedicated disks, the existing pool-define-as 
> and pool-create-as commands are a bit non-optimal.
> 
> Ideally, a person would be able to specify all of the required options 
> directly on the command line instead of having to edit the XML.
> 
> At the moment, there is no way to specify the format type (ie gpt) so it 
> gets included in the XML the pool is constructed with.
> 
> Please find attached a simple (tested) patch to add an optional 
> "--source-format 'type'" to virsh.  This is patched against current git 
> master and will apply cleanly.
> 
> Also created a Red Hat BZ ticket for this (#597790) for tracking.
> 
> Regards and best wishes,
> 
> Justin Clift
> 
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 4930ad7..1279f41 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -4468,13 +4468,14 @@ static const vshCmdOptDef opts_pool_X_as[] = {
>      {"source-dev", VSH_OT_DATA, 0, N_("source device for underlying storage")},
>      {"source-name", VSH_OT_DATA, 0, N_("source name for underlying storage")},
>      {"target", VSH_OT_DATA, 0, N_("target for underlying storage")},
> +    {"source-format", VSH_OT_STRING, 0, N_("format for underlying storage")},
>      {NULL, 0, 0, NULL}
>  };
>  
>  static int buildPoolXML(const vshCmd *cmd, char **retname, char **xml) {
>  
>      int found;
> -    char *name, *type, *srcHost, *srcPath, *srcDev, *srcName, *target;
> +    char *name, *type, *srcHost, *srcPath, *srcDev, *srcName, *srcFormat, *target;
>      virBuffer buf = VIR_BUFFER_INITIALIZER;
>  
>      name = vshCommandOptString(cmd, "name", &found);
> @@ -4488,6 +4489,7 @@ static int buildPoolXML(const vshCmd *cmd, char **retname, char **xml) {
>      srcPath = vshCommandOptString(cmd, "source-path", &found);
>      srcDev = vshCommandOptString(cmd, "source-dev", &found);
>      srcName = vshCommandOptString(cmd, "source-name", &found);
> +    srcFormat = vshCommandOptString(cmd, "source-format", &found);
>      target = vshCommandOptString(cmd, "target", &found);
>  
>      virBufferVSprintf(&buf, "<pool type='%s'>\n", type);
> @@ -4501,6 +4503,8 @@ static int buildPoolXML(const vshCmd *cmd, char **retname, char **xml) {
>              virBufferVSprintf(&buf, "    <dir path='%s'/>\n", srcPath);
>          if (srcDev)
>              virBufferVSprintf(&buf, "    <device path='%s'/>\n", srcDev);
> +        if (srcFormat)
> +            virBufferVSprintf(&buf, "    <format type='%s'/>\n", srcFormat);
>          if (srcName)
>              virBufferVSprintf(&buf, "    <name>%s</name>\n", srcName);
>  

ACK

- Cole

--
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]