def setup_os_root(self, root):
        LOG.debug("Inspecting guest OS root filesystem %s", root)
        mounts = self.handle.inspect_get_mountpoints(root)

        if len(mounts) == 0:
            raise exception.NovaException(
                _("No mount points found in %(root)s of %(image)s") %
                {'root': root, 'image': self.image})

        # the root directory must be mounted first
        mounts.sort(key=lambda mount: mount[0])

        root_mounted = False
        for mount in mounts:
            LOG.debug("Mounting %(dev)s at %(dir)s",
                      {'dev': mount[1], 'dir': mount[0]})
            try:
                self.handle.mount_options("", mount[1], mount[0])
                root_mounted = True
            except __HOLE__ as e:
                msg = _("Error mounting %(device)s to %(dir)s in image"
                        " %(image)s with libguestfs (%(e)s)") % \
                      {'image': self.image, 'device': mount[1],
                       'dir': mount[0], 'e': e}
                if root_mounted:
                    LOG.debug(msg)
                else:
                    raise exception.NovaException(msg)
dataset/ETHPy150Open openstack/nova/nova/virt/disk/vfs/guestfs.py/VFSGuestFS.setup_os_root