From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYECw-000446-If for qemu-devel@nongnu.org; Fri, 03 May 2013 07:31:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYECu-0002Sw-Sw for qemu-devel@nongnu.org; Fri, 03 May 2013 07:31:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60030) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYECu-0002Sp-Cu for qemu-devel@nongnu.org; Fri, 03 May 2013 07:31:20 -0400 Date: Fri, 3 May 2013 13:31:15 +0200 From: Kevin Wolf Message-ID: <20130503113115.GH3171@dhcp-200-207.str.redhat.com> References: <0e6041bc97526045c853c542a171223bca136d8e.1366817130.git.phrdina@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0e6041bc97526045c853c542a171223bca136d8e.1366817130.git.phrdina@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 08/12] qapi: Convert loadvm List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Pavel Hrdina Cc: xiawenc@linux.vnet.ibm.com, lcapitulino@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com Am 24.04.2013 um 17:32 hat Pavel Hrdina geschrieben: > QMP command vm-snapshot-load and HMP command loadvm behave similar to > vm-snapshot-delete and delvm. The only different is that they will load > the snapshot instead of deleting it. > > Signed-off-by: Pavel Hrdina > bs = NULL; > while ((bs = bdrv_next(bs))) { > if (bdrv_can_snapshot(bs)) { > - bdrv_snapshot_goto(bs, name, &local_err); > + /* Small hack to ensure that proper snapshot is deleted for every > + * block driver. This will be fixed soon. */ > + if (!strcmp(bs->drv->format_name, "rbd")) { > + bdrv_snapshot_goto(bs, sn.name, &local_err); > + } else { > + bdrv_snapshot_goto(bs, sn.id_str, &local_err); > + } I think I wanted to comment this in an earlier patch in this series, but didn't actually do it, so here is what I intended to write there: "Umm... Just no." Special casing an image format should _never_ happen. Even more so outside block.c (and it's disliked even there). It's a sign that we're doing something seriously wrong. > if (error_is_set(&local_err)) { > - qerror_report_err(local_err); > + error_setg(errp, "Failed to load snapshot for device '%s': %s", > + bdrv_get_device_name(bs), > + error_get_pretty(local_err)); > error_free(local_err); > - return -EIO; > + return NULL; > } > } > } > --- a/vl.c > +++ b/vl.c > @@ -4376,8 +4376,13 @@ int main(int argc, char **argv, char **envp) > > qemu_system_reset(VMRESET_SILENT); > if (loadvm) { > - if (load_vmstate(loadvm) < 0) { > + Error *local_err = NULL; > + qmp_vm_snapshot_load(true, loadvm, false, NULL, &local_err); > + > + if (error_is_set(&local_err)) { > autostart = 0; > + qerror_report_err(local_err); > + error_free(local_err); > } > } Should we add something like "Loading the snapshot failed"? It's probably not clear from all possible error messages. Kevin