Re: [Cloud-init-dev] [Merge] ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master
For in-tree testing there are two main options; first writting unittests; under tests/unitests/test_handlers/test_.py are most of the config module tests. For an integration test, the next best way is to build the package, via ./package/[brpm|bddeb] which can create a .rpm or deb you can install to a target system. We typically use LXD to create a system container where we install the new package. You can run a single module like list: cloud-init --debug single --name cc_name_of_module --frequency always -- https://code.launchpad.net/~t0rrant/cloud-init/+git/cloud-init/+merge/371948 Your team cloud-init Commiters is requested to review the proposed merge of ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master
Hey Ryan, I'm having trouble finding the best way to test the code, I can always launch a full stack for this but that feels a bit overpowered for testing just one module. Is there any way I could test this on my development environment, for the network in my first commit I could test it with the `cloud-init devel` command: cloud-init devel net-convert --debug -D centos -O sysconfig --network-data sysconfig_test.yaml -k yaml -d . -- https://code.launchpad.net/~t0rrant/cloud-init/+git/cloud-init/+merge/371948 Your team cloud-init Commiters is requested to review the proposed merge of ~t0rrant/cloud-init:1819966-sysconfig-options into cloud-init:master. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic
The proposal to merge ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372893 -- Your team cloud-init Commiters is requested to review the proposed merge of ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco. Commit message: New upstream snapshot for disco Requested reviews: cloud-init Commiters (cloud-init-dev) Related bugs: Bug #1844191 in cloud-init: "azure advanced networking sometimes triggers duplicate mac detection" https://bugs.launchpad.net/cloud-init/+bug/1844191 For more details, see: https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372894 -- Your team cloud-init Commiters is requested to review the proposed merge of ~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco. diff --git a/.gitignore b/.gitignore index 80c509e..b9b98e7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,14 @@ stage *.snap *.cover .idea/ + +# Ignore packaging artifacts +cloud-init.dsc +cloud-init_*.build +cloud-init_*.buildinfo +cloud-init_*.changes +cloud-init_*.deb +cloud-init_*.dsc +cloud-init_*.orig.tar.gz +cloud-init_*.tar.xz +cloud-init_*.upload diff --git a/Makefile b/Makefile index 4ace227..2c6d0c8 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,9 @@ deb-src: echo sudo apt-get install devscripts; exit 1; } $(PYVER) ./packages/bddeb -S -d +doc: + tox -e doc .PHONY: test pyflakes pyflakes3 clean pep8 rpm srpm deb deb-src yaml .PHONY: check_version pip-test-requirements pip-requirements clean_pyc -.PHONY: unittest unittest3 style-check +.PHONY: unittest unittest3 style-check doc diff --git a/cloudinit/atomic_helper.py b/cloudinit/atomic_helper.py index 587b994..1f61faa 100644 --- a/cloudinit/atomic_helper.py +++ b/cloudinit/atomic_helper.py @@ -1,11 +1,13 @@ # This file is part of cloud-init. See LICENSE file for license information. import json +import logging import os import stat import tempfile _DEF_PERMS = 0o644 +LOG = logging.getLogger(__name__) def write_file(filename, content, mode=_DEF_PERMS, @@ -23,6 +25,10 @@ def write_file(filename, content, mode=_DEF_PERMS, try: tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(filename), delete=False, mode=omode) +LOG.debug( +"Atomically writing to file %s (via temporary file %s) - %s: [%o]" +" %d bytes/chars", +filename, tf.name, omode, mode, len(content)) tf.write(content) tf.close() os.chmod(tf.name, mode) diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index ea707c0..5de5c6d 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -109,6 +109,127 @@ def is_bond(devname): return os.path.exists(sys_dev_path(devname, "bonding")) +def has_master(devname): +return os.path.exists(sys_dev_path(devname, path="master")) + + +def is_netfailover(devname, driver=None): +""" netfailover driver uses 3 nics, master, primary and standby. +this returns True if the device is either the primary or standby +as these devices are to be ignored. +""" +if driver is None: +driver = device_driver(devname) +if is_netfail_primary(devname, driver) or is_netfail_standby(devname, + driver): +return True +return False + + +def get_dev_features(devname): +""" Returns a str from reading /sys/class/net//device/features.""" +features = '' +try: +features = read_sys_net(devname, 'device/features') +except Exception: +pass +return features + + +def has_netfail_standby_feature(devname): +""" Return True if VIRTIO_NET_F_STANDBY bit (62) is set. + +https://github.com/torvalds/linux/blob/ \ +089cf7f6ecb266b6a4164919a2e69bd2f938374a/ \ +include/uapi/linux/virtio_net.h#L60 +""" +features = get_dev_features(devname) +if not features or len(features) < 64: +return False +return features[62] == "1" + + +def is_netfail_master(devname, driver=None): +""" A device is a "netfail master" device if: + +- The device does NOT have the 'master' sysfs attribute +- The device driver is 'virtio_net' +- The device has the standby feature bit set + +Return True if all of the above is True. +""" +if has_master(devname): +return False + +if driver is None: +driver = device_driver(devname) + +if driver != "virtio_net": +return False + +if not has_netfail_standby_feature(devname): +return False + +return True + + +def is_netfail_primary(devname, driver=None): +""" A device is a "netfail primary" device if: + +- the device has a 'master' sysfs file +- the device driver is not 'virtio_net' +- the 'master' sysfs file points to device with virtio_net driver +- the 'master' device has the 'standby' feature bit set + +Return True if all of the above is True. +""" +# /sys/class/net//master -> ../../ +master_sysfs_path = sys_dev_path(devname,
[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic. Commit message: New upstream snapshot for release into Bionic Requested reviews: cloud-init Commiters (cloud-init-dev) Related bugs: Bug #1844191 in cloud-init: "azure advanced networking sometimes triggers duplicate mac detection" https://bugs.launchpad.net/cloud-init/+bug/1844191 For more details, see: https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372893 -- Your team cloud-init Commiters is requested to review the proposed merge of ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic. diff --git a/.gitignore b/.gitignore index 80c509e..b9b98e7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,14 @@ stage *.snap *.cover .idea/ + +# Ignore packaging artifacts +cloud-init.dsc +cloud-init_*.build +cloud-init_*.buildinfo +cloud-init_*.changes +cloud-init_*.deb +cloud-init_*.dsc +cloud-init_*.orig.tar.gz +cloud-init_*.tar.xz +cloud-init_*.upload diff --git a/Makefile b/Makefile index 4ace227..2c6d0c8 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,9 @@ deb-src: echo sudo apt-get install devscripts; exit 1; } $(PYVER) ./packages/bddeb -S -d +doc: + tox -e doc .PHONY: test pyflakes pyflakes3 clean pep8 rpm srpm deb deb-src yaml .PHONY: check_version pip-test-requirements pip-requirements clean_pyc -.PHONY: unittest unittest3 style-check +.PHONY: unittest unittest3 style-check doc diff --git a/cloudinit/atomic_helper.py b/cloudinit/atomic_helper.py index 587b994..1f61faa 100644 --- a/cloudinit/atomic_helper.py +++ b/cloudinit/atomic_helper.py @@ -1,11 +1,13 @@ # This file is part of cloud-init. See LICENSE file for license information. import json +import logging import os import stat import tempfile _DEF_PERMS = 0o644 +LOG = logging.getLogger(__name__) def write_file(filename, content, mode=_DEF_PERMS, @@ -23,6 +25,10 @@ def write_file(filename, content, mode=_DEF_PERMS, try: tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(filename), delete=False, mode=omode) +LOG.debug( +"Atomically writing to file %s (via temporary file %s) - %s: [%o]" +" %d bytes/chars", +filename, tf.name, omode, mode, len(content)) tf.write(content) tf.close() os.chmod(tf.name, mode) diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index ea707c0..5de5c6d 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -109,6 +109,127 @@ def is_bond(devname): return os.path.exists(sys_dev_path(devname, "bonding")) +def has_master(devname): +return os.path.exists(sys_dev_path(devname, path="master")) + + +def is_netfailover(devname, driver=None): +""" netfailover driver uses 3 nics, master, primary and standby. +this returns True if the device is either the primary or standby +as these devices are to be ignored. +""" +if driver is None: +driver = device_driver(devname) +if is_netfail_primary(devname, driver) or is_netfail_standby(devname, + driver): +return True +return False + + +def get_dev_features(devname): +""" Returns a str from reading /sys/class/net//device/features.""" +features = '' +try: +features = read_sys_net(devname, 'device/features') +except Exception: +pass +return features + + +def has_netfail_standby_feature(devname): +""" Return True if VIRTIO_NET_F_STANDBY bit (62) is set. + +https://github.com/torvalds/linux/blob/ \ +089cf7f6ecb266b6a4164919a2e69bd2f938374a/ \ +include/uapi/linux/virtio_net.h#L60 +""" +features = get_dev_features(devname) +if not features or len(features) < 64: +return False +return features[62] == "1" + + +def is_netfail_master(devname, driver=None): +""" A device is a "netfail master" device if: + +- The device does NOT have the 'master' sysfs attribute +- The device driver is 'virtio_net' +- The device has the standby feature bit set + +Return True if all of the above is True. +""" +if has_master(devname): +return False + +if driver is None: +driver = device_driver(devname) + +if driver != "virtio_net": +return False + +if not has_netfail_standby_feature(devname): +return False + +return True + + +def is_netfail_primary(devname, driver=None): +""" A device is a "netfail primary" device if: + +- the device has a 'master' sysfs file +- the device driver is not 'virtio_net' +- the 'master' sysfs file points to device with virtio_net driver +- the 'master' device has the 'standby' feature bit set + +Return True if all of the above is True. +""" +# /sys/class/net//master -> ../../ +master_sysfs_path = sys_
[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial. Commit message: new-upstream snapshot for SRU into Xenial Requested reviews: cloud-init Commiters (cloud-init-dev) Related bugs: Bug #1844191 in cloud-init: "azure advanced networking sometimes triggers duplicate mac detection" https://bugs.launchpad.net/cloud-init/+bug/1844191 For more details, see: https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372891 -- Your team cloud-init Commiters is requested to review the proposed merge of ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial. diff --git a/.gitignore b/.gitignore index 80c509e..b9b98e7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,14 @@ stage *.snap *.cover .idea/ + +# Ignore packaging artifacts +cloud-init.dsc +cloud-init_*.build +cloud-init_*.buildinfo +cloud-init_*.changes +cloud-init_*.deb +cloud-init_*.dsc +cloud-init_*.orig.tar.gz +cloud-init_*.tar.xz +cloud-init_*.upload diff --git a/Makefile b/Makefile index 4ace227..2c6d0c8 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,9 @@ deb-src: echo sudo apt-get install devscripts; exit 1; } $(PYVER) ./packages/bddeb -S -d +doc: + tox -e doc .PHONY: test pyflakes pyflakes3 clean pep8 rpm srpm deb deb-src yaml .PHONY: check_version pip-test-requirements pip-requirements clean_pyc -.PHONY: unittest unittest3 style-check +.PHONY: unittest unittest3 style-check doc diff --git a/cloudinit/atomic_helper.py b/cloudinit/atomic_helper.py index 587b994..1f61faa 100644 --- a/cloudinit/atomic_helper.py +++ b/cloudinit/atomic_helper.py @@ -1,11 +1,13 @@ # This file is part of cloud-init. See LICENSE file for license information. import json +import logging import os import stat import tempfile _DEF_PERMS = 0o644 +LOG = logging.getLogger(__name__) def write_file(filename, content, mode=_DEF_PERMS, @@ -23,6 +25,10 @@ def write_file(filename, content, mode=_DEF_PERMS, try: tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(filename), delete=False, mode=omode) +LOG.debug( +"Atomically writing to file %s (via temporary file %s) - %s: [%o]" +" %d bytes/chars", +filename, tf.name, omode, mode, len(content)) tf.write(content) tf.close() os.chmod(tf.name, mode) diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index ea707c0..5de5c6d 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -109,6 +109,127 @@ def is_bond(devname): return os.path.exists(sys_dev_path(devname, "bonding")) +def has_master(devname): +return os.path.exists(sys_dev_path(devname, path="master")) + + +def is_netfailover(devname, driver=None): +""" netfailover driver uses 3 nics, master, primary and standby. +this returns True if the device is either the primary or standby +as these devices are to be ignored. +""" +if driver is None: +driver = device_driver(devname) +if is_netfail_primary(devname, driver) or is_netfail_standby(devname, + driver): +return True +return False + + +def get_dev_features(devname): +""" Returns a str from reading /sys/class/net//device/features.""" +features = '' +try: +features = read_sys_net(devname, 'device/features') +except Exception: +pass +return features + + +def has_netfail_standby_feature(devname): +""" Return True if VIRTIO_NET_F_STANDBY bit (62) is set. + +https://github.com/torvalds/linux/blob/ \ +089cf7f6ecb266b6a4164919a2e69bd2f938374a/ \ +include/uapi/linux/virtio_net.h#L60 +""" +features = get_dev_features(devname) +if not features or len(features) < 64: +return False +return features[62] == "1" + + +def is_netfail_master(devname, driver=None): +""" A device is a "netfail master" device if: + +- The device does NOT have the 'master' sysfs attribute +- The device driver is 'virtio_net' +- The device has the standby feature bit set + +Return True if all of the above is True. +""" +if has_master(devname): +return False + +if driver is None: +driver = device_driver(devname) + +if driver != "virtio_net": +return False + +if not has_netfail_standby_feature(devname): +return False + +return True + + +def is_netfail_primary(devname, driver=None): +""" A device is a "netfail primary" device if: + +- the device has a 'master' sysfs file +- the device driver is not 'virtio_net' +- the 'master' sysfs file points to device with virtio_net driver +- the 'master' device has the 'standby' feature bit set + +Return True if all of the above is True. +""" +# /sys/class/net//master -> ../../ +master_sysfs_path = sys_dev_
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1158/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1158//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
The proposal to merge ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 -- Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1157/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1157//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1156/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1156//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1155/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests FAILED: Ubuntu LTS: Build Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1155//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1154/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1154//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1153/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1153//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1152/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1152//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1151/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1151//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1150/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1150//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1149/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1149//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1148/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1148//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1147/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1147//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Review: Needs Fixing continuous-integration No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want jenkins to rebuild you need to trigger it yourself): https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864/+edit-commit-message https://jenkins.ubuntu.com/server/job/cloud-init-ci/1146/ Executed test runs: SUCCESS: Checkout SUCCESS: Unit & Style Tests SUCCESS: Ubuntu LTS: Build SUCCESS: Ubuntu LTS: Integration IN_PROGRESS: Declarative: Post Actions Click here to trigger a rebuild: https://jenkins.ubuntu.com/server/job/cloud-init-ci/1146//rebuild -- https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. ___ Mailing list: https://launchpad.net/~cloud-init-dev Post to : cloud-init-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~cloud-init-dev More help : https://help.launchpad.net/ListHelp
[Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel
Dan Watkins has proposed merging ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. Requested reviews: cloud-init Commiters (cloud-init-dev) Related bugs: Bug #1844191 in cloud-init: "azure advanced networking sometimes triggers duplicate mac detection" https://bugs.launchpad.net/cloud-init/+bug/1844191 For more details, see: https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372864 -- Your team cloud-init Commiters is requested to review the proposed merge of ~daniel-thewatkins/cloud-init/+git/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel. diff --git a/.gitignore b/.gitignore index 80c509e..b9b98e7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,14 @@ stage *.snap *.cover .idea/ + +# Ignore packaging artifacts +cloud-init.dsc +cloud-init_*.build +cloud-init_*.buildinfo +cloud-init_*.changes +cloud-init_*.deb +cloud-init_*.dsc +cloud-init_*.orig.tar.gz +cloud-init_*.tar.xz +cloud-init_*.upload diff --git a/Makefile b/Makefile index 4ace227..2c6d0c8 100644 --- a/Makefile +++ b/Makefile @@ -106,7 +106,9 @@ deb-src: echo sudo apt-get install devscripts; exit 1; } $(PYVER) ./packages/bddeb -S -d +doc: + tox -e doc .PHONY: test pyflakes pyflakes3 clean pep8 rpm srpm deb deb-src yaml .PHONY: check_version pip-test-requirements pip-requirements clean_pyc -.PHONY: unittest unittest3 style-check +.PHONY: unittest unittest3 style-check doc diff --git a/cloudinit/atomic_helper.py b/cloudinit/atomic_helper.py index 587b994..1f61faa 100644 --- a/cloudinit/atomic_helper.py +++ b/cloudinit/atomic_helper.py @@ -1,11 +1,13 @@ # This file is part of cloud-init. See LICENSE file for license information. import json +import logging import os import stat import tempfile _DEF_PERMS = 0o644 +LOG = logging.getLogger(__name__) def write_file(filename, content, mode=_DEF_PERMS, @@ -23,6 +25,10 @@ def write_file(filename, content, mode=_DEF_PERMS, try: tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(filename), delete=False, mode=omode) +LOG.debug( +"Atomically writing to file %s (via temporary file %s) - %s: [%o]" +" %d bytes/chars", +filename, tf.name, omode, mode, len(content)) tf.write(content) tf.close() os.chmod(tf.name, mode) diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py index ea707c0..5de5c6d 100644 --- a/cloudinit/net/__init__.py +++ b/cloudinit/net/__init__.py @@ -109,6 +109,127 @@ def is_bond(devname): return os.path.exists(sys_dev_path(devname, "bonding")) +def has_master(devname): +return os.path.exists(sys_dev_path(devname, path="master")) + + +def is_netfailover(devname, driver=None): +""" netfailover driver uses 3 nics, master, primary and standby. +this returns True if the device is either the primary or standby +as these devices are to be ignored. +""" +if driver is None: +driver = device_driver(devname) +if is_netfail_primary(devname, driver) or is_netfail_standby(devname, + driver): +return True +return False + + +def get_dev_features(devname): +""" Returns a str from reading /sys/class/net//device/features.""" +features = '' +try: +features = read_sys_net(devname, 'device/features') +except Exception: +pass +return features + + +def has_netfail_standby_feature(devname): +""" Return True if VIRTIO_NET_F_STANDBY bit (62) is set. + +https://github.com/torvalds/linux/blob/ \ +089cf7f6ecb266b6a4164919a2e69bd2f938374a/ \ +include/uapi/linux/virtio_net.h#L60 +""" +features = get_dev_features(devname) +if not features or len(features) < 64: +return False +return features[62] == "1" + + +def is_netfail_master(devname, driver=None): +""" A device is a "netfail master" device if: + +- The device does NOT have the 'master' sysfs attribute +- The device driver is 'virtio_net' +- The device has the standby feature bit set + +Return True if all of the above is True. +""" +if has_master(devname): +return False + +if driver is None: +driver = device_driver(devname) + +if driver != "virtio_net": +return False + +if not has_netfail_standby_feature(devname): +return False + +return True + + +def is_netfail_primary(devname, driver=None): +""" A device is a "netfail primary" device if: + +- the device has a 'master' sysfs file +- the device driver is not 'virtio_net' +- the 'master' sysfs file points to device with virtio_net driver +- the 'master' device has the 'standby' feature bit set + +Return True if all of the above is True. +""" +# /sys/class/net//master -> ../../ +master_sysfs_path = sys_dev_path(de