Skip to content

Commit ba172c2

Browse files
author
guido tijskens
committed
oci-utils 0.14.0-2
1 parent b4cdd55 commit ba172c2

File tree

18 files changed

+641
-135
lines changed

18 files changed

+641
-135
lines changed

bin/oci-kvm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
_PY3=/usr/bin/python3
13-
_PY_CMD=oci_kvm_main
13+
_PY_CMD=oci_kvm_main.py
1414
s_dir=`${_PY3} -c 'import os.path ; import oci_utils.impl ; print (os.path.dirname(oci_utils.impl.__file__))' 2>/dev/null`
1515

1616

buildrpm/oci-utils.spec

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Name: oci-utils
22
Version: 0.14.0
3-
Release: 1%{?dist}
3+
Release: 2%{?dist}
44
Url: http://cloud.oracle.com/iaas
55
Summary: Oracle Cloud Infrastructure utilities
66
License: UPL
@@ -206,6 +206,9 @@ rm -rf %{buildroot}
206206
/opt/oci-utils/tests/__init__*
207207

208208
%changelog
209+
* Mon Sep 5 2022 Guido Tijskens <[email protected]> -- 0.14.0-2
210+
- LINUX-12761/OLUEK-6199 ocid leaves lots of connections in CLOSE_WAIT state
211+
209212
* Thu Aug 11 2022 Guido Tijskens <[email protected]> -- 0.14.0-1
210213
- LINUX-12027: oci-image-migrate on ol7 unable to mount ol9 xfs filesystem
211214

lib/oci_utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
'kix': 'kix - ap-osaka-1 (Osaka, Japan)',
4242
'lhr': 'lhr - uk-london-1 (London, UK)',
4343
'lin': 'lin - eu-milan-1 (Milan, Italy)',
44+
'mad': 'mad - eu-madrid-1 (Madrid, Spain)',
4445
'mct': 'mct - me-dcc-muscat-1 (Muscat, Oman)',
4546
'mel': 'mel - ap-melbourne-1 (Melbourne, Australia)',
4647
'mrs': 'mrs - eu-marseille-1 (Marseille, France)',

lib/oci_utils/impl/oci_iscsi_config_main.py

