[libvirt] [PATCH v2 2/8] blockcopy: split out virsh implementation

Peter Krempa pkrempa at redhat.com
Tue Aug 26 15:00:19 UTC 2014


On 08/26/14 13:21, Eric Blake wrote:
> I'm about to extend the capabilities of blockcopy.  Hiding a few
> common lines of implementation gets in the way of the new required
> logic, and putting the new logic in the common implementation won't
> benefit any of the other blockjob operations.  Therefore, it is
> simpler to just do the work inline.
> 
> * tools/virsh-domain.c (blockJobImpl): Drop unused variable. Move
> block copy guts...
> (cmdBlockCopy): ...into their lone caller.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  tools/virsh-domain.c | 45 +++++++++++++++++++++++++++------------------
>  1 file changed, 27 insertions(+), 18 deletions(-)
> 
> diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
> index 2562326..fb9c009 100644
> --- a/tools/virsh-domain.c
> +++ b/tools/virsh-domain.c
> @@ -1443,8 +1443,7 @@ typedef enum {
>      VSH_CMD_BLOCK_JOB_INFO = 1,
>      VSH_CMD_BLOCK_JOB_SPEED = 2,
>      VSH_CMD_BLOCK_JOB_PULL = 3,
> -    VSH_CMD_BLOCK_JOB_COPY = 4,
> -    VSH_CMD_BLOCK_JOB_COMMIT = 5,
> +    VSH_CMD_BLOCK_JOB_COMMIT = 4,
>  } vshCmdBlockJobMode;
> 
>  static int
> @@ -1453,14 +1452,14 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd,
>               virDomainPtr *pdom)
>  {
>      virDomainPtr dom = NULL;
> -    const char *name, *path;
> +    const char *path;

This ...

>      unsigned long bandwidth = 0;
>      int ret = -1;
>      const char *base = NULL;
>      const char *top = NULL;
>      unsigned int flags = 0;
> 
> -    if (!(dom = vshCommandOptDomain(ctl, cmd, &name)))
> +    if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))

.. and this are unrelated changes.

>          goto cleanup;
> 
>      if (vshCommandOptStringReq(ctl, cmd, "path", &path) < 0)

ACK although I'd rather see the two changes separate.

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140826/ff82bfaf/attachment-0001.sig>


More information about the libvir-list mailing list