Ejemplo n.º 1
0
 def _query_snapshot(self, snapshot_name):
     request_info = {"snap_name": snapshot_name}
     request_type = "QUERY_SNAPSHOT_REQ"
     rsp_str = self._vbs_client.send_message(storhyper_utils.serialize(request_type, request_info))
     LOG.debug("%s received:%s." % (request_type, repr(rsp_str)))
     result = storhyper_utils.deserialize(six.text_type(rsp_str), delimiter="\n")
     storhyper_utils.log_dict(result)
     return result
Ejemplo n.º 2
0
 def _query_volume(self, volume_name):
     request_info = {"vol_name": volume_name}
     request_type = "QUERY_VOLUME_REQ"
     rsp_str = self._vbs_client.send_message(storhyper_utils.serialize(request_type, request_info))
     LOG.debug("%s received:%s." % (request_type, repr(rsp_str)))
     result = storhyper_utils.deserialize(six.text_type(rsp_str), delimiter="\n")
     storhyper_utils.log_dict(result)
     return result
Ejemplo n.º 3
0
 def _send_request(self, request_type, request_info, error_message):
     rsp_str = self._vbs_client.send_message(storhyper_utils.serialize(request_type, request_info))
     LOG.debug("%s received:%s." % (request_type, repr(rsp_str)))
     result = storhyper_utils.deserialize(six.text_type(rsp_str), delimiter="\n")
     storhyper_utils.log_dict(result)
     if len(result) < 0 or "retcode" not in result or result["retcode"] != "0":
         msg = _("%(err)s\n") % {"err": error_message}
         raise exception.VolumeBackendAPIException(data=msg)
     return result
Ejemplo n.º 4
0
 def _query_snapshot(self, snapshot_name):
     request_info = {'snap_name': snapshot_name}
     request_type = 'QUERY_SNAPSHOT_REQ'
     rsp_str = self._vbs_client.send_message(
         storhyper_utils.serialize(request_type, request_info))
     LOG.debug('%s received:%s.' % (request_type, repr(rsp_str)))
     result = storhyper_utils.deserialize(six.text_type(rsp_str),
                                          delimiter='\n')
     storhyper_utils.log_dict(result)
     return result
Ejemplo n.º 5
0
 def _query_volume(self, volume_name):
     request_info = {'vol_name': volume_name}
     request_type = 'QUERY_VOLUME_REQ'
     rsp_str = self._vbs_client.send_message(
         storhyper_utils.serialize(request_type, request_info))
     LOG.debug('%s received:%s.' % (request_type, repr(rsp_str)))
     result = storhyper_utils.deserialize(six.text_type(rsp_str),
                                          delimiter='\n')
     storhyper_utils.log_dict(result)
     return result
Ejemplo n.º 6
0
 def _send_request(self, request_type, request_info, error_message):
     rsp_str = self._vbs_client.send_message(
         storhyper_utils.serialize(request_type, request_info))
     LOG.debug('%s received:%s.' % (request_type, repr(rsp_str)))
     result = storhyper_utils.deserialize(six.text_type(rsp_str),
                                          delimiter='\n')
     storhyper_utils.log_dict(result)
     if (len(result) < 0 or 'retcode' not in result
             or result['retcode'] != '0'):
         msg = _('%(err)s\n') % {'err': error_message}
         raise exception.VolumeBackendAPIException(data=msg)
     return result
Ejemplo n.º 7
0
 def _send_request(self, request_type, request_info, error_message):
     rsp_str = self._vbs_client.send_message(
         storhyper_utils.serialize(request_type, request_info))
     LOG.debug('%s received:%s.' % (request_type, repr(rsp_str)))
     result = storhyper_utils.deserialize(six.text_type(rsp_str),
                                          delimiter='\n')
     storhyper_utils.log_dict(result)
     if (len(result) < 0 or 'retcode' not in result
             or result['retcode'] != '0'):
         msg = _('%(err)s\n') % {'err': error_message}
         raise exception.VolumeBackendAPIException(data=msg)
     return result
Ejemplo n.º 8
0
 def test_serialize(self):
     serialize_out = utils.serialize(self.request_type, self.request_info)
     self.assertEqual(self.serialize_out_fake, serialize_out)
Ejemplo n.º 9
0
 def test_serialize(self):
     serialize_out = utils.serialize(self.request_type,
                                     self.request_info)
     self.assertEqual(self.serialize_out_fake,
                      serialize_out)