Skip to content

Commit c056682

Browse files
author
guido tijskens
committed
kvm tests
1 parent 6b9b20a commit c056682

34 files changed

+2850
-71
lines changed

buildrpm/oci-utils.spec

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,17 @@ rm -rf %{buildroot}
182182
/opt/oci-utils/tests/__init__*
183183

184184
%changelog
185+
* Fri Aug 27 2021 Guido Tijskens <guido.tijskens@oracle.com> -- 0.12.5.9
186+
- LINUX-11457: public API oci_api missing get_object_storage_client
187+
188+
* Tue Aug 24 2021 Guido Tijskens <guido.tijskens@oracle.com> -- 0.12.5-8
189+
- LINUX-11441: add --yes flag to delete-network in oci-kvm
190+
- LINUX-11442: oci-kvm create network fails with 'numerical result out of range when name > 14 characters
191+
- LINUX-11443: oci-kvm create-pool on nfs fails with python3 string error
192+
193+
* Thu Aug 12 2021 Guido Tijskens <guido.tijskens@oracle.com> -- 0.12.5-7
194+
- LINUX-7304: KVM image script alignment
195+
185196
* Wed Aug 11 2021 Guido Tijskens <guido.tijskens@oracle.com> -- 0.12.5-6
186197
- LINUX-1742: oci-public-ip reports errors when python-oci-sdk is installed but not set up
187198
- LINUX-9425: oci-iscsi-config attach -I fails on iqn's

data/00-oci-utils.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
; enabled=true
2727

2828
; Resize boot and iSCSI volumes automatically. Set to false to disable this
29-
; function of ocid; defautl = true
29+
; function of ocid; default = true
3030
; auto_resize=true
3131
;
3232
; Number of seconds to sleep between scans; default = 60
@@ -57,4 +57,4 @@
5757
; Number of seconds to sleep between refresh attempts
5858
; refresh_interval=600
5959
[ocid]
60-
; debug=true
60+
; debug=true

lib/oci_utils/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
'cwl': 'cwl - uk-cardiff-1 (Newport, UK)',
3333
'dxb': 'dxb - me-dubai-1 (Duabi, UAE)',
3434
'gru': 'gru - sa-saopaulo-1 (Sao Paulo, Brazil)',
35+
'vcp': 'vcp - sa-vinhedo-1 (Vinhedo, Brazil)',
3536
'hyd': 'hyd - ap-hyderabad-1 (Hyderabad, India)',
3637
'icn': 'icn - ap-seoul-1 (Seoul, South Korea)',
3738
'jed': 'jed - me-jeddah-1 (Jeddah, Saoudi Arabia)',

lib/oci_utils/impl/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ def setup_logging(forceDebug=False):
161161
else:
162162
if forceDebug:
163163
try:
164-
handler = logging.handlers.RotatingFileHandler(
165-
'/var/tmp/oci-utils.log', mode='a', maxBytes=1024 * 1024, backupCount=3)
164+
handler = logging.handlers.RotatingFileHandler('/var/tmp/oci-utils.log',
165+
mode='a',
166+
maxBytes=1024 * 1024,
167+
backupCount=3)
166168
handler.setFormatter(formatter)
167169
handler.setLevel(logging.NOTSET)
168170
except Exception as _:

