Description of problem:
#virsh help pool-define-as
pool-define-as - define a pool from a set of args
pool-define-as <name> [--print-xml] <type> [<source-host>] [<source-path>] [<source-dev>] [<source-name>] [<target>]
Define a pool.
<name> name of the pool
--print-xml print XML document, but don't define/create
<type> type of the pool
<source-host> source-host for underlying storage
<source-path> source path for underlying storage
<source-dev> source device for underlying storage
<source-name> source name for underlying storage
<target> target for underlying storage
not easy way to finger out how to construct the optional parameters. pool-create-as is the same. Should look like [--target <target>].
vol-create-as is good.
# virsh help vol-create-as
vol-create-as - create a volume from a set of args
vol-create-as <pool> <name> <capacity> [--allocation <string>] [--format <string>]
Create a vol.
<pool> pool name
<name> name of the volume
<capacity> size of the vol with optional k,M,G,T suffix
--allocation <string> initial allocation size with optional k,M,G,T suffix
--format <string> file format type raw,bochs,qcow,qcow2,vmdk
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. virsh help pool-define-as
2. virsh help pool-create-as
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release. Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release. This request is not yet committed for
I'm not sure this is a bug. The two commands currently have different syntax, where pool-define-as is positionally dependent (if there is one string, you specified <source-host>; if there are 2 strings, you specified <source-host> and <source-path>, etc), where vol-create-as is position independent (either option can be specified without the other, so the leading option string is mandatory).
$ virsh -c test:///default pool-define-as sample --print-xml dir localhost
$ virsh -c test:///default pool-define-as sample --print-xml dir localhost /opt
compared to vol-create-as, where the '--format' is required:
$ virsh -c test:///default vol-create-as default-pool sample 1k raw
error: unexpected data 'raw'
$ virsh -c test:///default vol-create-as default-pool sample 1k --format raw
Vol sample created
Then, since it is possible to have XML that describes the target but not the source...
$ virsh -c test:///default pool-dumpxml default-pool
...virsh implemented the shortcut that any option that does not call out a leading --option designator may nevertheless provide one:
$ virsh -c test:///default pool-define-as sample --print-xml dir --target target
So with pool-define-as, you can provide <target> by two methods:
pool-define-as $name $type $host $path $dev $name $target
pool-define-as $name $type --target $target
But with vol-create-as, you only have one option for specifying <format>:
vol-create-as $pool $name $capacity --format $format
The two semantics are intentional, and consistently documented (in the code, it is the difference between VSH_OT_DATA and VSH_OT_STRING). The only question now is whether there's anything we can do visually to make VSH_OT_DATA more obvious that the leading --target is available for use.
[--target] <target> target for underlying storage
would make this better?
libvirt-0_8_1-12_el6 has been built in RHEL-6-candidate with the fix.
Verified PASSED with libvirt-0.8.1-13.el6.
Verified with libvirt-0.8.1-27.el6.x86_64 & qemu-kvm-0.12.1.2-2.113.el6.x86_64.
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.