From 19a61b1f383c4a0148a53af9420e41e564efdca9 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino <lcapitulino@redhat.com> Date: Wed, 7 Jul 2010 17:28:50 -0300 Subject: [PATCH] Monitor: Check for error in do_change() RH-Author: Luiz Capitulino <lcapitulino@redhat.com> Message-id: <20100707142850.2f0e7152@redhat.com> Patchwork-id: 10556 O-Subject: [PATCH v2] Monitor: Check for error in do_change() Bugzilla: 611982 RH-Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com> RH-Acked-by: Juan Quintela <quintela@redhat.com> RH-Acked-by: Kevin Wolf <kwolf@redhat.com> Bugzilla: 611982 This is needed so that libvirt is capable of detecting the failure, based on upstream commit: 07a5d95a3b32820662194d353da9c098adddde77. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> --- v2: change the error message to match upstream's qemu/monitor.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- qemu/monitor.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/qemu/monitor.c b/qemu/monitor.c index 4cfe2e4..2540f3d 100644 --- a/qemu/monitor.c +++ b/qemu/monitor.c @@ -549,7 +549,10 @@ static void do_change_block(const char *device, const char *filename, const char } if (eject_device(bs, 0) < 0) return; - bdrv_open2(bs, filename, BDRV_O_RDWR, drv); + if (bdrv_open2(bs, filename, BDRV_O_RDWR, drv) != 0) { + term_printf("Could not open '%s'\n", filename); + return; + } qemu_key_check(bs, filename); } -- 1.7.0.3