summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.zuul.yaml20
-rw-r--r--doc/source/cli/command-objects/volume-snapshot.rst2
-rw-r--r--lower-constraints.txt2
-rw-r--r--openstackclient/network/v2/network_segment_range.py3
-rw-r--r--openstackclient/network/v2/security_group.py4
-rw-r--r--openstackclient/tests/functional/volume/v2/test_volume_snapshot.py18
-rw-r--r--openstackclient/tests/unit/network/v2/test_network_segment_range.py14
-rw-r--r--openstackclient/tests/unit/network/v2/test_security_group_network.py17
-rw-r--r--openstackclient/tests/unit/network/v2/test_subnet.py38
-rw-r--r--openstackclient/volume/client.py4
-rw-r--r--openstackclient/volume/v1/volume_snapshot.py4
-rw-r--r--openstackclient/volume/v2/consistency_group_snapshot.py2
-rw-r--r--openstackclient/volume/v2/volume_snapshot.py6
-rw-r--r--releasenotes/notes/bug-1784879-9b632174d4af853f.yaml8
14 files changed, 116 insertions, 26 deletions
diff --git a/.zuul.yaml b/.zuul.yaml
index 3e8478d6..7a7e264c 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -157,16 +157,16 @@
data:
username: osclientzuul
password: !encrypted/pkcs1-oaep
- - n764ECFMGlEna6S5ezNyvW5nmq8IZCBts/7QRzdo2tWLQMp/mNFoaQensd797Ra3NLaS7
- NzCFJwGQvgWF6hJJIUfnf3h2+RecCwHahLN4r95RtjhAltARzHSZVDCeNXhiRJqSDS4Qc
- kmXR2NTNfz8kkWUhnWNVjaBhYdMk0LnqZjQCxiCaR+eNdmeecWlSuJXg0Uz6vObLNfGHO
- KxV3RiGc4J0AATYpYFEpC/SyPbBk0pJv6JWJb7nNIe0CEVW/7hkCfA6o3hQ5PNAswn5ZP
- sp/L8NdoRQe/fEWOm/9K2lZqQehEj6SKsk6jkx3Wiy5stqFcGfafrxWcfQoQWpKHY5TeP
- R9U0jJy+ipnhfnm0flBIBt9XHYykrTuFwp5QVdRhRRQDwg5RZBX+VmaBeSQlS2Z0oJmCX
- PXFQmUDfnoU5go0BALlXDdy1sYE+SrQH4Eydw+hgf2oDFh+EkdhXMFburxnU8B7t4ey14
- EM1W4BdOBUgeI4fa/92BP6ipgUFvcJu19FYTdg4v7NZ/ApnwZnZ5KC4eYlDaKNQiPQUmW
- pFJrnxxYXeDgmiXij8mCCgo8KEGvPCKHAghZ14iBCaWqvniLXuOSkFI1gYU+llg4i2jAp
- ts3GfQqBe8jfROGPMexVuonqZxZBxvWmIgDsAaqAeJCtykS1xeIiAMtA8rNl40=
+ - LbIZjJiVstRVXMpoLQ3+/JcNB6lKVUWJXXo5+Outf+PKAaO7mNnv8XLiFMKnJ6ftopLyu
+ hWbX9rA+NddvplLQkf1xxkh7QBBU8PToLr58quI2SENUclt4tpjxbZfZu451kFSNJvNvR
+ E58cHHpfJZpyRnS2htXmN/Qy24gbV2w7CQxSZD2YhlcrerD8uQ8rWEnlY1wcJEaEGomtS
+ ZTGxsdK2TsZC2cd4b7TG7+xbl2i+hjADzwSQAgUzlLlwuG71667+IWk4SOZ7OycJTv9NN
+ ZTak8+CGfiMKdmsxZ1Z8uD7DC+RIklDjMWyly6zuhWzfhOmsmU0CesR50moodRUvbK79p
+ NZM8u0hBex5cl2EpUEwJL/FSPJXUhDMPoMoTZT/SAuXf25R9eZ9JGrKsIAlmVhpl8ifoE
+ 8TpPyvIHGS3YelTQjhqOX0wGb9T4ZauQCcI5Ajzy9NuCTyD9xxme9OX1zz7gMACRnVHvz
+ q7U7Ue90MnmGH6E2SgKjIZhyzy9Efwb7JUvH1Zb3hlrjCjEhwi9MV5FnABTEeXyYwE10s
+ 3o/KZg2zvdWkVG6x0dEkjpoQaNuaB7T2Na7Sm421n/z3LCzhiQGuTUjENnL6cMEtuA6Pp
+ BfI5+Qlg7HMwkBXNB73EPfWHzbCR3VNrzGYTy9FvhGud0/cXsuBXgps4WH63ic=
- job:
name: osc-build-image
diff --git a/doc/source/cli/command-objects/volume-snapshot.rst b/doc/source/cli/command-objects/volume-snapshot.rst
index 30cc77cc..21a89370 100644
--- a/doc/source/cli/command-objects/volume-snapshot.rst
+++ b/doc/source/cli/command-objects/volume-snapshot.rst
@@ -115,7 +115,7 @@ List volume snapshots
.. option:: --status <status>
Filters results by a status.
- ('available', 'error', 'creating', 'deleting' or 'error-deleting')
+ ('available', 'error', 'creating', 'deleting' or 'error_deleting')
.. option:: --name <name>
diff --git a/lower-constraints.txt b/lower-constraints.txt
index 1754ed77..1fa30674 100644
--- a/lower-constraints.txt
+++ b/lower-constraints.txt
@@ -41,7 +41,7 @@ jsonschema==2.6.0
keystoneauth1==3.16.0
kombu==4.0.0
linecache2==1.0.0
-MarkupSafe==1.0
+MarkupSafe==1.1.0
mccabe==0.2.1
mock==2.0.0
monotonic==0.6
diff --git a/openstackclient/network/v2/network_segment_range.py b/openstackclient/network/v2/network_segment_range.py
index 2cdae642..b38c72c2 100644
--- a/openstackclient/network/v2/network_segment_range.py
+++ b/openstackclient/network/v2/network_segment_range.py
@@ -23,7 +23,6 @@ from osc_lib.cli import format_columns
from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
-import six
from openstackclient.i18n import _
from openstackclient.identity import common as identity_common
@@ -42,7 +41,7 @@ def _get_columns(item):
def _get_ranges(item):
- item = [int(i) if isinstance(i, six.string_types) else i for i in item]
+ item = sorted([int(i) for i in item])
for a, b in itertools.groupby(enumerate(item), lambda xy: xy[1] - xy[0]):
b = list(b)
yield "%s-%s" % (b[0][1], b[-1][1]) if b[0][1] != b[-1][1] else \
diff --git a/openstackclient/network/v2/security_group.py b/openstackclient/network/v2/security_group.py
index f8153fa8..2033af14 100644
--- a/openstackclient/network/v2/security_group.py
+++ b/openstackclient/network/v2/security_group.py
@@ -202,6 +202,7 @@ class DeleteSecurityGroup(common.NetworkAndComputeDelete):
# the OSC minimum requirements include SDK 1.0.
class ListSecurityGroup(common.NetworkAndComputeLister):
_description = _("List security groups")
+ FIELDS_TO_RETRIEVE = ['id', 'name', 'description', 'project_id', 'tags']
def update_parser_network(self, parser):
if not self.is_docs_build:
@@ -251,7 +252,8 @@ class ListSecurityGroup(common.NetworkAndComputeLister):
filters['project_id'] = project_id
_tag.get_tag_filtering_args(parsed_args, filters)
- data = client.security_groups(**filters)
+ data = client.security_groups(fields=self.FIELDS_TO_RETRIEVE,
+ **filters)
columns = (
"ID",
diff --git a/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py b/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py
index 8d32d997..4977a73e 100644
--- a/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py
+++ b/openstackclient/tests/functional/volume/v2/test_volume_snapshot.py
@@ -121,6 +121,24 @@ class VolumeSnapshotTests(common.BaseVolumeTests):
cmd_output["size"],
)
self.wait_for_status('volume snapshot', name2, 'available')
+
+ raw_output = self.openstack(
+ 'volume snapshot set ' +
+ '--state error_deleting ' +
+ name2
+ )
+ self.assertOutput('', raw_output)
+
+ # Test list --long, --status
+ cmd_output = json.loads(self.openstack(
+ 'volume snapshot list -f json ' +
+ '--long ' +
+ '--status error_deleting'
+ ))
+ names = [x["Name"] for x in cmd_output]
+ self.assertNotIn(name1, names)
+ self.assertIn(name2, names)
+
raw_output = self.openstack(
'volume snapshot set ' +
'--state error ' +
diff --git a/openstackclient/tests/unit/network/v2/test_network_segment_range.py b/openstackclient/tests/unit/network/v2/test_network_segment_range.py
index 89a0c223..b60f1710 100644
--- a/openstackclient/tests/unit/network/v2/test_network_segment_range.py
+++ b/openstackclient/tests/unit/network/v2/test_network_segment_range.py
@@ -24,6 +24,20 @@ from openstackclient.tests.unit.network.v2 import fakes as network_fakes
from openstackclient.tests.unit import utils as tests_utils
+class TestAuxiliaryFunctions(tests_utils.TestCase):
+
+ def test__get_ranges(self):
+ input_reference = [
+ ([1, 2, 3, 4, 5, 6, 7], ['1-7']),
+ ([1, 2, 5, 4, 3, 6, 7], ['1-7']),
+ ([1, 2, 4, 3, 7, 6], ['1-4', '6-7']),
+ ([1, 2, 4, 3, '13', 12, '7', '6'], ['1-4', '6-7', '12-13'])
+ ]
+ for input, reference in input_reference:
+ self.assertEqual(reference,
+ list(network_segment_range._get_ranges(input)))
+
+
class TestNetworkSegmentRange(network_fakes.TestNetworkV2):
def setUp(self):
diff --git a/openstackclient/tests/unit/network/v2/test_security_group_network.py b/openstackclient/tests/unit/network/v2/test_security_group_network.py
index 14d57514..67908fa8 100644
--- a/openstackclient/tests/unit/network/v2/test_security_group_network.py
+++ b/openstackclient/tests/unit/network/v2/test_security_group_network.py
@@ -285,7 +285,8 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
columns, data = self.cmd.take_action(parsed_args)
- self.network.security_groups.assert_called_once_with()
+ self.network.security_groups.assert_called_once_with(
+ fields=security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
@@ -300,7 +301,8 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
columns, data = self.cmd.take_action(parsed_args)
- self.network.security_groups.assert_called_once_with()
+ self.network.security_groups.assert_called_once_with(
+ fields=security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE)
self.assertEqual(self.columns, columns)
self.assertListItemEqual(self.data, list(data))
@@ -316,7 +318,9 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
- filters = {'tenant_id': project.id, 'project_id': project.id}
+ filters = {
+ 'tenant_id': project.id, 'project_id': project.id,
+ 'fields': security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE}
self.network.security_groups.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
@@ -336,7 +340,9 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
columns, data = self.cmd.take_action(parsed_args)
- filters = {'tenant_id': project.id, 'project_id': project.id}
+ filters = {
+ 'tenant_id': project.id, 'project_id': project.id,
+ 'fields': security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE}
self.network.security_groups.assert_called_once_with(**filters)
self.assertEqual(self.columns, columns)
@@ -362,7 +368,8 @@ class TestListSecurityGroupNetwork(TestSecurityGroupNetwork):
**{'tags': 'red,blue',
'any_tags': 'red,green',
'not_tags': 'orange,yellow',
- 'not_any_tags': 'black,white'}
+ 'not_any_tags': 'black,white',
+ 'fields': security_group.ListSecurityGroup.FIELDS_TO_RETRIEVE}
)
self.assertEqual(self.columns, columns)
self.assertEqual(self.data, list(data))
diff --git a/openstackclient/tests/unit/network/v2/test_subnet.py b/openstackclient/tests/unit/network/v2/test_subnet.py
index e71e1dd6..47d0c6b4 100644
--- a/openstackclient/tests/unit/network/v2/test_subnet.py
+++ b/openstackclient/tests/unit/network/v2/test_subnet.py
@@ -460,6 +460,44 @@ class TestCreateSubnet(TestSubnet):
self.assertEqual(self.columns, columns)
self.assertItemEqual(self.data, data)
+ def _test_create_with_dns(self, publish_dns=True):
+ arglist = [
+ "--subnet-range", self._subnet.cidr,
+ "--network", self._subnet.network_id,
+ self._subnet.name,
+ ]
+ if publish_dns:
+ arglist += ['--dns-publish-fixed-ip']
+ else:
+ arglist += ['--no-dns-publish-fixed-ip']
+ verifylist = [
+ ('name', self._subnet.name),
+ ('subnet_range', self._subnet.cidr),
+ ('network', self._subnet.network_id),
+ ('ip_version', self._subnet.ip_version),
+ ('gateway', 'auto'),
+ ]
+ verifylist.append(('dns_publish_fixed_ip', publish_dns))
+
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+ columns, data = (self.cmd.take_action(parsed_args))
+
+ self.network.create_subnet.assert_called_once_with(
+ cidr=self._subnet.cidr,
+ ip_version=self._subnet.ip_version,
+ name=self._subnet.name,
+ network_id=self._subnet.network_id,
+ dns_publish_fixed_ip=publish_dns,
+ )
+ self.assertEqual(self.columns, columns)
+ self.assertItemEqual(self.data, data)
+
+ def test_create_with_dns(self):
+ self._test_create_with_dns(publish_dns=True)
+
+ def test_create_with_no_dns(self):
+ self._test_create_with_dns(publish_dns=False)
+
def _test_create_with_tag(self, add_tags=True):
arglist = [
"--subnet-range", self._subnet.cidr,
diff --git a/openstackclient/volume/client.py b/openstackclient/volume/client.py
index fdd1794b..1fbfaaee 100644
--- a/openstackclient/volume/client.py
+++ b/openstackclient/volume/client.py
@@ -67,11 +67,15 @@ def make_client(instance):
# Remember interface only if it is set
kwargs = utils.build_kwargs_dict('endpoint_type', instance.interface)
+ endpoint_override = instance.sdk_connection.config.get_endpoint(
+ 'block-storage')
+
client = volume_client(
session=instance.session,
extensions=extensions,
http_log_debug=http_log_debug,
region_name=instance.region_name,
+ endpoint_override=endpoint_override,
**kwargs
)
diff --git a/openstackclient/volume/v1/volume_snapshot.py b/openstackclient/volume/v1/volume_snapshot.py
index 966db48f..2d1f0359 100644
--- a/openstackclient/volume/v1/volume_snapshot.py
+++ b/openstackclient/volume/v1/volume_snapshot.py
@@ -174,10 +174,10 @@ class ListVolumeSnapshot(command.Lister):
'--status',
metavar='<status>',
choices=['available', 'error', 'creating', 'deleting',
- 'error-deleting'],
+ 'error_deleting'],
help=_("Filters results by a status. "
"('available', 'error', 'creating', 'deleting'"
- " or 'error-deleting')")
+ " or 'error_deleting')")
)
parser.add_argument(
'--volume',
diff --git a/openstackclient/volume/v2/consistency_group_snapshot.py b/openstackclient/volume/v2/consistency_group_snapshot.py
index 3df66e69..7d5ba82f 100644
--- a/openstackclient/volume/v2/consistency_group_snapshot.py
+++ b/openstackclient/volume/v2/consistency_group_snapshot.py
@@ -128,7 +128,7 @@ class ListConsistencyGroupSnapshot(command.Lister):
'--status',
metavar="<status>",
choices=['available', 'error', 'creating', 'deleting',
- 'error-deleting'],
+ 'error_deleting'],
help=_('Filters results by a status ("available", "error", '
'"creating", "deleting" or "error_deleting")')
)
diff --git a/openstackclient/volume/v2/volume_snapshot.py b/openstackclient/volume/v2/volume_snapshot.py
index edacf683..656f59d4 100644
--- a/openstackclient/volume/v2/volume_snapshot.py
+++ b/openstackclient/volume/v2/volume_snapshot.py
@@ -229,10 +229,10 @@ class ListVolumeSnapshot(command.Lister):
'--status',
metavar='<status>',
choices=['available', 'error', 'creating', 'deleting',
- 'error-deleting'],
+ 'error_deleting'],
help=_("Filters results by a status. "
"('available', 'error', 'creating', 'deleting'"
- " or 'error-deleting')")
+ " or 'error_deleting')")
)
parser.add_argument(
'--volume',
@@ -344,7 +344,7 @@ class SetVolumeSnapshot(command.Command):
'--state',
metavar='<state>',
choices=['available', 'error', 'creating', 'deleting',
- 'error-deleting'],
+ 'error_deleting'],
help=_('New snapshot state. ("available", "error", "creating", '
'"deleting", or "error_deleting") (admin only) '
'(This option simply changes the state of the snapshot '
diff --git a/releasenotes/notes/bug-1784879-9b632174d4af853f.yaml b/releasenotes/notes/bug-1784879-9b632174d4af853f.yaml
new file mode 100644
index 00000000..67085731
--- /dev/null
+++ b/releasenotes/notes/bug-1784879-9b632174d4af853f.yaml
@@ -0,0 +1,8 @@
+---
+features:
+ - |
+ Add ``--dns-publish-fixed-ip`` and ``--no-dns-publish-fixed-ip``
+ options to ``create subnet`` and ``set subnet`` commands to
+ control the publishing of fixed IPs in DNS when the
+ ``subnet_dns_publish_fixed_ip`` Neutron extension is enabled.
+ [Bug `1784879 <https://bugs.launchpad.net/neutron/+bug/1784879>`_]