'Makes REST API call to query the vpool by name and type.
This function will take the VPOOL name and type of VPOOL
as input and get uri of the first occurrence of given VPOOL.
:param name: Name of the VPOOL
:param vpooltype: Type of the VPOOL {\'block\'}
:returns: uri of the given vpool'

def vpool_query(self, name, vpooltype):

    if common.is_uri(name):
        return name
    (s, h) = common.service_json_request(self.ipaddr, self.port, 'GET', self.URI_VPOOL_SEARCH.format(vpooltype, name), None)
    o = common.json_decode(s)
    if (len(o['resource']) > 0):
        for vpool in o['resource']:
            if (self.vpool_show_uri(vpooltype, vpool['id']) is not None):
                return vpool['id']
    raise common.CoprHdError(common.CoprHdError.NOT_FOUND_ERR, (_('VPool    %(name)s    (    %(vpooltype)s    )    :    not    found') % {'name': name, 'vpooltype': vpooltype}))
