From 0e59979ff84fca6caba3e0ead241ba69453115ef Mon Sep 17 00:00:00 2001 From: zhoxing-ms Date: Fri, 25 Jun 2021 16:57:46 +0800 Subject: [PATCH 1/4] Update from CoreOS to Flatcar --- doc/install_linux_prerequisites.md | 6 +++--- src/azure-cli/azure/cli/command_modules/vm/_alias.py | 12 ++++++------ .../azure/cli/command_modules/vm/_validators.py | 5 +++-- .../vm/tests/hybrid_2018_03_01/aliases.json | 12 ++++++------ .../vm/tests/hybrid_2018_03_01/test_vm_actions.py | 4 ++-- .../vm/tests/hybrid_2019_03_01/aliases.json | 12 ++++++------ .../vm/tests/hybrid_2019_03_01/test_vm_actions.py | 4 ++-- .../vm/tests/hybrid_2020_09_01/aliases.json | 12 ++++++------ .../vm/tests/hybrid_2020_09_01/test_vm_actions.py | 4 ++-- .../cli/command_modules/vm/tests/latest/aliases.json | 12 ++++++------ .../vm/tests/latest/test_vm_actions.py | 4 ++-- 11 files changed, 44 insertions(+), 43 deletions(-) diff --git a/doc/install_linux_prerequisites.md b/doc/install_linux_prerequisites.md index 1842b7c5382..1f4b5bf3487 100644 --- a/doc/install_linux_prerequisites.md +++ b/doc/install_linux_prerequisites.md @@ -25,7 +25,7 @@ The commands to run to install the dependencies for some common distributions ar * [6.7](#redhat-rhel-67) * [7.2](#redhat-rhel-72) * [SUSE](#suse-opensuse-132) -* [CoreOS](#coreos-stable-899150--beta-101010--alpha-101010) +* [Flatcar](#flatcar) ### Ubuntu 12.04 LTS Python 2.7.3 should be already on the machine. Install Python 3.6+ if needed. @@ -93,6 +93,6 @@ Python 2.7.8 should be already on the machine. Install Python 3.6+ if needed. sudo zypper refresh && sudo zypper --non-interactive install gcc libffi-devel python-devel openssl-devel ``` -### CoreOS Stable-899.15.0 / Beta-1010.1.0 / Alpha-1010.1.0 +### Flatcar -Python is not installed by default. +Python is installed in the Azure-specific distribution of Flatcar, but is installed into the non-standard location /usr/share/oem/python/bin/python. diff --git a/src/azure-cli/azure/cli/command_modules/vm/_alias.py b/src/azure-cli/azure/cli/command_modules/vm/_alias.py index 62809bbfe83..eaf4225b398 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_alias.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_alias.py @@ -24,18 +24,18 @@ "sku": "7.5", "version": "latest" }, - "CoreOS": { - "publisher": "CoreOS", - "offer": "CoreOS", - "sku": "Stable", - "version": "latest" - }, "Debian": { "publisher": "Debian", "offer": "debian-10", "sku": "10", "version": "latest" }, + "Flatcar": { + "publisher": "kinvolk", + "offer": "flatcar-container-linux-free", + "sku": "stable", + "version": "latest" + }, "openSUSE-Leap": { "publisher": "SUSE", "offer": "openSUSE-Leap", diff --git a/src/azure-cli/azure/cli/command_modules/vm/_validators.py b/src/azure-cli/azure/cli/command_modules/vm/_validators.py index 7397a9e5b12..8668804f46c 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_validators.py @@ -787,7 +787,7 @@ def _validate_vm_vmss_accelerated_networking(cli_ctx, namespace): return # VMs need to be a supported image in the marketplace - # Ubuntu 16.04 | 18.04, SLES 12 SP3, RHEL 7.4, CentOS 7.4, CoreOS Linux, Debian "Stretch" with backports kernel + # Ubuntu 16.04 | 18.04, SLES 12 SP3, RHEL 7.4, CentOS 7.4, Flatcar Linux, Debian "Stretch" with backports kernel # Oracle Linux 7.4, Windows Server 2016, Windows Server 2012R2 publisher, offer, sku = namespace.os_publisher, namespace.os_offer, namespace.os_sku if not publisher: @@ -795,7 +795,8 @@ def _validate_vm_vmss_accelerated_networking(cli_ctx, namespace): publisher, offer, sku = publisher.lower(), offer.lower(), sku.lower() distros = [('canonical', 'UbuntuServer', '^16.04|^18.04'), ('suse', 'sles', '^12-sp3'), ('redhat', 'rhel', '^7.4'), - ('openlogic', 'centos', '^7.4'), ('coreos', 'coreos', None), ('credativ', 'debian', '-backports'), + ('openlogic', 'centos', '^7.4'), ('kinvolk', 'flatcar-container-linux-free', None), + ('kinvolk', 'flatcar-container-linux', None), ('credativ', 'debian', '-backports'), ('oracle', 'oracle-linux', '^7.4'), ('MicrosoftWindowsServer', 'WindowsServer', '^2016'), ('MicrosoftWindowsServer', 'WindowsServer', '^2012-R2')] import re diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2018_03_01/aliases.json b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2018_03_01/aliases.json index db78eb36618..4a403e4922b 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2018_03_01/aliases.json +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2018_03_01/aliases.json @@ -20,18 +20,18 @@ "sku":"7.2", "version":"latest" }, - "CoreOS":{ - "publisher":"CoreOS", - "offer":"CoreOS", - "sku":"Stable", - "version":"latest" - }, "Debian":{ "publisher":"credativ", "offer":"Debian", "sku":"8", "version":"latest" }, + "Flatcar": { + "publisher": "kinvolk", + "offer": "flatcar-container-linux-free", + "sku": "stable", + "version": "latest" + }, "openSUSE":{ "publisher":"SUSE", "offer":"openSUSE", diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2018_03_01/test_vm_actions.py b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2018_03_01/test_vm_actions.py index a1b21d14068..7f95fe32334 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2018_03_01/test_vm_actions.py +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2018_03_01/test_vm_actions.py @@ -410,7 +410,7 @@ def test_validate_vm_vmss_accelerated_networking(self, client_factory_mock): np = mock.MagicMock() np.size = 'Standard_DS4_v2' np.accelerated_networking = None - np.os_publisher, np.os_offer, np.os_sku = 'coreos', 'coreos', 'alpha' + np.os_publisher, np.os_offer, np.os_sku = 'kinvolk', 'flatcar-container-linux-free', 'alpha' size_mock.number_of_cores, size_mock.name = 8, 'Standard_DS4_v2' _validate_vm_vmss_accelerated_networking(mock.MagicMock(), np) self.assertTrue(np.accelerated_networking) @@ -418,7 +418,7 @@ def test_validate_vm_vmss_accelerated_networking(self, client_factory_mock): np = mock.MagicMock() np.size = 'Standard_D3_v2' # known supported 4 core size np.accelerated_networking = None - np.os_publisher, np.os_offer, np.os_sku = 'coreos', 'coreos', 'alpha' + np.os_publisher, np.os_offer, np.os_sku = 'kinvolk', 'flatcar-container-linux-free', 'alpha' _validate_vm_vmss_accelerated_networking(None, np) self.assertTrue(np.accelerated_networking) diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2019_03_01/aliases.json b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2019_03_01/aliases.json index db78eb36618..4a403e4922b 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2019_03_01/aliases.json +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2019_03_01/aliases.json @@ -20,18 +20,18 @@ "sku":"7.2", "version":"latest" }, - "CoreOS":{ - "publisher":"CoreOS", - "offer":"CoreOS", - "sku":"Stable", - "version":"latest" - }, "Debian":{ "publisher":"credativ", "offer":"Debian", "sku":"8", "version":"latest" }, + "Flatcar": { + "publisher": "kinvolk", + "offer": "flatcar-container-linux-free", + "sku": "stable", + "version": "latest" + }, "openSUSE":{ "publisher":"SUSE", "offer":"openSUSE", diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2019_03_01/test_vm_actions.py b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2019_03_01/test_vm_actions.py index 303e48c7f96..fab47718200 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2019_03_01/test_vm_actions.py +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2019_03_01/test_vm_actions.py @@ -426,7 +426,7 @@ def test_validate_vm_vmss_accelerated_networking(self, client_factory_mock): np = mock.MagicMock() np.size = 'Standard_DS4_v2' np.accelerated_networking = None - np.os_publisher, np.os_offer, np.os_sku = 'coreos', 'coreos', 'alpha' + np.os_publisher, np.os_offer, np.os_sku = 'kinvolk', 'flatcar-container-linux-free', 'alpha' size_mock.number_of_cores, size_mock.name = 8, 'Standard_DS4_v2' _validate_vm_vmss_accelerated_networking(mock.MagicMock(), np) self.assertTrue(np.accelerated_networking) @@ -434,7 +434,7 @@ def test_validate_vm_vmss_accelerated_networking(self, client_factory_mock): np = mock.MagicMock() np.size = 'Standard_D3_v2' # known supported 4 core size np.accelerated_networking = None - np.os_publisher, np.os_offer, np.os_sku = 'coreos', 'coreos', 'alpha' + np.os_publisher, np.os_offer, np.os_sku = 'kinvolk', 'flatcar-container-linux-free', 'alpha' _validate_vm_vmss_accelerated_networking(None, np) self.assertTrue(np.accelerated_networking) diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/aliases.json b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/aliases.json index db78eb36618..4a403e4922b 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/aliases.json +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/aliases.json @@ -20,18 +20,18 @@ "sku":"7.2", "version":"latest" }, - "CoreOS":{ - "publisher":"CoreOS", - "offer":"CoreOS", - "sku":"Stable", - "version":"latest" - }, "Debian":{ "publisher":"credativ", "offer":"Debian", "sku":"8", "version":"latest" }, + "Flatcar": { + "publisher": "kinvolk", + "offer": "flatcar-container-linux-free", + "sku": "stable", + "version": "latest" + }, "openSUSE":{ "publisher":"SUSE", "offer":"openSUSE", diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/test_vm_actions.py b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/test_vm_actions.py index 303e48c7f96..fab47718200 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/test_vm_actions.py +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/hybrid_2020_09_01/test_vm_actions.py @@ -426,7 +426,7 @@ def test_validate_vm_vmss_accelerated_networking(self, client_factory_mock): np = mock.MagicMock() np.size = 'Standard_DS4_v2' np.accelerated_networking = None - np.os_publisher, np.os_offer, np.os_sku = 'coreos', 'coreos', 'alpha' + np.os_publisher, np.os_offer, np.os_sku = 'kinvolk', 'flatcar-container-linux-free', 'alpha' size_mock.number_of_cores, size_mock.name = 8, 'Standard_DS4_v2' _validate_vm_vmss_accelerated_networking(mock.MagicMock(), np) self.assertTrue(np.accelerated_networking) @@ -434,7 +434,7 @@ def test_validate_vm_vmss_accelerated_networking(self, client_factory_mock): np = mock.MagicMock() np.size = 'Standard_D3_v2' # known supported 4 core size np.accelerated_networking = None - np.os_publisher, np.os_offer, np.os_sku = 'coreos', 'coreos', 'alpha' + np.os_publisher, np.os_offer, np.os_sku = 'kinvolk', 'flatcar-container-linux-free', 'alpha' _validate_vm_vmss_accelerated_networking(None, np) self.assertTrue(np.accelerated_networking) diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/aliases.json b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/aliases.json index db78eb36618..4a403e4922b 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/aliases.json +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/aliases.json @@ -20,18 +20,18 @@ "sku":"7.2", "version":"latest" }, - "CoreOS":{ - "publisher":"CoreOS", - "offer":"CoreOS", - "sku":"Stable", - "version":"latest" - }, "Debian":{ "publisher":"credativ", "offer":"Debian", "sku":"8", "version":"latest" }, + "Flatcar": { + "publisher": "kinvolk", + "offer": "flatcar-container-linux-free", + "sku": "stable", + "version": "latest" + }, "openSUSE":{ "publisher":"SUSE", "offer":"openSUSE", diff --git a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_actions.py b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_actions.py index 3fd8e807c2a..daaccef9155 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_actions.py +++ b/src/azure-cli/azure/cli/command_modules/vm/tests/latest/test_vm_actions.py @@ -577,7 +577,7 @@ def test_validate_vm_vmss_accelerated_networking(self, client_factory_mock): np = mock.MagicMock() np.size = 'Standard_DS4_v2' np.accelerated_networking = None - np.os_publisher, np.os_offer, np.os_sku = 'coreos', 'coreos', 'alpha' + np.os_publisher, np.os_offer, np.os_sku = 'kinvolk', 'flatcar-container-linux-free', 'alpha' size_mock.number_of_cores, size_mock.name = 8, 'Standard_DS4_v2' _validate_vm_vmss_accelerated_networking(mock.MagicMock(), np) self.assertTrue(np.accelerated_networking) @@ -585,7 +585,7 @@ def test_validate_vm_vmss_accelerated_networking(self, client_factory_mock): np = mock.MagicMock() np.size = 'Standard_D3_v2' # known supported 4 core size np.accelerated_networking = None - np.os_publisher, np.os_offer, np.os_sku = 'coreos', 'coreos', 'alpha' + np.os_publisher, np.os_offer, np.os_sku = 'kinvolk', 'flatcar-container-linux-free', 'alpha' _validate_vm_vmss_accelerated_networking(None, np) self.assertTrue(np.accelerated_networking) From a9793a8bb1209cebd156f45dffb916789643b475 Mon Sep 17 00:00:00 2001 From: zhoxing Date: Thu, 1 Jul 2021 16:13:39 +0800 Subject: [PATCH 2/4] Add actionable error message for CoreOS --- src/azure-cli/azure/cli/command_modules/vm/_validators.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/azure-cli/azure/cli/command_modules/vm/_validators.py b/src/azure-cli/azure/cli/command_modules/vm/_validators.py index 8668804f46c..51ae4284a59 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_validators.py @@ -793,6 +793,12 @@ def _validate_vm_vmss_accelerated_networking(cli_ctx, namespace): if not publisher: return publisher, offer, sku = publisher.lower(), offer.lower(), sku.lower() + + if publisher == 'coreos' or offer == 'coreos': + from azure.cli.core.parser import InvalidArgumentValueError + raise InvalidArgumentValueError("As CoreOS is deprecated and there is no image in the marketplace any more," + " please use Flatcar linux instead of it.") + distros = [('canonical', 'UbuntuServer', '^16.04|^18.04'), ('suse', 'sles', '^12-sp3'), ('redhat', 'rhel', '^7.4'), ('openlogic', 'centos', '^7.4'), ('kinvolk', 'flatcar-container-linux-free', None), From 7f9638976e2640caca35d2abb1e347886effc8d2 Mon Sep 17 00:00:00 2001 From: zhoxing-ms Date: Fri, 2 Jul 2021 08:38:56 +0800 Subject: [PATCH 3/4] Refactor the name description for Flatcar --- src/azure-cli/azure/cli/command_modules/vm/_validators.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/azure-cli/azure/cli/command_modules/vm/_validators.py b/src/azure-cli/azure/cli/command_modules/vm/_validators.py index 51ae4284a59..dcbdf5ebe37 100644 --- a/src/azure-cli/azure/cli/command_modules/vm/_validators.py +++ b/src/azure-cli/azure/cli/command_modules/vm/_validators.py @@ -787,7 +787,7 @@ def _validate_vm_vmss_accelerated_networking(cli_ctx, namespace): return # VMs need to be a supported image in the marketplace - # Ubuntu 16.04 | 18.04, SLES 12 SP3, RHEL 7.4, CentOS 7.4, Flatcar Linux, Debian "Stretch" with backports kernel + # Ubuntu 16.04 | 18.04, SLES 12 SP3, RHEL 7.4, CentOS 7.4, Flatcar, Debian "Stretch" with backports kernel # Oracle Linux 7.4, Windows Server 2016, Windows Server 2012R2 publisher, offer, sku = namespace.os_publisher, namespace.os_offer, namespace.os_sku if not publisher: @@ -797,7 +797,7 @@ def _validate_vm_vmss_accelerated_networking(cli_ctx, namespace): if publisher == 'coreos' or offer == 'coreos': from azure.cli.core.parser import InvalidArgumentValueError raise InvalidArgumentValueError("As CoreOS is deprecated and there is no image in the marketplace any more," - " please use Flatcar linux instead of it.") + " please use Flatcar Container Linux instead.") distros = [('canonical', 'UbuntuServer', '^16.04|^18.04'), ('suse', 'sles', '^12-sp3'), ('redhat', 'rhel', '^7.4'), From 19388112a35beddc006baf13cee65a330e64e286 Mon Sep 17 00:00:00 2001 From: Xing Zhou Date: Fri, 2 Jul 2021 11:58:37 +0800 Subject: [PATCH 4/4] Update doc/install_linux_prerequisites.md Co-authored-by: Jiashuo Li <4003950+jiasli@users.noreply.github.com> --- doc/install_linux_prerequisites.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install_linux_prerequisites.md b/doc/install_linux_prerequisites.md index 1f4b5bf3487..78e5167996f 100644 --- a/doc/install_linux_prerequisites.md +++ b/doc/install_linux_prerequisites.md @@ -95,4 +95,4 @@ sudo zypper refresh && sudo zypper --non-interactive install gcc libffi-devel py ### Flatcar -Python is installed in the Azure-specific distribution of Flatcar, but is installed into the non-standard location /usr/share/oem/python/bin/python. +Python is installed in the Azure-specific distribution of Flatcar, but is installed into the non-standard location `/usr/share/oem/python/bin/python`.