def test_clone(self): name = u'volume-00000001' volume = dict(name=name) src_pool = u'images' src_image = u'image-name' src_snap = u'snapshot-name' mock_src_client = self.mox.CreateMockAnything() mock_dst_client = self.mox.CreateMockAnything() mock_rbd = self.mox.CreateMockAnything() self.mox.StubOutWithMock(driver, 'RADOSClient') driver.RADOSClient(self.driver, src_pool).AndReturn(mock_src_client) mock_src_client.__enter__().AndReturn(mock_src_client) driver.RADOSClient(self.driver).AndReturn(mock_dst_client) mock_dst_client.__enter__().AndReturn(mock_dst_client) self.rbd.RBD_FEATURE_LAYERING = 1 self.rbd.RBD().AndReturn(mock_rbd) mock_rbd.clone(mox.IgnoreArg(), str(src_image), str(src_snap), mox.IgnoreArg(), str(name), features=self.rbd.RBD_FEATURE_LAYERING) mock_dst_client.__exit__(None, None, None).AndReturn(None) mock_src_client.__exit__(None, None, None).AndReturn(None) self.mox.ReplayAll() self.driver._clone(volume, src_pool, src_image, src_snap)