def test_delete_snapshot_if_busy(self): drv = self._driver client = drv._client share_id = "fakeshareid" share = {"id": share_id, "size": 1} snapshot = {"id": "fakesnapshotid", "size": 1, "share_id": share_id} max_aggr_id = 123 drv._share_table[share_id] = max_aggr_id client.send_request_to(max_aggr_id, "snapshot-list-info", IgnoreArg(), do_response_check=False).AndReturn( FakeSnapshots(netapp._get_valid_snapshot_name(snapshot["id"]), is_busy="true") ) self.mox.ReplayAll() self.assertRaises(exception.ShareSnapshotIsBusy, drv.delete_snapshot, self._context, snapshot)
def test_delete_snapshot(self): drv = self._driver client = drv._client share_id = "fakeshareid" share = {"id": share_id, "size": 1} snapshot = {"id": "fakesnapshotid", "size": 1, "share_id": share_id} max_aggr_id = 123 drv._share_table[share_id] = max_aggr_id client.send_request_to(max_aggr_id, "snapshot-list-info", IgnoreArg(), do_response_check=False).AndReturn( FakeSnapshots(netapp._get_valid_snapshot_name(snapshot["id"])) ) client.send_request_to(max_aggr_id, "snapshot-delete", IgnoreArg()) self.mox.ReplayAll() drv.delete_snapshot(self._context, snapshot)