From: Miroslav Rezanina Subject: [PATCH] check for cdrom file on device reconfigure Date: Tue, 26 Oct 2010 03:40:16 -0400 (EDT) Message-ID: <318524401.373251288078816616.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> References: <372543940.373181288078681968.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <372543940.373181288078681968.JavaMail.root@zmail06.collab.prod.int.phx2.redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel List-Id: xen-devel@lists.xenproject.org When guest is started with non-existing file specified as cdrom device, error is reported. However, when we try to use block-configure to change cdrom to non-existing file, command is executed successfully although qemu can't open this file. Following patch checks if we can read specified file and raise error when this is not possible. Signed-off-by: Miroslav Rezanina -- diff -r 3c4c3d48a835 tools/python/xen/xend/server/blkif.py --- a/tools/python/xen/xend/server/blkif.py Thu Aug 26 11:16:56 2010 +0100 +++ b/tools/python/xen/xend/server/blkif.py Tue Oct 26 09:13:28 2010 +0200 @@ -130,6 +130,11 @@ if (dev_type == 'cdrom' and new_front['device-type'] == 'cdrom' and dev == new_back['dev'] and mode == 'r'): + + # check if can't access device file + if not os.access(new_back['params'],os.R_OK): + raise VmError("Can't open file %s" % new_back['params']) + # dummy device self.writeBackend(devid, 'type', new_back['type'], -- Miroslav Rezanina Software Engineer - Virtualization Team - XEN kernel