454 Commits

Author SHA1 Message Date
Alessandro Pilotti
1fae06860c Fixes setting MTU on adapters to be disabled
Fixes the issue by setting the MTU before disabling an adapter.

Change-Id: I1590074e165fbd5214812b4f247702cd6bb9a972
Closes-Bug: #1800063
2018-10-25 19:12:40 -07:00
Adrian Vladu
9bd096803e Fix get_network_details_v2 exception
get_network_details_v2 implementation should be consistent with
the base metadata service implementation.
The method should return None in case the underlying metadata
does not exist or if it is invalid.

Change-Id: Ida3fe780f22dc20db6bd8ed3f43728a2671b46da
Closes-Bug: #1796053
2018-10-17 16:54:00 +03:00
Alessandro Pilotti
2773599be3 Add get_network_details_v2 in MAAS
Includes support for static networking, bonds and VLANs.

Implements: blueprint maas-network-config
Co-Authored-By: Adrian Vladu <avladu@cloudbasesolutions.com>
Change-Id: If0949ecfc3ec0cb65d4cd89cffd3055a110e737e
2018-09-13 17:59:16 +03:00
Alessandro Pilotti
1cdf43ce23 Add get_network_details_v2 in BaseOpenStackService
Partially-Implements: blueprint json-network-config
Change-Id: Ia2a31518f87f34c234988fc512f1698617efdb10
Co-Authored-By: Adrian Vladu <avladu@cloudbasesolutions.com>
2018-09-13 17:59:16 +03:00
Alessandro Pilotti
6782252536 Support get_network_details_v2 in network plugin
The original network processing is retained for metadata services
that don't implement get_network_details_v2.

Partially-Implements: blueprint json-network-config
Change-Id: Ie2cee13211bc52f69104875803dbc283b3d8e38d
Co-Authored-By: Adrian Vladu <avladu@cloudbasesolutions.com>
2018-09-13 17:59:08 +03:00
Alessandro Pilotti
6e079d6fa4 Add enable_network_adapter
Change-Id: Iae635a51c51adbfc6628a36f52520c5bdc0f0a72
Partially-Implements: blueprint json-network-config
2018-09-10 21:05:13 +03:00
Alessandro Pilotti
1fc57be0f7 Add get_network_adapter_name_by_mac_address
A simple way to get an adapter name given the MAC address. This is needed
since the MAC address is used to uniquely identify NICs based on
information provided by metadata services.

get_network_adapter_name_by_mac_address raises in case no adapters or
multiple adapters with the same MAC are found.

Change-Id: Ie17ee65445dc55a5946653ece1fef68ad7b87aba
Partially-Implements: blueprint json-network-config
2018-09-10 21:05:13 +03:00
Alessandro Pilotti
ac667f7f50 Use MSFT_NetIPAddress in static network config
Change set_static_network_config in order to work with recent
Windows versions as well.

Partially-Implements: blueprint json-network-config
Change-Id: Ie916d658265ca2895afcdebeaa5ae82d48b90082
2018-09-10 21:04:58 +03:00
Alessandro Pilotti
518081b45b Add get_network_details_v2
Partially-Implements: blueprint json-network-config
Change-Id: Ic16ef974408f6125f6c1ba06e94b62afdf45dd32
2018-09-05 20:42:10 +03:00
Alessandro Pilotti
f99a8daabf Add NetLBFO network teaming
On Windows two main options are available to create network
adapter teams: NetLBFO (starting with Windows Server 2012) and
SET (starting with Windows Server 2016, requiring a VMSwitch).
This patch adds support for for NetLBFO.

Partially-Implements: blueprint json-network-config
Change-Id: Id80d24db0239acb8cb9d3ba5f9eaca1191957f1a
Co-Authored-By: Adrian Vladu <avladu@cloudbasesolutions.com>
2018-09-05 20:42:10 +03:00
Alessandro Pilotti
148855f74e Add PyMI as requirement
Since PyMI requires the MI API, available only since Windows 8 /
Windows Server 2012 or as an addon on some previous versions, we
need to ensure that we fall back to the legacy WMI module if PyMI
cannot be loaded.

Partially-Implements: blueprint json-network-config
Change-Id: Ibded4cee3d3d7dc39e53bca12e015c9ef83c7f3d
2018-09-05 20:42:10 +03:00
Alessandro Pilotti
fe9aa8247d Use the interface name when setting the MTU
When using bonds and VLANs, multiple NICs can have the same
MAC address. This patch replaces the MAC address with the name
as a unique network adapter identifier.

