def test_sm_backend_conf_get(self): ctxt = context.get_admin_context() params = _get_sm_backend_params() beconf = db.sm_backend_conf_create(ctxt, params) val = db.sm_backend_conf_get(ctxt, beconf['id']) self.assertDictMatch(dict(val), dict(beconf))
def test_initialize_connection(self): ctxt = context.get_admin_context() beconf = self._setup_step(ctxt) beconf = db.sm_backend_conf_get(ctxt, beconf["id"]) volume = self._create_volume() self.driver.create_volume(volume) expected = self._get_expected_conn(beconf, volume) conn = self.driver.initialize_connection(volume, "fakeConnector") res = {} for key in ["volume_id", "flavor_id", "sr_uuid", "sr_type"]: res[key] = conn["data"][key] self.assertDictMatch(expected, res) self.assertEqual(set(conn["data"]["introduce_sr_keys"]), set([u"sr_type", u"server", u"serverpath"]))
def test_initialize_connection(self): ctxt = context.get_admin_context() beconf = self._setup_step(ctxt) beconf = db.sm_backend_conf_get(ctxt, beconf['id']) volume = self._create_volume() self.driver.create_volume(volume) expected = self._get_expected_conn(beconf, volume) conn = self.driver.initialize_connection(volume, 'fakeConnector') res = {} for key in ['volume_id', 'flavor_id', 'sr_uuid', 'sr_type']: res[key] = conn['data'][key] self.assertDictMatch(expected, res) self.assertEqual(set(conn['data']['introduce_sr_keys']), set([u'sr_type', u'server', u'serverpath']))
def test_do_setup(self): ctxt = context.get_admin_context() beconf = self._setup_step(ctxt) beconf = db.sm_backend_conf_get(ctxt, beconf['id']) self.assertIsInstance(beconf['sr_uuid'], basestring)