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

Re: [libvirt] [PATCH 06/11] qemu: Clean up old leftovers in qemuMonitorDrivePivot




On 04/01/2015 01:20 PM, Peter Krempa wrote:
> There are two leftover unused variables. Remove them and clean up the
> fallout of the change.
> ---
>  src/qemu/qemu_driver.c       |  5 +----
>  src/qemu/qemu_monitor.c      | 21 +++++++++------------
>  src/qemu/qemu_monitor.h      |  6 ++----
>  src/qemu/qemu_monitor_json.c |  5 ++---
>  src/qemu/qemu_monitor_json.h |  4 +---
>  tests/qemumonitorjsontest.c  |  2 +-
>  6 files changed, 16 insertions(+), 27 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index eec5457..7c33ca3 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -16050,7 +16050,6 @@ qemuDomainBlockPivot(virConnectPtr conn,
>      int ret = -1, rc;
>      qemuDomainObjPrivatePtr priv = vm->privateData;
>      virDomainBlockJobInfo info;
> -    const char *format = NULL;
>      bool resume = false;
>      virStorageSourcePtr oldsrc = NULL;
>      virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
> @@ -16062,8 +16061,6 @@ qemuDomainBlockPivot(virConnectPtr conn,
>          goto cleanup;
>      }
> 
> -    format = virStorageFileFormatTypeToString(disk->mirror->format);
> -
>      /* Probe the status, if needed.  */
>      if (!disk->mirrorState) {
>          qemuDomainObjEnterMonitor(driver, vm);
> @@ -16147,7 +16144,7 @@ qemuDomainBlockPivot(virConnectPtr conn,
>       * overall return value.  */
>      disk->mirrorState = VIR_DOMAIN_DISK_MIRROR_STATE_PIVOT;
>      qemuDomainObjEnterMonitor(driver, vm);
> -    ret = qemuMonitorDrivePivot(priv->mon, device, disk->mirror->path, format);
> +    ret = qemuMonitorDrivePivot(priv->mon, device);
>      if (qemuDomainObjExitMonitor(driver, vm) < 0) {
>          ret = -1;
>          goto cleanup;
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index aae259f..0e50dbb 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -3492,23 +3492,20 @@ qemuMonitorDiskNameLookup(qemuMonitorPtr mon,
>  }
> 
> 
> -/* Use the block-job-complete monitor command to pivot a block copy
> - * job.  */
> +/* Use the block-job-complete monitor command to pivot a block copy job.  */

NIT: extraneous space before close comment...

>  int
> -qemuMonitorDrivePivot(qemuMonitorPtr mon, const char *device,
> -                      const char *file, const char *format)
> +qemuMonitorDrivePivot(qemuMonitorPtr mon,
> +                      const char *device)
>  {
> -    int ret = -1;
> -
> -    VIR_DEBUG("mon=%p, device=%s, file=%s, format=%s",
> -              mon, device, file, NULLSTR(format));
> +    VIR_DEBUG("mon=%p, device=%s", mon, device);
> 
> -    if (mon->json)
> -        ret = qemuMonitorJSONDrivePivot(mon, device, file, format);
> -    else
> +    if (mon->json) {

if (!mon->json)

ACK with the adjustment...

John
>          virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
>                         _("drive pivot requires JSON monitor"));
> -    return ret;
> +        return -1;
> +    }
> +
> +    return qemuMonitorJSONDrivePivot(mon, device);
>  }
> 
>  int qemuMonitorArbitraryCommand(qemuMonitorPtr mon,
> diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
> index 9cd0d9d..78f4648 100644
> --- a/src/qemu/qemu_monitor.h
> +++ b/src/qemu/qemu_monitor.h
> @@ -721,10 +721,8 @@ int qemuMonitorDriveMirror(qemuMonitorPtr mon,
>                             unsigned int flags)
>      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
>  int qemuMonitorDrivePivot(qemuMonitorPtr mon,
> -                          const char *device,
> -                          const char *file,
> -                          const char *format)
> -    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
> +                          const char *device)
> +    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
> 
>  int qemuMonitorBlockCommit(qemuMonitorPtr mon,
>                             const char *device,
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index 34a6d56..e0f16ec 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -3859,9 +3859,8 @@ qemuMonitorJSONBlockCommit(qemuMonitorPtr mon, const char *device,
>  }
> 
>  int
> -qemuMonitorJSONDrivePivot(qemuMonitorPtr mon, const char *device,
> -                          const char *file ATTRIBUTE_UNUSED,
> -                          const char *format ATTRIBUTE_UNUSED)
> +qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
> +                          const char *device)
>  {
>      int ret;
>      virJSONValuePtr cmd;
> diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
> index 09f898c..5185bbf 100644
> --- a/src/qemu/qemu_monitor_json.h
> +++ b/src/qemu/qemu_monitor_json.h
> @@ -264,9 +264,7 @@ int qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
>                                 unsigned int flags)
>      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
>  int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
> -                              const char *device,
> -                              const char *file,
> -                              const char *format)
> +                              const char *device)
>      ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
> 
>  int qemuMonitorJSONBlockCommit(qemuMonitorPtr mon,
> diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
> index f09176a..170d690 100644
> --- a/tests/qemumonitorjsontest.c
> +++ b/tests/qemumonitorjsontest.c
> @@ -1186,7 +1186,7 @@ GEN_TEST_FUNC(qemuMonitorJSONSetDrivePassphrase, "vda", "secret_passhprase")
>  GEN_TEST_FUNC(qemuMonitorJSONDriveMirror, "vdb", "/foo/bar", NULL, 1024, 0, 0,
>                VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)
>  GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "/foo/bar1", "/foo/bar2", NULL, 1024)
> -GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb", NULL, NULL)
> +GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb")
>  GEN_TEST_FUNC(qemuMonitorJSONScreendump, "/foo/bar")
>  GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd", false)
>  GEN_TEST_FUNC(qemuMonitorJSONNBDServerStart, "localhost", 12345)
> 


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