volume: Migrate 'volume list' to compute SDK
Change-Id: Iae662aa6b391ba6ae5f569184c7d19fb3654be35 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
9f30ee9af2
commit
55cbb84e60
@ -378,7 +378,6 @@ class ListVolume(command.Lister):
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
volume_client = self.app.client_manager.volume
|
||||
compute_client = self.app.client_manager.compute
|
||||
|
||||
if parsed_args.long:
|
||||
columns = (
|
||||
@ -420,7 +419,8 @@ class ListVolume(command.Lister):
|
||||
# Cache the server list
|
||||
server_cache = {}
|
||||
try:
|
||||
for s in compute_client.servers.list():
|
||||
compute_client = self.app.client_manager.sdk_connection.compute
|
||||
for s in compute_client.servers():
|
||||
server_cache[s.id] = s
|
||||
except Exception:
|
||||
# Just forget it if there's any trouble
|
||||
|
@ -20,6 +20,7 @@ import functools
|
||||
import logging
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from openstack import exceptions as sdk_exceptions
|
||||
from osc_lib.cli import format_columns
|
||||
from osc_lib.cli import parseractions
|
||||
from osc_lib.command import command
|
||||
@ -507,10 +508,10 @@ class ListVolume(command.Lister):
|
||||
server_cache = {}
|
||||
if do_server_list:
|
||||
try:
|
||||
compute_client = self.app.client_manager.compute
|
||||
for s in compute_client.servers.list():
|
||||
compute_client = self.app.client_manager.sdk_connection.compute
|
||||
for s in compute_client.servers():
|
||||
server_cache[s.id] = s
|
||||
except Exception:
|
||||
except sdk_exceptions.SDKException:
|
||||
# Just forget it if there's any trouble
|
||||
pass # nosec: B110
|
||||
AttachmentsColumnWithCache = functools.partial(
|
||||
|
@ -20,6 +20,7 @@ import functools
|
||||
import logging
|
||||
|
||||
from cliff import columns as cliff_columns
|
||||
from openstack import exceptions as sdk_exceptions
|
||||
from openstack import utils as sdk_utils
|
||||
from osc_lib.cli import format_columns
|
||||
from osc_lib.cli import parseractions
|
||||
@ -522,10 +523,10 @@ class ListVolume(command.Lister):
|
||||
server_cache = {}
|
||||
if do_server_list:
|
||||
try:
|
||||
compute_client = self.app.client_manager.compute
|
||||
for s in compute_client.servers.list():
|
||||
compute_client = self.app.client_manager.sdk_connection.compute
|
||||
for s in compute_client.servers():
|
||||
server_cache[s.id] = s
|
||||
except Exception:
|
||||
except sdk_exceptions.SDKException:
|
||||
# Just forget it if there's any trouble
|
||||
pass # nosec: B110
|
||||
AttachmentsColumnWithCache = functools.partial(
|
||||
|
Loading…
x
Reference in New Issue
Block a user