Lines changed: 183 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,73 @@ def get_args_parser():
138138
)
139139
subparser = parser.add_subparsers(dest='command')
140140
#
141+
# usage
142+
_ = def_usage_parser(subparser)
143+
#
141144
# sync
142-
sync_parser = subparser.add_parser('sync',
143-
description='Try to attach available block devices.'
145+
_ = def_sync_parser(subparser)
146+
#
147+
# show-all
148+
_ = def_show_all_parser(subparser)
149+
#
150+
# show
151+
_ = def_show_parser(subparser)
152+
#
153+
# create
154+
_ = def_create_parser(subparser)
155+
#
156+
# attach
157+
_ = def_attach_parser(subparser)
158+
#
159+
# detach
160+
_ = def_detach_parser(subparser)
161+
#
162+
# destroy
163+
_ = def_destroy_parser(subparser)
164+
165+
return parser
166+
167+
168+
def def_usage_parser(s_parser):
169+
"""
170+
Define the usage parser.
171+
172+
Parameters
173+
----------
174+
s_parser: subparsers.
175+
176+
Returns
177+
-------
178+
ArgumentParser: the usage subcommand parser.
179+
"""
180+
usage_parser = s_parser.add_parser('usage',
181+
description='Displays usage',
182+
help='Displays usage'
183+
)
184+
# for compatibility mode
185+
usage_parser.add_argument('--compat',
186+
action='store_true',
187+
default=False,
188+
help=argparse.SUPPRESS
189+
)
190+
return usage_parser
191+
192+
193+
def def_sync_parser(s_parser):
194+
"""
195+
Define the sync subparser.
196+
197+
Parameters
198+
----------
199+
s_parser: subparsers.
200+
201+
Returns
202+
-------
203+
ArgumentParser: the sync subcommand parser.
204+
"""
205+
sync_parser = s_parser.add_parser('sync',
206+
description='Try to attach available block devices.',
207+
help='Try to attach available block devices.'
144208
)
145209
sync_parser.add_argument('-a', '--apply',
146210
action='store_true',
@@ -157,22 +221,28 @@ def get_args_parser():
157221
default=False,
158222
help=argparse.SUPPRESS
159223
)
160-
#
161-
# usage
162-
usage_parser = subparser.add_parser('usage',
163-
description='Displays usage.')
164-
# for compatibility mode
165-
usage_parser.add_argument('--compat',
166-
action='store_true',
167-
default=False,
168-
help=argparse.SUPPRESS
169-
)
224+
return sync_parser
225+
226+
227+
def def_show_all_parser(s_parser):
228+
"""
229+
Define the show-all parser
230+
231+
Parameters
232+
----------
233+
s_parser: subparsers.
234+
235+
Returns
236+
-------
237+
ArgumentParser: the show-all subcommand parser.
238+
239+
"""
170240
#
171241
# show all volumes all details
172-
show_all_parser = subparser.add_parser('show-all',
173-
description='Show all volumes with details '
174-
'in this availability domain.'
175-
)
242+
show_all_parser = s_parser.add_parser('show-all',
243+
description='Show all volumes with details in this availability domain.',
244+
help='Show all volumes with details in this availability domain.'
245+
)
176246
show_all_parser.add_argument('-t', '--truncate',
177247
action='store_true',
178248
help=argparse.SUPPRESS
@@ -182,11 +252,25 @@ def get_args_parser():
182252
help='Set output mode.',
183253
default='table'
184254
)
185-
#
186-
# show
187-
show_parser = subparser.add_parser('show',
188-
description='Show block volumes and iSCSI information.'
189-
)
255+
return show_all_parser
256+
257+
258+
def def_show_parser(s_parser):
259+
"""
260+
Define the show parser
261+
262+
Parameters
263+
----------
264+
s_parser: subparsers.
265+
266+
Returns
267+
-------
268+
ArgumentParser: the show subcommand parser.
269+
"""
270+
show_parser = s_parser.add_parser('show',
271+
description='Show block volumes and iSCSI information.',
272+
help='Show block volumes and iSCSI information.'
273+
)
190274
show_parser.add_argument('-C', '--compartments',
191275
metavar='COMP',
192276
default=(),
@@ -219,11 +303,25 @@ def get_args_parser():
219303
default=False,
220304
help=argparse.SUPPRESS
221305
)
222-
#
223-
# create
224-
create_parser = subparser.add_parser('create',
225-
description='Creates a block volume.'
226-
)
306+
return show_parser
307+
308+
309+
def def_create_parser(s_parser):
310+
"""
311+
Define the create parser
312+
313+
Parameters
314+
----------
315+
s_parser: subparsers
316+
317+
Returns
318+
-------
319+
ArgumentParser: the create subcommand parser
320+
"""
321+
create_parser = s_parser.add_parser('create',
322+
description='Creates a block volume.',
323+
help='Creates a block volume.'
324+
)
227325
create_parser.add_argument('-S', '--size',
228326
type=volume_size_validator,
229327
required=True,
@@ -245,12 +343,27 @@ def get_args_parser():
245343
default=False,
246344
help=argparse.SUPPRESS
247345
)
248-
#
249-
# attach
250-
attach_parser = subparser.add_parser('attach',
251-
description='Attach a block volume to this instance '
252-
'and make it available to the system.'
253-
)
346+
return create_parser
347+
348+
349+
def def_attach_parser(s_parser):
350+
"""
351+
Define the attach parser.
352+
353+
Parameters
354+
----------
355+
s_parser: subparsers
356+
357+
Returns
358+
-------
359+
ArgumentParser: the attach subcommand parser
360+
"""
361+
attach_parser = s_parser.add_parser('attach',
362+
description='Attach a block volume to this instance and make it available '\
363+
'to the system.',
364+
help='Attach a block volume to this instance and make it available to the '\
365+
'system.'
366+
)
254367
ocidiqn = attach_parser.add_mutually_exclusive_group(required=True)
255368
ocidiqn.add_argument('-I', '--iqns',
256369
type=attachable_iqn_list_validator,
@@ -282,10 +395,24 @@ def get_args_parser():
282395
default=False,
283396
help=argparse.SUPPRESS
284397
)
285-
#
286-
# detach
287-
detach_parser = subparser.add_parser('detach',
288-
description='Detach a block volume'
398+
return attach_parser
399+
400+
401+
def def_detach_parser(s_parser):
402+
"""
403+
Define the detach subcommand parser.
404+
405+
Parameters
406+
----------
407+
s_parser: subparsers
408+
409+
Returns
410+
-------
411+
ArgumentParser: the detach subcommand parser
412+
"""
413+
detach_parser = s_parser.add_parser('detach',
414+
description='Detach a block volume',
415+
help='Detach a block volume'
289416
)
290417
detach_parser.add_argument('-I', '--iqns',
291418
required=True,
@@ -305,10 +432,24 @@ def get_args_parser():
305432
default=False,
306433
help=argparse.SUPPRESS
307434
)
308-
#
309-
# destroy
310-
destroy_parser = subparser.add_parser('destroy',
311-
description='Destroy a block volume.'
435+
return detach_parser
436+
437+
438+
def def_destroy_parser(s_parser):
439+
"""
440+
Define the destroy subcommand parser.
441+
442+
Parameters
443+
----------
444+
s_parser: subparsers
445+
446+
Returns
447+
-------
448+
ArgumentParser: the destroy subcommand parser
449+
"""
450+
destroy_parser = s_parser.add_parser('destroy',
451+
description='Destroy a block volume.',
452+
help='Destroy a block volume.'
312453
)
313454
destroy_parser.add_argument('-O', '--ocids',
314455
required=True,
@@ -329,7 +470,7 @@ def get_args_parser():
329470
default=False,
330471
help=argparse.SUPPRESS
331472
)
332-
return parser
473+
return destroy_parser
333474

334475

335476
def _getch():
@@ -1541,7 +1682,7 @@ def do_create_volume(sess, size, display_name, attach_it, detached, chap_credent
15411682
#
15421683
# Something wrong if passing here.
15431684
try:
1544-
_logger.debug('Destroying the volume')
1685+
_logger.debug('Trying to destroy the volume')
15451686
vol.destroy()
15461687
except Exception as e:
15471688
_logger.debug("Failed to destroy volume", exc_info=True)

0 commit comments

Comments
 (0)