Skip to content

Commit 27392a0

Browse files
authored
Merge pull request #89 from stackhpc/upstream/2023.1-2026-01-16
Synchronise 2023.1 with upstream
2 parents 1509004 + c64bd19 commit 27392a0

File tree

60 files changed

+1582
-517
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1582
-517
lines changed

.gitreview

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
host=review.opendev.org
33
port=29418
44
project=openstack/cinder.git
5-
defaultbranch=stable/2023.1
5+
defaultbranch=unmaintained/2023.1

.zuul.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
irrelevant-files: *gate-irrelevant-files
5959
- cinder-tempest-plugin-lvm-lio-barbican:
6060
irrelevant-files: *gate-irrelevant-files
61+
- cinder-tempest-plugin-lvm-lio-barbican-fips:
62+
voting: false
63+
irrelevant-files: *gate-irrelevant-files
6164
- cinder-grenade-mn-sub-volbak:
6265
irrelevant-files: *gate-irrelevant-files
6366
- cinder-tempest-lvm-multibackend:
@@ -68,6 +71,9 @@
6871
irrelevant-files: *gate-irrelevant-files
6972
- devstack-plugin-nfs-tempest-full:
7073
irrelevant-files: *gate-irrelevant-files
74+
- devstack-plugin-nfs-tempest-full-fips:
75+
voting: false
76+
irrelevant-files: *gate-irrelevant-files
7177
- tempest-slow-py3:
7278
irrelevant-files: *gate-irrelevant-files
7379
- tempest-integrated-storage:
@@ -174,6 +180,17 @@
174180
volume_revert: True
175181
volume_image_dep_tests: False
176182

183+
- job:
184+
# this depends on some ceph admin setup which is not yet complete
185+
# TODO(alee) enable this test when ceph admin work is complete.
186+
name: cinder-plugin-ceph-tempest-fips
187+
parent: cinder-plugin-ceph-tempest
188+
nodeset: devstack-single-node-centos-9-stream
189+
pre-run: playbooks/enable-fips.yaml
190+
vars:
191+
configure_swap_size: 4096
192+
nslookup_target: 'opendev.org'
193+
177194
- job:
178195
name: cinder-plugin-ceph-tempest-mn-aa
179196
parent: devstack-plugin-ceph-multinode-tempest-py3

bindep.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ postgresql
2929
postgresql-client [platform:dpkg]
3030
postgresql-devel [platform:rpm]
3131
postgresql-server [platform:rpm]
32+
python3-devel [platform:rpm test]
3233
libpq-dev [platform:dpkg]
3334
thin-provisioning-tools [platform:debian]
3435
libxml2-dev [platform:dpkg test]

cinder/api/schemas/volume_image_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
'os-set_image_metadata': {
2828
'type': 'object',
2929
'properties': {
30-
'metadata': parameter_types.extra_specs,
30+
'metadata': parameter_types.image_metadata,
3131
},
3232
'required': ['metadata'],
3333
'additionalProperties': False,

cinder/api/v3/router.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -210,22 +210,28 @@ def _setup_routes(self, mapper, ext_mgr):
210210
member={'accept': 'POST'})
211211

212212
self.resources['default_types'] = default_types.create_resource()
213-
mapper.connect("default-types", "/default-types/{id}",
214-
controller=self.resources['default_types'],
215-
action='create_update',
216-
conditions={"method": ['PUT']})
217-
218-
mapper.connect("default-types", "/default-types",
219-
controller=self.resources['default_types'],
220-
action='index',
221-
conditions={"method": ['GET']})
222-
223-
mapper.connect("default-types", "/default-types/{id}",
224-
controller=self.resources['default_types'],
225-
action='detail',
226-
conditions={"method": ['GET']})
227-
228-
mapper.connect("default-types", "/default-types/{id}",
229-
controller=self.resources['default_types'],
230-
action='delete',
231-
conditions={"method": ['DELETE']})
213+
for path_prefix in ['/{project_id}', '']:
214+
# project_id is optional
215+
mapper.connect(
216+
"default-types", "%s/default-types/{id}" % path_prefix,
217+
controller=self.resources['default_types'],
218+
action='create_update',
219+
conditions={"method": ['PUT']})
220+
221+
mapper.connect(
222+
"default-types", "%s/default-types" % path_prefix,
223+
controller=self.resources['default_types'],
224+
action='index',
225+
conditions={"method": ['GET']})
226+
227+
mapper.connect(
228+
"default-types", "%s/default-types/{id}" % path_prefix,
229+
controller=self.resources['default_types'],
230+
action='detail',
231+
conditions={"method": ['GET']})
232+
233+
mapper.connect(
234+
"default-types", "%s/default-types/{id}" % path_prefix,
235+
controller=self.resources['default_types'],
236+
action='delete',
237+
conditions={"method": ['DELETE']})

cinder/api/validation/parameter_types.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ def valid_char(char):
157157
'additionalProperties': False
158158
}
159159