Partially-Implements: blueprint json-network-config
Change-Id: Id1a32e8dfa4322edbc579e96e76a23965f19345b
2018-09-05 20:42:10 +03:00
Alessandro Pilotti
705daeb7d0 Include the NIC names in get_dhcp_hosts_in_use
This is needed to identify the NIC when multiple adapters share the same
MAC address, e.g. when bonds or VLAN NICs are present.

Change-Id: I5dc63fd06e03c005e1f2190e84444720723a5de6
Partially-Implements: blueprint json-network-config
2018-09-05 20:42:10 +03:00
Alessandro Pilotti
ae3d80fd63 Add rename_network_adapter
Needed in osutils for renaming network adapters based
on the metadata network configuration.

Partially-Implements: blueprint json-network-config
Change-Id: I0d3fb842b39388d2f04abe3e2c3adc988c3e4dbe
2018-09-05 20:42:10 +03:00
Alessandro Pilotti
01a501ff1d Return NetConnectionID instead of Name
Change get_network_adapters in the Windows osutils to return
NetConnectionID from the Win32_NetworkAdapter WMI query in
place of Name.

Different Windows API use different naming to identify the name and
description of a network adapter.
In the case of Win32_NetworkAdapter, NetConnectionID is the actual
name (e.g. Ethernet1) while Name is the description (e.g. Microsoft
Hyper-V Network Adapter).

Partially-Implements: blueprint json-network-config
Change-Id: I3e690a9e0b763e9829a3eddd91a47454d3eb1df8
2018-09-05 20:42:09 +03:00
Alessandro Pilotti
0dc65eb712 Add new networking model
Partially-Implements: blueprint json-network-config
Change-Id: Ifaa9c5a037196a70bf24ab0b3ab45c32d362856c
2018-09-05 20:41:59 +03:00
Alessandro Pilotti
bde2be7e7d Move NetworkDetails to a separate module
Partially-Implements: blueprint json-network-config
Change-Id: I4d375cba9601e5c05ab9b9591f9e9bb6f3be3d86
2018-08-30 14:51:08 +03:00
Alessandro Pilotti
0d04300138 Fix COM thread model issue
The following issue happens when trying to extend volumes using VDS:

OSError: [WinError -2147417850] Cannot change thread mode after it
is set

sys.coinit_flags needs to be set before importing pythoncom.

Change-Id: I83877219b9589d9c174fd3a245b644350ea6310a
Closes-Bug: #1787659
2018-08-18 00:25:20 +03:00
Alessandro Pilotti
b2f738236d Fix issue in retrieving MAC address
Retrieving the MAC address fails when there are interfaces that
don't have a AF_INET address.

Change-Id: I1e7f4bd897e8e2a0b79f16326f59f2495b946b80
Closes-Bug: #1787361
2018-08-16 12:25:32 +03:00
Alessandro Pilotti
bb2e3484d6 Fix libeay32 and UCRT DLL search
Change-Id: I440b640e43aea9f985751b393f79824d7f8c9ad9
2018-08-14 01:22:28 +03:00
Alessandro Pilotti
53a4ee450b Fix access violation when calling get_volumes
Change-Id: I4b4ae831a096af1c94ee713549407de940232201
Closes-Bug: #1785473
2018-08-05 15:37:55 +03:00
Alessandro Pilotti
0368124b54 Fix CRT DLL loading on Windows in Python 3.6
ctypes.util.find_library("c") returns None in Python 3.6.

Change-Id: I1918ae53a8712220b973edfdcdcd54e612f21c94
Closes-Bug: #1785467
2018-08-05 14:25:20 +03:00
Alessandro Pilotti
f9c15d2214 Change check_latest_version default value
Sets the default value to False.

Change-Id: Ie242a075f502b417b96a5927896b68ed296af056
2018-06-24 14:44:00 +03:00
James Penick
24365043e3 Recognize uppercase vfat disk labels
New mkfs.vfat and fatlabel tools included in the dosfsutils package no
longer support creating vfat disks with lowercase labels. They silently
default to an all uppercase label eg CONFIG-2 instead of config-2. This
change makes cloud-init handle either upper or lower case.

Change-Id: Iec927db04b9621b20c9bee2c8d81325d7af80f9b
Closes-Bug: #1598783
2018-02-27 10:23:33 +02:00
Jenkins
c77216965d Merge "Fixed all typos in comments" 2017-08-18 09:01:34 +00:00
Jenkins
b8da594e39 Merge "Adds releasenotes configuration" 2017-08-08 14:06:30 +00:00
Claudiu Belu
74e3457769 Adds releasenotes configuration
Adds the necessary bits for the reno support.