lib/oci_utils/impl/oci-iscsi-config-main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ def api_display_available_block_volumes(sess, compartments, show_all, output_mod
866866
compartement ocid(s)
867867
show_all: bool
868868
display all volumes. By default display only not-attached ones
869-
output_mode : informtion display mode
869+
output_mode : information display mode
870870
details : display detailed information ?
871871
truncate: truncate text?
872872
@@ -1002,10 +1002,10 @@ def get_volume_by_iqn(sess, iqn):
10021002
try:
10031003
if bool(sess):
10041004
get_volume_by_iqn.all_this_instance_volume = sess.this_instance().all_volumes()
1005-
for v in get_volume_by_iqn.all_this_instance_volume:
1006-
if v.get_iqn() == iqn:
1007-
_logger.debug('Found %s', str(v))
1008-
return v
1005+
for volume in get_volume_by_iqn.all_this_instance_volume:
1006+
if volume.get_iqn() == iqn:
1007+
_logger.debug('Found %s', str(volume))
1008+
return volume
10091009
else:
10101010
_logger.info('Unable to get volume ocid and display name for iqn %s, ', iqn)
10111011
except Exception as e:

lib/oci_utils/impl/oci-network-config-main.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -368,11 +368,15 @@ def _display_subnet(_, subnet):
368368
def do_show_information(vnic_utils, mode, details=False):
369369
"""
370370
Display network information
371-
parameter
372-
---------
373-
vnic_utils : instance ov VNICUtil
374-
mode : output mode (text,parsable etc...)
375-
details : display detailed information ?
371+
372+
Parameters
373+
----------
374+
vnic_utils : instance of VNICUtils
375+
376+
mode : str
377+
output mode (text,parsable etc...)
378+
details : bool
379+
display detailed information ?
376380
"""
377381

378382
sess = get_oci_api_session()

lib/oci_utils/impl/oci-notify-main.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,15 @@ def parse_args():
8282
.replace('MAX_MESSAGE_CHUNKS', str(MAX_MESSAGE_CHUNKS)))
8383
parser = argparse.ArgumentParser(description='%s' % extra_descr)
8484
sub_parser = parser.add_subparsers(dest='mode')
85+
8586
config_parser = sub_parser.add_parser('config', help='Configure the notification server.')
86-
message_parser = sub_parser.add_parser('message', help='Send a message.')
87+
8788
config_parser.add_argument(action='store',
8889
dest='notification_ocid',
8990
type=str,
9091
help='The ocid of the notification topic.')
92+
93+
message_parser = sub_parser.add_parser('message', help='Send a message.')
9194
message_parser.add_argument('-t', '--title',
9295
action='store',
9396
dest='message_title',
@@ -449,7 +452,7 @@ def _read_oci_config(fname, profile='DEFAULT'):
449452
oci_config = oci_sdk.config.from_file(full_fname, profile)
450453
return oci_config
451454
except oci_sdk.exceptions.ConfigFileNotFound as e:
452-
_logger.debug("Unable to read OCI config file: %s", str(e))
455+
_logger.debug('Unable to read OCI config file: %s', str(e))
453456
raise Exception('Unable to read OCI config file') from e
454457

455458
def get_auth_method(self, authentication_method=None):
@@ -524,7 +527,7 @@ def _proxy_authenticate(self):
524527
"""
525528
_logger.debug('_proxy_authenticate')
526529
if os.geteuid() != 0:
527-
raise Exception("Must be root to use Proxy authentication")
530+
raise Exception('Must be root to use Proxy authentication')
528531

529532
sdk_user = OCIUtilsConfiguration.get('auth', 'oci_sdk_user')
530533
try:
@@ -533,8 +536,8 @@ def _proxy_authenticate(self):
533536
self._identity_client = oci_sdk.identity.IdentityClient(self._oci_config)
534537
self._ons_client = oci_sdk.ons.NotificationDataPlaneClient(config=self._oci_config)
535538
except Exception as e:
536-
_logger.debug("Proxy authentication failed: %s", str(e))
537-
raise Exception("Proxy authentication failed") from e
539+
_logger.debug('Proxy authentication failed: %s', str(e))
540+
raise Exception('Proxy authentication failed') from e
538541

539542
def _direct_authenticate(self):
540543
"""
@@ -556,7 +559,7 @@ def _direct_authenticate(self):
556559
self._ons_client = oci_sdk.ons.NotificationDataPlaneClient(config=self._oci_config)
557560
except Exception as e:
558561
_logger.debug('Direct authentication failed: %s', str(e))
559-
raise Exception("Direct authentication failed") from e
562+
raise Exception('Direct authentication failed') from e
560563

561564
def _ip_authenticate(self):
562565
"""
@@ -758,17 +761,19 @@ def send_message_chunk(self, chunk, nb, nbtot):
758761
_logger.debug('_Send chunk %d of %d', nb, nbtot)
759762
if nbtot <= 1:
760763
_logger.info("Publishing message '%s: %s'", self._instance_name, self._title)
764+
thistitle = self._title
761765
else:
762766
_logger.info("Publishing message '[%d/%d] %s: %s'", nb, nbtot, self._instance_name, self._title)
767+
thistitle = self._title + ' [%d/%d]' % (nb,nbtot)
763768
_message_details = oci_sdk.ons.models.MessageDetails(body=chunk, title=self._instance_name
764769
+ ':'
765-
+ 'self._title)
770+
+ thistitle)
766771
request_id = uuid.uuid4().hex
767772
_logger.debug('Message request id: %s', request_id)
768773
publish_message_response = self._ons_client.publish_message(topic_id=self._topic,
769774
message_details=_message_details,
770775
opc_request_id=request_id,
771-
message_type="RAW_TEXT")
776+
message_type='RAW_TEXT')
772777
if nbtot <= 1:
773778
_logger.info("Published message '%s: %s'", self._instance_name, self._title)
774779
else:

lib/oci_utils/impl/row_printer.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,12 @@ def __init__(self, **kargs):
8585
self.printer = kargs.get('printer', sys.stdout)
8686

8787
def printHeader(self):
88-
"""
89-
prints the header of the array
90-
depend of the implementation
88+
""" Prints the header of the array, depend of the implementation
9189
"""
9290

9391
def printRow(self, o):
9492
"""
95-
prints a new row
93+
Prints a new row
9694
o can be an arbitrary instance on which all columns attribute will be called
9795
if o is an dictionnary columns attribute are used as key of the dictionnary
9896
if o is a list all elements' string representation will be printed in order
@@ -131,7 +129,7 @@ def _getValueForColumn(self, columnIdx, _object):
131129
:param _object: Object as accepted by printRow
132130
raise LookupError is value cannot be found
133131
134-
If current column attribut is a function , call it with _object
132+
If current column attribute is a function , call it with _object
135133
If _object is a list or a tuple, returns the columnIdx'th element of it
136134
If _object is a dictionary, returns the value associated with key defined in column attribute
137135
If _object is a Object

0 commit comments

Comments
 (0)