[Kimchi-devel] [PATCH 3/3] Make sure ISO files have read permission while starting VM

Daniel H Barboza danielhb at linux.vnet.ibm.com
Mon Feb 3 17:19:26 UTC 2014


Reviewed-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>

On 02/03/2014 01:01 PM, Aline Manera wrote:
> From: Aline Manera <alinefm at br.ibm.com>
>
> libvirt needs to have read permission on cdrom files in order to start
> the virtual machine without problems.
>
> Otherwise, the user will get the following error:
>
> $ sudo virsh start aaaa
> error: Failed to start domain aaaa
> error: internal error process exited while connecting to monitor: kvm:
> -drive file=/root/Fedora-Live-Desktop-x86_64-19-1.iso: could not open disk image
> /root/Fedora-Live-Desktop-x86_64-19-1.iso: Permission denied
>
> So make sure the ISO file has read permission before starting the
> virtual machine.
>
> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
> ---
>   src/kimchi/model/vms.py |   10 +++++++++-
>   1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/src/kimchi/model/vms.py b/src/kimchi/model/vms.py
> index e9f7753..d4384a1 100644
> --- a/src/kimchi/model/vms.py
> +++ b/src/kimchi/model/vms.py
> @@ -36,7 +36,7 @@ from kimchi.model.config import CapabilitiesModel
>   from kimchi.model.templates import TemplateModel
>   from kimchi.model.utils import get_vm_name
>   from kimchi.screenshot import VMScreenshot
> -from kimchi.utils import template_name_from_uri
> +from kimchi.utils import run_setfacl_set_attr, template_name_from_uri
>
>
>   DOM_STATE_MAP = {0: 'nostate',
> @@ -346,6 +346,14 @@ class VMModel(object):
>               vnc.remove_proxy_token(name)
>
>       def start(self, name):
> +        # make sure the ISO file has read permission
> +        dom = self.get_vm(name, self.conn)
> +        xml = dom.XMLDesc(0)
> +        xpath = "/domain/devices/disk[@device='cdrom']/source/@file"
> +        isofiles = xmlutils.xpath_get_text(xml, xpath)
> +        for iso in isofiles:
> +            run_setfacl_set_attr(iso)
> +
>           dom = self.get_vm(name, self.conn)
>           dom.create()
>




More information about the Kimchi-devel mailing list