Change-Id: Ib76aeb5e2e5616bfb6a293684de50eb727e012a7
2017-07-21 11:25:12 +00:00
Jenkins
43466b922b Merge "Add configurable option for the user password length" 2017-07-20 12:18:56 +00:00
Adrian Vladu
8b6e7a4c84 Do not error out on empty cloud-config
If a cloud-config content is empty or it contains
a comment, cloudbase-init will error out.

This commit addresses this failure by throwing a
CloudConfigError that is caught later in the
execution chain.

Change-Id: Ifd209ca362e62b2fc6ce4e631fc9e77da8aca745
2017-07-06 15:08:52 +03:00
Adrian Vladu
6150a769ab Fixed all typos in comments
Change-Id: Ied9378d8bcf93a60800e3246ee360d2225742db6
2017-07-05 17:28:20 +03:00
Paula Madalina Crismaru
894b800d31 Add configurable option for the user password length
Add configurable option for the user password length of the user
defined by the `username` config option. The following parameter
has been added:
- user_password_length: type=int, default=20

The current default password length is 20, making it cumbersome for
users to enter the lengthy password via console.

Change-Id: I37ae75a438f6fd326101c7b8a855c1f39dd1e804
Closes-bug: #1684119
2017-07-05 17:18:43 +03:00
Jenkins
43cef17976 Merge "Fix the cloud-config keys that are processed by cloudbase-init" 2017-07-04 17:04:32 +00:00
Paula Madalina Crismaru
f92371bfdd Fix the cloud-config keys that are processed by cloudbase-init
Some of the keys of the currently supported cloud-config plugins are not
the same as the ones used by cloud-init. This patch adds the correct keys
for the cloud-config plugins.

Change-Id: I901acb330f934b6144ff69f4f65d6053dfb8fe1b
2017-07-03 11:21:05 +03:00
Paula Madalina Crismaru
2a5cd3a412 Adds support for all MIME Content-Transfer-Encodings
According to [1], Content-Transfer-Encoding can have one of the
following values (case insensitive): "BASE64" / "QUOTED-PRINTABLE" /
"8BIT"   / "7BIT" / "BINARY" / x-token.
Values "8bit", "7bit", and "binary" all imply that NO encoding has been
performed.
"x-token" refers to a custom implementation that can be done, where the
encoding agent and the decoding agent must agree upon. This case is not
addressed by the patch.
"QUOTED-PRINTABLE" and "base64" encodings are addressed by this patch,
and the decoding is performed for all the multipart content types
currently supported.

[1]https://www.w3.org/Protocols/rfc1341/5_Content-Transfer-Encoding.html

Change-Id: Iac29f3a287bd478f7f0b55d9911ae47f3a5890fb
Closes-Bug: #1696420
2017-06-13 11:56:59 +00:00
Jenkins
68a9ae57d4 Merge "Fixed infinite recursion when using serial ports" 2017-05-29 12:27:38 +00:00
Adrian Vladu
a8ab3abc56 Fixed infinite recursion when using serial ports
When using serial ports for logging, an infinite recursion occurs if the
serial port cannot be opened.

The solution is to add the serial port log handler only after the serial
port has been opened successfully.

Closes-bug: #1692888

Change-Id: Ifb2352292dd31869ee6d5ff83fe53584dd684ebd
2017-05-29 11:56:32 +00:00
Alessandro Pilotti
f1fb9e4414 Adds Azure guest agent plugin
Adds the Azure guest agent plugin which configures the
WindowsAzureGuestAgent, WindowsAzureTelemetryService and
RdAgent services.

Change-Id: I713c2b17bb083767272cefa2bf517ff1a0cbb992
Co-Authored-By: Stefan Caraiman <scaraiman@cloudbasesolutions.com>
Implements: blueprint add-azure-guest-plugin
2017-05-17 21:14:54 +03:00
Alessandro Pilotti
1581d6f946 Add Azure metadata service
The following patch implements the support for the Azure metadata service

Co-Authored-By: Paula Madalina Crismaru <pcrismaru@cloudbasesolutions.com>
Change-Id: I5da5152ed04c54a9777191defc10b4d7023313f5
Implements: blueprint azure-metadata-service
2017-05-17 19:10:52 +03:00
Alessandro Pilotti
0a695a8aa3 Return serialized certificate on certificate creation
Return serialized certificate on certificate creation besides the
thumbprint

Change-Id: I7b00445675a1d118ef78e1bbcef550e22ae5325f
Co-Authored-By: Paula Madalina Crismaru <pcrismaru@cloudbasesolutions.com>
2017-05-17 12:58:03 +00:00
Alessandro Pilotti
341930eb91 Add certificates plugin for Windows
Install all the certificates provided by the metadata.

Change-Id: Ida2550a10fa043e40b194db5d0db10692e716edf
Implements: add-certificates-plugin
Co-Authored-By: Paula Madalina Crismaru <pcrismaru@cloudbasesolutions.com>
2017-05-17 14:39:02 +03:00
Jenkins
a80aa83360 Merge "Adds EC2 userdata execution support" 2017-05-05 21:55:15 +00:00
Jenkins
33244dd4ff Merge "Add ephemeral disk plugin" 2017-05-05 21:47:19 +00:00
Alessandro Pilotti
4d46b6d081 Add ephemeral disk plugin
This plugin is implemented for Azure, and its purpose it's to copy a given
file on the specified partition, if the following options are configured:
- ephemeral_disk_volume_label: Ephemeral disk volume label
- ephemeral_disk_volume_mount_point: Ephemeral disk volume mount point
- ephemeral_disk_data_loss_warning_path: Ephemeral disk data loss warning path,
  relative to the ephemeral disk volume path

Change-Id: Ieadf5699f71deb22cb791324e3d32310be1e8bd5
Implements: add-ephemeral-disk-plugin
Co-Authored-By: Paula Madalina Crismaru <pcrismaru@cloudbasesolutions.com>
2017-04-27 18:00:03 +03:00
Paula Madalina Crismaru
f8db0d5333 Fixes unit tests to work with latest version of oslo.config
In version 4.0.0 of oslo.config the type of the values given in the
config file is verified to see if it corresponds with the type declared.
Some unit tests used values with different types for the config
parameters.

Change-Id: I013d0689d8adf832f97cbfb008463711df928cae
2017-04-27 12:52:33 +00:00
Paula Madalina Crismaru
e9dc79f08b Adds EC2 userdata execution support
Add support for executing userdata when using the EC2 metadata service.

Change-Id: Ie9896fb50eab6cf9c4803a92313cae1854aeeeba
Implements: blueprint user-data-support-for-aws
2017-04-10 13:40:46 +00:00
Alessandro Pilotti
834f19058c Add reporting provisioning status to the metadata service
Add support for reporting the provisioning status to the metadata
service.
The following config options have been added:
- metadata_report_provisioning_started: Reports to the metadata service
        that provisioning has started
        type=bool, default=False
- metadata_report_provisioning_completed: Reports to the metadata
        service that provisioning completed or failed
        type=bool, default=False

Change-Id: I23a5a8e5473dd103ce5e0acd0c4647cdec86f97f
Implements: blueprint add-reporting-provisioning-status-to-metadata-service
Co-Authored-By: Paula Madalina Crismaru <pcrismaru@cloudbasesolutions.com>
2017-03-29 15:14:55 +03:00
Jenkins
28c8cce1f9 Merge "Implemented automatic updates plugin" 2017-03-17 12:58:59 +00:00
Alessandro Pilotti
dc7699bc0e Implemented automatic updates plugin
Adds a plugin to configure Windows automatic updates.
The automatic updates configuration is retrieved
from the metadata service, or, if not set in the metadata,
from the config option "enable_automatic_updates".
The possible values for the config option are:
- Not set (None): no updates policy is configured
- True: updates are automatically installed
- False: updates are disabled on the system

Implements: blueprint windows-automated-updates-plugin
Co-Authored-By: Stefan Caraiman <scaraiman@cloudbasesolutions.com>
Co-Authored-By: Adrian Vladu <avladu@cloudbasesolutions.com>
Change-Id: Ida07a3a279321fe434a82a5123338679ec4506df
Signed-off-by: Stefan Caraiman <scaraiman@cloudbasesolutions.com>
2017-03-17 14:50:56 +02:00
Stefan Caraiman
8e5fff7016
Improve MIME multipart userdata handling
The 'exec_file' will now try to check for the headers inside the file, in
case that it doesn't recognize the format or no format has been provided.
Also the processing part of the user data now checks if the 'Content-Type' is
in the file instead of checking if the file starts with the header, in
order to comply with RFC2045.

Change-Id: I53fda9f5c17f35cb35d93a86434ecc4c7c579802
Closes-Bug: #1623393
Closes-Bug: #1672222
2017-03-13 15:57:46 +02:00
Stefan Caraiman
122a5c58bc Remove unnecessary print
Removes unnecessary print of an exception.

Change-Id: Ic8ccfb4a6f8c8c62a8b11c630aa4a87fecd340c6
2017-03-09 18:17:51 +02:00