def detach_volume(self, volume, ex_node=None):
        """
        Detach a volume to a node.

        :param volume: The ID of the volume
        :type volume: :class:`StorageVolume`

        :param ex_node: Node to detach from (optionnal if volume is attached
                        to only one node)
        :type ex_node: :class:`Node`

        :return: True or False representing operation successful
        :rtype:   ``bool``

        :raises: Exception: If ``ex_node`` is not provided and more than one
                            node is attached to the volume
        """
        action = '%s/volume/%s/detach' % (API_ROOT, volume.id)
        if ex_node is None:
            if len(volume.extra['attachedTo']) != 1:
                err_msg = "Volume '%s' has more or less than one attached \
                    nodes, you must specify one."
                raise Exception(err_msg)
            ex_node = self.ex_get_node(volume.extra['attachedTo'][0])
        data = {'instanceId': ex_node.id}
        self.connection.request(action, data=data, method='POST')
        return True
dataset/ETHPy150Open apache/libcloud/libcloud/compute/drivers/runabove.py/RunAboveNodeDriver.detach_volume/original