提交 e2d402d0 编写于 作者: Z Zhang Haoyu 提交者: Michael Roth

snapshot: fix referencing wrong variable in while loop in do_delvm

The while loop variabal is "bs1",
but "bs" is always passed to bdrv_snapshot_delete_by_id_or_name.
Broken in commit a89d89d3, v1.7.0.
Signed-off-by: NZhang Haoyu <zhanghy@sangfor.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NStefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit af957387)
Signed-off-by: NMichael Roth <mdroth@linux.vnet.ibm.com>
上级 4d492e89
...@@ -1245,19 +1245,18 @@ int load_vmstate(const char *name) ...@@ -1245,19 +1245,18 @@ int load_vmstate(const char *name)
void do_delvm(Monitor *mon, const QDict *qdict) void do_delvm(Monitor *mon, const QDict *qdict)
{ {
BlockDriverState *bs, *bs1; BlockDriverState *bs;
Error *err = NULL; Error *err = NULL;
const char *name = qdict_get_str(qdict, "name"); const char *name = qdict_get_str(qdict, "name");
bs = find_vmstate_bs(); if (!find_vmstate_bs()) {
if (!bs) {
monitor_printf(mon, "No block device supports snapshots\n"); monitor_printf(mon, "No block device supports snapshots\n");
return; return;
} }
bs1 = NULL; bs = NULL;
while ((bs1 = bdrv_next(bs1))) { while ((bs = bdrv_next(bs))) {
if (bdrv_can_snapshot(bs1)) { if (bdrv_can_snapshot(bs)) {
bdrv_snapshot_delete_by_id_or_name(bs, name, &err); bdrv_snapshot_delete_by_id_or_name(bs, name, &err);
if (err) { if (err) {
monitor_printf(mon, monitor_printf(mon,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册