Skip to content

Instantly share code, notes, and snippets.

@mgerdts
Last active February 2, 2018 17:53
Show Gist options
  • Save mgerdts/c79383050eda90cb008497c11e1aa82b to your computer and use it in GitHub Desktop.
Save mgerdts/c79383050eda90cb008497c11e1aa82b to your computer and use it in GitHub Desktop.
cloud-init 1746605 DataSourceSmartOS needs locking and retries

Pass

A successful run generates a bit of noise due to killing the child process. I'm not sure, what, if anything to do about that.

test_all_keys (tests.unittests.test_datasource.test_smartos.TestSerialConcurrency) ... Cloud-init 17.2 received SIGTERM, exiting...
  Filename: /usr/lib64/python2.7/subprocess.py
  Function: _eintr_retry_call
  Line number: 478
    Filename: /usr/lib64/python2.7/subprocess.py
    Function: communicate
    Line number: 792
      Filename: /usr/lib64/python2.7/subprocess.py
      Function: check_output
      Line number: 569
ok

Fail

I commented the fcntl.lockf() from JoyentMetaDataSerialClient.open_transport() and got this failure on every run. The partial response varied.

======================================================================
ERROR: test_all_keys (tests.unittests.test_datasource.test_smartos.TestSerialConcurrency)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mgerdts/cloud-init/tests/unittests/test_datasource/test_smartos.py", line 936, in test_all_keys
    client.get(key)
  File "/home/mgerdts/cloud-init/cloudinit/sources/DataSourceSmartOS.py", line 571, in get
    val = self._get(key, strip=False, default=mdefault)
  File "/home/mgerdts/cloud-init/cloudinit/sources/DataSourceSmartOS.py", line 557, in _get
    get(key, default=default, strip=strip))
  File "/home/mgerdts/cloud-init/cloudinit/sources/DataSourceSmartOS.py", line 413, in get
    result = self.request(rtype='GET', param=key)
  File "/home/mgerdts/cloud-init/cloudinit/sources/DataSourceSmartOS.py", line 396, in request
    response)
JoyentMetadataFetchException: Timeout during read. Partial response: b'i'
-------------------- >> begin captured logging << --------------------
cloudinit.util: DEBUG: Running command ['systemd-detect-virt', '--quiet', '--container'] with allowed return codes [0] (shell=False, capture=True)
cloudinit.util: DEBUG: Running command ['running-in-container'] with allowed return codes [0] (shell=False, capture=True)
cloudinit.util: DEBUG: Running command ['lxc-is-container'] with allowed return codes [0] (shell=False, capture=True)
cloudinit.util: DEBUG: Reading from /proc/1/environ (quiet=False)
cloudinit.util: DEBUG: Read 0 bytes from /proc/1/environ
cloudinit.util: DEBUG: Reading from /proc/self/status (quiet=False)
cloudinit.util: DEBUG: Read 1142 bytes from /proc/self/status
cloudinit.util: DEBUG: querying dmi data /sys/class/dmi/id/product_name
cloudinit.util: DEBUG: Reading from /sys/class/dmi/id/product_name (quiet=False)
cloudinit.util: DEBUG: Read 12 bytes from /sys/class/dmi/id/product_name
cloudinit.util: DEBUG: dmi data /sys/class/dmi/id/product_name returned SmartDC HVM
cloudinit.sources.DataSourceSmartOS: DEBUG: Writing "V2 33 25e86719 7ae19e81 GET bW90ZF9zeXNfaW5mbw==
" to metadata transport.
cloudinit.sources.DataSourceSmartOS: DEBUG: Writing "V2 33 83ce6da5 98a34536 GET bW90ZF9zeXNfaW5mbw==
" to metadata transport.
--------------------- >> end captured logging << ---------------------

Skip

When on SmartOS but the serial port is not accessible to the (e.g. non-root) user:

test_all_keys (tests.unittests.test_datasource.test_smartos.TestSerialConcurrency) ... SKIP: Requires write access to /dev/ttyS1

When run as root on CentOS 7 under VMware:

test_all_keys (tests.unittests.test_datasource.test_smartos.TestSerialConcurrency) ... SKIP: Only supported on KVM and bhyve guests under SmartOS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment