Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid cinder calls, when cinder is unavailable
When a volume service is not available, then a cinder client can not be created. This patch skips the calls, so that dashboard doesn't break any more. This is a backport to Folsom release, as this turned out to be a major issue. Fixes bug 1084137 Change-Id: I8f2f8b0b131b4bb5319d74f6da48671f146d7e00
- Loading branch information
Showing
5 changed files
with
101 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# vim: tabstop=4 shiftwidth=4 softtabstop=4 | ||
|
||
# Copyright 2012 Red Hat, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
# not use this file except in compliance with the License. You may obtain | ||
# a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations | ||
# under the License. | ||
|
||
|
||
from horizon import api | ||
from horizon import test | ||
|
||
|
||
class CinderApiTests(test.APITestCase): | ||
def test_volume_list(self): | ||
search_opts = {'all_tenants': 1} | ||
volumes = self.volumes.list() | ||
cinderclient = self.stub_cinderclient() | ||
cinderclient.volumes = self.mox.CreateMockAnything() | ||
cinderclient.volumes.list(search_opts=search_opts,).AndReturn(volumes) | ||
self.mox.ReplayAll() | ||
|
||
# No assertions are necessary. Verification is handled by mox. | ||
api.nova.volume_list(self.request, search_opts=search_opts) | ||
|
||
def test_volume_snapshot_list(self): | ||
volume_snapshots = self.volume_snapshots.list() | ||
cinderclient = self.stub_cinderclient() | ||
cinderclient.volume_snapshots = self.mox.CreateMockAnything() | ||
cinderclient.volume_snapshots.list().AndReturn(volume_snapshots) | ||
self.mox.ReplayAll() | ||
|
||
api.nova.volume_snapshot_list(self.request) | ||
|
||
def test_volume_snapshot_list_no_volume_configured(self): | ||
# remove volume from service catalog | ||
catalog = self.service_catalog | ||
for service in catalog: | ||
if service["type"] == "volume": | ||
self.service_catalog.remove(service) | ||
volume_snapshots = self.volume_snapshots.list() | ||
|
||
cinderclient = self.stub_cinderclient() | ||
cinderclient.volume_snapshots = self.mox.CreateMockAnything() | ||
cinderclient.volume_snapshots.list().AndReturn(volume_snapshots) | ||
self.mox.ReplayAll() | ||
|
||
api.nova.volume_snapshot_list(self.request) |