← Back to team overview

cloud-init-dev team mailing list archive

Re: [Merge] ~chad.smith/cloud-init:feature/maintain-network-on-boot into cloud-init:master

 


Diff comments:

> diff --git a/cloudinit/event.py b/cloudinit/event.py
> new file mode 100644
> index 0000000..f7b311f
> --- /dev/null
> +++ b/cloudinit/event.py
> @@ -0,0 +1,17 @@
> +# This file is part of cloud-init. See LICENSE file for license information.
> +
> +"""Classes and functions related to event handling."""
> +
> +
> +# Event types which can generate maintenance requests for cloud-init.
> +class EventType(object):
> +    BOOT = "System boot"
> +    BOOT_NEW_INSTANCE = "New instance first boot"

Mike, I just pushed up a branch for Azure which supports reconfiguring network on every boot (as well as generating network_config from their metadata service which is a bit noisy given your needs).  https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/348704
A datasource subclass need only append EventType.BOOT to DataSourceSmartOS.maintenance_events  if their metadata service reports that the user wants to maintain-network. This could be done idempotently (append EventType.BOOT if not in self.maintenance_events) in your datasource's _get_data() method based on whatever you metadata service tells it about whether to maintain network per boot.   I wouldn't expect your metadata service to know anything about our internal EventType strings or constants, just to interpret the proper EventType.<something> to add to supported/subscribed maintenance_events.  Cloud-init calls network_config only after _get_data is processed, so if the datasource.maintenance_events is in the proper state after _get_data, then network_config will either be generated or left untouched on a normal reboot event.

> +
> +    # TODO: Cloud-init will grow support for the follow event types:
> +    # UDEV
> +    # METADATA_CHANGE
> +    # USER_REQUEST
> +
> +
> +# vi: ts=4 expandtab


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/348000
Your team cloud-init commiters is requested to review the proposed merge of ~chad.smith/cloud-init:feature/maintain-network-on-boot into cloud-init:master.


References