160+
image_metadata = {
161+
'type': 'object',
162+
'patternProperties': {
163+
'^[a-zA-Z0-9-_:. /]{1,255}$': {
164+
'type': 'string', 'format': 'mysql_text'
165+
}
166+
},
167+
'additionalProperties': False
168+
}
160169

161170
extra_specs_with_no_spaces_key = {
162171
'type': 'object',

cinder/api/validation/validators.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,14 @@ def _validate_key_size(param_value):
398398
return True
399399

400400

401+
@jsonschema.FormatChecker.cls_checks('mysql_text')
402+
def _validate_mysql_text(param_value):
403+
length = len(param_value.encode('utf8'))
404+
if length > 65535:
405+
return False
406+
return True
407+
408+
401409
class FormatChecker(jsonschema.FormatChecker):
402410
"""A FormatChecker can output the message from cause exception
403411

cinder/backup/drivers/ceph.py

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import os
4848
import re
4949
import subprocess
50+
import tempfile
5051
import time
5152
from typing import Dict, List, Optional, Tuple # noqa: H301
5253

@@ -618,33 +619,40 @@ def _piped_execute(self, cmd1: list, cmd2: list) -> Tuple[int, bytes]:
618619
LOG.debug("Piping cmd1='%s' into...", ' '.join(cmd1))
619620
LOG.debug("cmd2='%s'", ' '.join(cmd2))
620621

621-
try:
622-
p1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE,
623-
stderr=subprocess.PIPE,
624-
close_fds=True)
625-
except OSError as e:
626-
LOG.error("Pipe1 failed - %s ", e)
627-
raise
622+
with tempfile.TemporaryFile() as errfile:
628623

629-
# NOTE(dosaboy): ensure that the pipe is blocking. This is to work
630-
# around the case where evenlet.green.subprocess is used which seems to
631-
# use a non-blocking pipe.
632-
assert p1.stdout is not None
633-
flags = fcntl.fcntl(p1.stdout, fcntl.F_GETFL) & (~os.O_NONBLOCK)
634-
fcntl.fcntl(p1.stdout, fcntl.F_SETFL, flags)
635-
636-
try:
637-
p2 = subprocess.Popen(cmd2, stdin=p1.stdout,
638-
stdout=subprocess.PIPE,
639-
stderr=subprocess.PIPE,
640-
close_fds=True)
641-
except OSError as e:
642-
LOG.error("Pipe2 failed - %s ", e)
643-
raise
624+
try:
625+
p1 = subprocess.Popen(cmd1, stdout=subprocess.PIPE,
626+
stderr=errfile,
627+
close_fds=True)
628+
except OSError as e:
629+
LOG.error("Pipe1 failed - %s ", e)
630+
raise
631+
632+
# NOTE(dosaboy): ensure that the pipe is blocking. This is to work
633+
# around the case where evenlet.green.subprocess is used which
634+
# seems to use a non-blocking pipe.
635+
assert p1.stdout is not None
636+
flags = fcntl.fcntl(p1.stdout, fcntl.F_GETFL) & (~os.O_NONBLOCK)
637+
fcntl.fcntl(p1.stdout, fcntl.F_SETFL, flags)
644638

645-
p1.stdout.close()
646-
stdout, stderr = p2.communicate()
647-
return p2.returncode, stderr
639+
try:
640+
p2 = subprocess.Popen(cmd2, stdin=p1.stdout,
641+
stdout=subprocess.PIPE,
642+
stderr=errfile,
643+
close_fds=True)
644+
except OSError as e:
645+
LOG.error("Pipe2 failed - %s ", e)
646+
raise
647+
648+
p1.stdout.close()
649+
p2.communicate()
650+
p1.wait()
651+
652+
errfile.seek(0)
653+
px_stderr = errfile.read()
654+
655+
return p1.returncode or p2.returncode, px_stderr
648656

649657
def _rbd_diff_transfer(self, src_name: str, src_pool: str,
650658
dest_name: str, dest_pool: str,

cinder/backup/drivers/swift.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ def _headers(self, headers=None):
192192

193193
sa_plugin = service_auth.get_service_auth_plugin()
194194
if sa_plugin is not None:
195-
result['X-Service-Token'] = sa_plugin.get_token()
195+
sa_session = service_auth.get_service_session()
196+
result['X-Service-Token'] = sa_plugin.get_token(session=sa_session)
196197

197198
return result
198199

cinder/cmd/manage.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,16 @@ def update_host(self, currenthost: str, newhost: str) -> None:
645645
db.volume_update(ctxt, v['id'],
646646
{'host': newhost})
647647

648+
def update_service(self):
649+
"""Modify the service uuid associated with a volume.
650+
651+
In certain upgrade cases, we create new cinder services and delete the
652+
records of old ones, however, the volumes created with old service
653+
still contain the service uuid of the old services.
654+
"""
655+
ctxt = context.get_admin_context()
656+
db.volume_update_all_by_service(ctxt)
657+
648658

649659
class ConfigCommands(object):
650660
"""Class for exposing the flags defined by flag_file(s)."""

0 commit comments

Comments
 (0)