sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #08788
[Merge] ~mfo/maas:3.0 into maas:3.0
Mauricio Faria de Oliveira has proposed merging ~mfo/maas:3.0 into maas:3.0.
Requested reviews:
Mauricio Faria de Oliveira (mfo)
For more details, see:
https://code.launchpad.net/~mfo/maas/+git/maas/+merge/443686
Please ignore this. It's just for unit tests.
--
Your team MAAS Committers is subscribed to branch maas:3.0.
diff --git a/debian/changelog b/debian/changelog
index 7c4cd20..00141ab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+maas (1:3.0.1-0ubuntu1) focal; urgency=medium
+
+ * New upstream release, MAAS 3.0.1.
+ - Revert "Add VMFS7 storage layout for VMware ESXi 7.0"
+ - Update maas-ui to 08f3762e1102 3.0 branch: select fixes only (for maas 3.0.1) (#4935)
+
+ -- Mauricio Faria de Oliveira <mfo@xxxxxxxxxxxxx> Fri, 26 May 2023 13:07:34 -0300
+
maas (1:3.0.0-0ubuntu1) focal; urgency=medium
* New upstream release, MAAS 3.0.0.
diff --git a/src/maasserver/forms/__init__.py b/src/maasserver/forms/__init__.py
index dbc5b79..5746a55 100644
--- a/src/maasserver/forms/__init__.py
+++ b/src/maasserver/forms/__init__.py
@@ -1,4 +1,4 @@
-# Copyright 2012-2021 Canonical Ltd. This software is licensed under the
+# Copyright 2012-2020 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Forms."""
@@ -154,7 +154,7 @@ from maasserver.models.blockdevice import MIN_BLOCK_DEVICE_SIZE
from maasserver.models.partition import MIN_PARTITION_SIZE
from maasserver.models.partitiontable import PARTITION_TABLE_TYPE_CHOICES
from maasserver.permissions import NodePermission, ResourcePoolPermission
-from maasserver.storage_layouts import VMFS6StorageLayout, VMFS7StorageLayout
+from maasserver.storage_layouts import VMFS6StorageLayout
from maasserver.utils.converters import machine_readable_bytes
from maasserver.utils.forms import (
compose_invalid_choice_text,
@@ -2777,7 +2777,7 @@ class FormatPartitionForm(Form):
cleaned_data = super().clean()
if self.partition.is_vmfs_partition():
set_form_error(
- self, "VMFS", "Base VMFS partitions may not be formatted."
+ self, "VMFS6", "VMFS6 partitions may not be formatted."
)
return cleaned_data
@@ -4085,18 +4085,16 @@ class CreateVMFSForm(CreateVolumeGroupForm):
"""For validating and saving a new VMFS group."""
def clean(self):
- """Validate that the VMFS storage layout is applied."""
+ """Validate that the VMFS6 storage layout is applied."""
cleaned_data = super().clean()
- vmfs6_layout = VMFS6StorageLayout(self.node)
- vmfs6_bd = vmfs6_layout.is_layout()
- vmfs7_layout = VMFS7StorageLayout(self.node)
- vmfs7_bd = vmfs7_layout.is_layout()
- if vmfs6_bd is None and vmfs7_bd is None:
+ vmfs_layout = VMFS6StorageLayout(self.node)
+ vmfs_bd = vmfs_layout.is_layout()
+ if vmfs_bd is None:
set_form_error(
self,
- "VMFS",
+ "VMFS6",
"VMFS Datastores may only be created after the "
- "VMFS6 or VMFS7 storage layout has been applied.",
+ "VMFS6 storage layout has been applied.",
)
return cleaned_data
diff --git a/src/maasserver/forms/tests/test_vmfs.py b/src/maasserver/forms/tests/test_vmfs.py
index d96c76b..21bd4ba 100644
--- a/src/maasserver/forms/tests/test_vmfs.py
+++ b/src/maasserver/forms/tests/test_vmfs.py
@@ -1,42 +1,40 @@
-# Copyright 2019-2021 Canonical Ltd. This software is licensed under the
+# Copyright 2019 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for all forms that are used with `VMFS`."""
-import random
import uuid
from maasserver.enum import FILESYSTEM_TYPE
from maasserver.forms import CreateVMFSForm, UpdateVMFSForm
from maasserver.models.blockdevice import MIN_BLOCK_DEVICE_SIZE
from maasserver.models.partitiontable import PARTITION_TABLE_EXTRA_SPACE
-from maasserver.storage_layouts import VMFS6StorageLayout, VMFS7StorageLayout
+from maasserver.storage_layouts import VMFS6StorageLayout
from maasserver.testing.factory import factory
from maasserver.testing.testcase import MAASServerTestCase
from maasserver.tests.test_storage_layouts import LARGE_BLOCK_DEVICE
-def make_Node_with_VMFS_layout(*args, **kwargs):
- """Create a node with the VMFS storage layout applied."""
+def make_Node_with_VMFS6_layout(*args, **kwargs):
+ """Create a node with the VMFS6 storage layout applied."""
kwargs["with_boot_disk"] = False
node = factory.make_Node(*args, **kwargs)
factory.make_PhysicalBlockDevice(node=node, size=LARGE_BLOCK_DEVICE)
- layout_class = random.choice([VMFS6StorageLayout, VMFS7StorageLayout])
- layout = layout_class(node)
+ layout = VMFS6StorageLayout(node)
layout.configure()
return node
class TestCreateVMFSForm(MAASServerTestCase):
def test_requires_fields(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
form = CreateVMFSForm(node, data={})
self.assertFalse(form.is_valid(), form.errors)
self.assertItemsEqual(["name"], form.errors.keys())
def test_is_not_valid_if_invalid_uuid(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
block_device = factory.make_PhysicalBlockDevice(node=node)
data = {
"name": factory.make_name("name"),
@@ -50,7 +48,7 @@ class TestCreateVMFSForm(MAASServerTestCase):
self.assertEqual({"uuid": ["Enter a valid value."]}, form._errors)
def test_is_not_valid_missing_block_devices_and_partitions(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
data = {"name": factory.make_name("name"), "uuid": uuid.uuid4()}
form = CreateVMFSForm(node, data=data)
self.assertFalse(
@@ -68,7 +66,7 @@ class TestCreateVMFSForm(MAASServerTestCase):
)
def test_is_not_valid_if_block_device_does_not_belong_to_node(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
block_device = factory.make_PhysicalBlockDevice()
data = {
"name": factory.make_name("name"),
@@ -91,7 +89,7 @@ class TestCreateVMFSForm(MAASServerTestCase):
)
def test_is_not_valid_if_partition_does_not_belong_to_node(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
partition = factory.make_Partition()
data = {
"name": factory.make_name("name"),
@@ -122,10 +120,10 @@ class TestCreateVMFSForm(MAASServerTestCase):
}
form = CreateVMFSForm(node, data=data)
self.assertFalse(form.is_valid())
- self.assertIn("VMFS", form.errors)
+ self.assertIn("VMFS6", form.errors)
def test_creates_volume_group_with_block_devices(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
block_devices = [
factory.make_PhysicalBlockDevice(node=node) for _ in range(3)
]
@@ -146,7 +144,7 @@ class TestCreateVMFSForm(MAASServerTestCase):
)
def test_creates_with_block_devices_by_name(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
block_devices = [
factory.make_PhysicalBlockDevice(node=node) for _ in range(3)
]
@@ -169,7 +167,7 @@ class TestCreateVMFSForm(MAASServerTestCase):
)
def test_creates_with_partitions(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
block_device = factory.make_PhysicalBlockDevice(
node=node,
size=(MIN_BLOCK_DEVICE_SIZE * 3) + PARTITION_TABLE_EXTRA_SPACE,
@@ -192,7 +190,7 @@ class TestCreateVMFSForm(MAASServerTestCase):
)
def test_creates_with_partitions_by_name(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
block_device = factory.make_PhysicalBlockDevice(
node=node,
size=(MIN_BLOCK_DEVICE_SIZE * 3) + PARTITION_TABLE_EXTRA_SPACE,
@@ -250,7 +248,7 @@ class TestUpdateVMFSForm(MAASServerTestCase):
self.assertEqual(new_uuid, vmfs.uuid)
def test_adds_block_device(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
vmfs = factory.make_VMFS(node=node)
block_device = factory.make_PhysicalBlockDevice(node=node)
data = {"add_block_devices": [block_device.id]}
@@ -263,7 +261,7 @@ class TestUpdateVMFSForm(MAASServerTestCase):
)
def test_adds_block_device_by_name(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
vmfs = factory.make_VMFS(node=node)
block_device = factory.make_PhysicalBlockDevice(node=node)
data = {"add_block_devices": [block_device.name]}
@@ -276,7 +274,7 @@ class TestUpdateVMFSForm(MAASServerTestCase):
)
def test_adds_partition(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
vmfs = factory.make_VMFS(node=node)
block_device = factory.make_PhysicalBlockDevice(node=node)
partition_table = factory.make_PartitionTable(
@@ -292,7 +290,7 @@ class TestUpdateVMFSForm(MAASServerTestCase):
)
def test_adds_partition_by_name(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
vmfs = factory.make_VMFS(node=node)
block_device = factory.make_PhysicalBlockDevice(node=node)
partition_table = factory.make_PartitionTable(
@@ -308,7 +306,7 @@ class TestUpdateVMFSForm(MAASServerTestCase):
)
def test_removes_partition(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
vmfs = factory.make_VMFS(node=node)
block_device = factory.make_PhysicalBlockDevice(node=node)
partition_table = factory.make_PartitionTable(
@@ -327,7 +325,7 @@ class TestUpdateVMFSForm(MAASServerTestCase):
self.assertIsNone(partition.get_effective_filesystem())
def test_removes_partition_by_name(self):
- node = make_Node_with_VMFS_layout()
+ node = make_Node_with_VMFS6_layout()
vmfs = factory.make_VMFS(node=node)
block_device = factory.make_PhysicalBlockDevice(node=node)
partition_table = factory.make_PartitionTable(
diff --git a/src/maasserver/models/node.py b/src/maasserver/models/node.py
index 0bf7d83..b61ccbb 100644
--- a/src/maasserver/models/node.py
+++ b/src/maasserver/models/node.py
@@ -160,7 +160,6 @@ from maasserver.storage_layouts import (
StorageLayoutError,
StorageLayoutMissingBootDiskError,
VMFS6StorageLayout,
- VMFS7StorageLayout,
)
from maasserver.utils.dns import validate_hostname
from maasserver.utils.mac import get_vendor_for_mac
@@ -1516,10 +1515,8 @@ class Node(CleanSave, TimestampedModel):
# layout is created with a datastore. If the user applied the VMFS
# storage layout a datastore must be defined as one will always be
# created.
- if (
- VMFS6StorageLayout(self).is_layout()
- or VMFS7StorageLayout(self).is_layout()
- ):
+ vmfs_layout = VMFS6StorageLayout(self)
+ if vmfs_layout.is_layout() is not None:
fs_groups = self.virtualblockdevice_set.filter(
filesystem_group__group_type=FILESYSTEM_GROUP_TYPE.VMFS6
)
diff --git a/src/maasserver/models/partition.py b/src/maasserver/models/partition.py
index 62895f8..09e3cb4 100644
--- a/src/maasserver/models/partition.py
+++ b/src/maasserver/models/partition.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2021 Canonical Ltd. This software is licensed under the
+# Copyright 2015-2019 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Model for a partition in a partition table."""
@@ -206,10 +206,7 @@ class Partition(CleanSave, TimestampedModel):
def get_partition_number(self):
"""Return the partition number in the table."""
# Avoid circular imports.
- from maasserver.storage_layouts import (
- VMFS6StorageLayout,
- VMFS7StorageLayout,
- )
+ from maasserver.storage_layouts import VMFS6StorageLayout
# Sort manually instead of with `order_by`, this will prevent django
# from making a query if the partitions are already cached.
@@ -226,26 +223,18 @@ class Partition(CleanSave, TimestampedModel):
boot_disk = node.get_boot_disk()
bios_boot_method = node.get_bios_boot_method()
block_device = self.partition_table.block_device
- vmfs6_layout = VMFS6StorageLayout(self.get_node())
- vmfs6_bd = vmfs6_layout.is_layout()
- vmfs7_layout = VMFS7StorageLayout(self.get_node())
- vmfs7_bd = vmfs7_layout.is_layout()
- # VMware ESXi is a DD image but MAAS allows partitions to
- # be added to the end of the disk as well as resize the
- # datastore partition. The EFI partition is already in the
- # image so there is no reason to account for it.
- if vmfs6_bd is not None:
- if vmfs6_bd.id == block_device.id and idx >= 3:
- # VMware ESXi 6.7 skips the 4th partition.
+ vmfs_layout = VMFS6StorageLayout(self.get_node())
+ vmfs_bd = vmfs_layout.is_layout()
+ if vmfs_bd is not None:
+ # VMware ESXi is a DD image but MAAS allows partitions to
+ # be added to the end of the disk as well as resize the
+ # datastore partition. The EFI partition is already in the
+ # image so there is no reason to account for it.
+ if vmfs_bd.id == block_device.id and idx >= 3:
+ # VMware ESXi skips the 4th partition.
return idx + 2
else:
return idx + 1
- elif vmfs7_bd is not None:
- if vmfs7_bd.id == block_device.id and idx >= 1:
- # VMware ESXi 7.0 skips the partitions 2-4.
- return idx + 4
- else:
- return idx + 1
elif arch == "ppc64el" and block_device.id == boot_disk.id:
return idx + 2
elif arch == "amd64" and bios_boot_method != "uefi":
@@ -352,7 +341,7 @@ class Partition(CleanSave, TimestampedModel):
}
)
- def is_vmfs6_partition(self):
+ def is_vmfs_partition(self):
# Avoid circular imports.
from maasserver.storage_layouts import VMFS6StorageLayout
@@ -370,27 +359,6 @@ class Partition(CleanSave, TimestampedModel):
return False
return True
- def is_vmfs7_partition(self):
- # Avoid circular imports.
- from maasserver.storage_layouts import VMFS7StorageLayout
-
- vmfs_layout = VMFS7StorageLayout(self.get_node())
- vmfs_bd = vmfs_layout.is_layout()
- if vmfs_bd is None:
- return False
- if vmfs_bd.id != self.partition_table.block_device_id:
- return False
- if self.get_partition_number() < len(vmfs_layout.base_partitions) + 3:
- # A user may apply the VMFS7 layout and leave space at the end of
- # the disk for additional VMFS datastores. Those partitions may be
- # deleted, the base partitions may not as they are part of the DD.
- # The + 3 is to account for partition 2-4 being skipped.
- return True
- return False
-
- def is_vmfs_partition(self):
- return self.is_vmfs6_partition() or self.is_vmfs7_partition()
-
def delete(self):
"""Delete the partition.
diff --git a/src/maasserver/models/tests/test_node.py b/src/maasserver/models/tests/test_node.py
index eff9617..669eeb4 100644
--- a/src/maasserver/models/tests/test_node.py
+++ b/src/maasserver/models/tests/test_node.py
@@ -140,7 +140,6 @@ from maasserver.storage_layouts import (
StorageLayoutError,
StorageLayoutMissingBootDiskError,
VMFS6StorageLayout,
- VMFS7StorageLayout,
)
from maasserver.testing.eventloop import (
RegionEventLoopFixture,
@@ -9400,8 +9399,7 @@ class TestNode_Start(MAASTransactionServerTestCase):
osystem="esxi", distro_series="6.7", with_boot_disk=False
)
factory.make_PhysicalBlockDevice(node=node, size=(100 * 1024 ** 3))
- layout_class = random.choice([VMFS6StorageLayout, VMFS7StorageLayout])
- layout = layout_class(node)
+ layout = VMFS6StorageLayout(node)
layout.configure()
self.assertItemsEqual([], node.storage_layout_issues())
@@ -9410,8 +9408,7 @@ class TestNode_Start(MAASTransactionServerTestCase):
osystem="esxi", distro_series="6.7", with_boot_disk=False
)
factory.make_PhysicalBlockDevice(node=node, size=(100 * 1024 ** 3))
- layout_class = random.choice([VMFS6StorageLayout, VMFS7StorageLayout])
- layout = layout_class(node)
+ layout = VMFS6StorageLayout(node)
layout.configure()
node.virtualblockdevice_set.delete()
self.assertEqual(
@@ -9425,8 +9422,7 @@ class TestNode_Start(MAASTransactionServerTestCase):
with_boot_disk=False,
)
factory.make_PhysicalBlockDevice(node=node, size=(100 * 1024 ** 3))
- layout_class = random.choice([VMFS6StorageLayout, VMFS7StorageLayout])
- layout = layout_class(node)
+ layout = VMFS6StorageLayout(node)
layout.configure()
self.assertItemsEqual(
[
diff --git a/src/maasserver/models/tests/test_partition.py b/src/maasserver/models/tests/test_partition.py
index efb6b00..de94701 100644
--- a/src/maasserver/models/tests/test_partition.py
+++ b/src/maasserver/models/tests/test_partition.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2021 Canonical Ltd. This software is licensed under the
+# Copyright 2015-2019 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Tests for `Partition`."""
@@ -29,7 +29,7 @@ from maasserver.models.partitiontable import (
PARTITION_TABLE_EXTRA_SPACE,
PREP_PARTITION_SIZE,
)
-from maasserver.storage_layouts import VMFS6StorageLayout, VMFS7StorageLayout
+from maasserver.storage_layouts import VMFS6StorageLayout
from maasserver.testing.factory import factory
from maasserver.testing.testcase import MAASServerTestCase
from maasserver.tests.test_storage_layouts import LARGE_BLOCK_DEVICE
@@ -470,7 +470,7 @@ class TestPartition(MAASServerTestCase):
self.expectThat(idx, Equals(partition.get_partition_number()))
idx += 1
- def test_get_partition_number_returns_vmfs6_order(self):
+ def test_get_partition_number_returns_vmfs_order(self):
node = factory.make_Node(with_boot_disk=False)
bd = factory.make_PhysicalBlockDevice(
node=node, size=LARGE_BLOCK_DEVICE
@@ -483,19 +483,6 @@ class TestPartition(MAASServerTestCase):
[part.get_partition_number() for part in pt.partitions.all()],
)
- def test_get_partition_number_returns_vmfs7_order(self):
- node = factory.make_Node(with_boot_disk=False)
- bd = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node)
- layout.configure()
- pt = bd.get_partitiontable()
- self.assertItemsEqual(
- [1, 5, 6, 7, 8],
- [part.get_partition_number() for part in pt.partitions.all()],
- )
-
def test_get_partition_number_returns_starting_at_2_for_amd64_gpt(self):
node = factory.make_Node(
architecture="amd64/generic",
@@ -543,7 +530,7 @@ class TestPartition(MAASServerTestCase):
# Skip the extended partition.
idx += 1
- def test_is_vmfs6_partition(self):
+ def test_is_vmfs_partition(self):
node = factory.make_Node(with_boot_disk=False)
bd = factory.make_PhysicalBlockDevice(
node=node, size=LARGE_BLOCK_DEVICE
@@ -552,45 +539,13 @@ class TestPartition(MAASServerTestCase):
layout.configure()
pt = bd.get_partitiontable()
for partition in pt.partitions.all():
- self.assertTrue(partition.is_vmfs6_partition())
-
- def test_is_vmfs7_partition(self):
- node = factory.make_Node(with_boot_disk=False)
- bd = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node)
- layout.configure()
- pt = bd.get_partitiontable()
- for partition in pt.partitions.all():
- if partition.get_partition_number() >= 8:
- self.assertFalse(partition.is_vmfs7_partition())
- else:
- self.assertTrue(partition.is_vmfs7_partition())
-
- def test_is_vmfs_partition(self):
- node = factory.make_Node(with_boot_disk=False)
- bd = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- vmfs_layout = random.choice([VMFS6StorageLayout, VMFS7StorageLayout])
- layout = vmfs_layout(node)
- layout_name = layout.configure()
- pt = bd.get_partitiontable()
- for partition in pt.partitions.all():
- if (
- layout_name == "VMFS7"
- and partition.get_partition_number() >= 8
- ):
- self.assertFalse(partition.is_vmfs_partition())
- else:
- self.assertTrue(partition.is_vmfs_partition())
+ self.assertTrue(partition.is_vmfs_partition())
def test_is_vmfs_partition_false_no_vmfs(self):
partition = factory.make_Partition()
self.assertFalse(partition.is_vmfs_partition())
- def test_is_vmfs6_partition_false_different_block_device(self):
+ def test_is_vmfs_partition_false_different_block_device(self):
node = factory.make_Node(with_boot_disk=False)
factory.make_PhysicalBlockDevice(node=node, size=LARGE_BLOCK_DEVICE)
layout = VMFS6StorageLayout(node)
@@ -598,15 +553,7 @@ class TestPartition(MAASServerTestCase):
other_bd_part = factory.make_Partition(node=node)
self.assertFalse(other_bd_part.is_vmfs_partition())
- def test_is_vmfs7_partition_false_different_block_device(self):
- node = factory.make_Node(with_boot_disk=False)
- factory.make_PhysicalBlockDevice(node=node, size=LARGE_BLOCK_DEVICE)
- layout = VMFS7StorageLayout(node)
- layout.configure()
- other_bd_part = factory.make_Partition(node=node)
- self.assertFalse(other_bd_part.is_vmfs_partition())
-
- def test_is_vmfs6_partition_false_extra_partition(self):
+ def test_is_vmfs_partition_false_extra_partition(self):
node = factory.make_Node(with_boot_disk=False)
bd = factory.make_PhysicalBlockDevice(
node=node, size=LARGE_BLOCK_DEVICE
@@ -617,17 +564,6 @@ class TestPartition(MAASServerTestCase):
extra_partition = pt.add_partition()
self.assertFalse(extra_partition.is_vmfs_partition())
- def test_is_vmfs7_partition_false_extra_partition(self):
- node = factory.make_Node(with_boot_disk=False)
- bd = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node, {"root_size": 10 * 1024 ** 3})
- layout.configure()
- pt = bd.get_partitiontable()
- extra_partition = pt.add_partition()
- self.assertFalse(extra_partition.is_vmfs_partition())
-
def test_delete_not_allowed_if_part_of_filesystem_group(self):
partition = factory.make_Partition(
size=1024 ** 3, block_device_size=2 * 1024 ** 3
@@ -641,7 +577,7 @@ class TestPartition(MAASServerTestCase):
error.message,
)
- def test_delete_not_allowed_if_part_of_vmfs6_layout(self):
+ def test_delete_not_allowed_if_part_of_vmfs_layout(self):
node = factory.make_Node(with_boot_disk=False)
bd = factory.make_PhysicalBlockDevice(
node=node, size=LARGE_BLOCK_DEVICE
@@ -652,17 +588,6 @@ class TestPartition(MAASServerTestCase):
partition = random.choice(list(pt.partitions.all()))
self.assertRaises(ValidationError, partition.delete)
- def test_delete_not_allowed_if_part_of_vmfs7_layout(self):
- node = factory.make_Node(with_boot_disk=False)
- bd = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node)
- layout.configure()
- pt = bd.get_partitiontable()
- partition = random.choice(list(pt.partitions.all()))
- self.assertRaises(ValidationError, partition.delete)
-
def test_delete(self):
partition = factory.make_Partition()
partition.delete()
diff --git a/src/maasserver/storage_layouts.py b/src/maasserver/storage_layouts.py
index 52dd20e..467ca87 100644
--- a/src/maasserver/storage_layouts.py
+++ b/src/maasserver/storage_layouts.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2021 Canonical Ltd. This software is licensed under the
+# Copyright 2015-2019 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Storage layouts."""
@@ -812,7 +812,7 @@ class VMFS6StorageLayout(StorageLayoutBase):
def clean(self):
cleaned_data = super().clean()
if self.boot_disk.size < 1024 ** 3:
- set_form_error(self, "size", "Boot disk must be at least 10G.")
+ set_form_error(self, "size", "Boot disk must be atleast 10G.")
return cleaned_data
def configure_storage(self, allow_fallback):
@@ -870,8 +870,6 @@ class VMFS6StorageLayout(StorageLayoutBase):
for i, (partition, base_partition) in enumerate(
zip(ordered_partitions, self.base_partitions)
):
- if (i + 1) == len(self.base_partitions):
- return bd
if partition.bootable != base_partition.get("bootable", False):
break
# Skip checking the size of the Datastore partition as that
@@ -880,42 +878,11 @@ class VMFS6StorageLayout(StorageLayoutBase):
continue
if partition.size != base_partition["size"]:
break
+ if (i + 1) == len(self.base_partitions):
+ return bd
return None
-class VMFS7StorageLayout(VMFS6StorageLayout):
- """VMFS7 layout.
-
- The VMware ESXi 7+ image is a DD. The image has 5 partitions which are
- in order but not linear. Users may only change the last partition which
- is partition 8 and stored at the end of the disk.
-
- NAME PARTITION SIZE START BLOCK END BLOCK
- EFI System 1 105MB 0 105
- Basic Data 5 1074MB 106 1180
- Basic Data 6 1074MB 1181 2255
- VMFSL 7 8.5GB 2256 10959
- VMFS 8 Remaining 10960 End of disk
- """
-
- base_partitions = [
- # EFI System
- {"size": 105 * 1024 ** 2, "bootable": True},
- # Basic Data
- {"size": 1074 * 1024 ** 2},
- # Basic Data
- {"size": 1074 * 1024 ** 2},
- # VMFSL
- {"size": 8704 * 1024 ** 2},
- # VMFS
- {"size": 0},
- ]
-
- def configure_storage(self, allow_fallback):
- super().configure_storage(allow_fallback)
- return "VMFS7"
-
-
class BlankStorageLayout(StorageLayoutBase):
"""Blank layout.
@@ -947,7 +914,6 @@ STORAGE_LAYOUTS = {
"lvm": ("LVM layout", LVMStorageLayout),
"bcache": ("Bcache layout", BcacheStorageLayout),
"vmfs6": ("VMFS6 layout", VMFS6StorageLayout),
- "vmfs7": ("VMFS7 layout", VMFS7StorageLayout),
"blank": ("No storage (blank) layout", BlankStorageLayout),
}
diff --git a/src/maasserver/tests/test_storage_layouts.py b/src/maasserver/tests/test_storage_layouts.py
index c85425b..29dcffa 100644
--- a/src/maasserver/tests/test_storage_layouts.py
+++ b/src/maasserver/tests/test_storage_layouts.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2021 Canonical Ltd. This software is licensed under the
+# Copyright 2015-2019 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Test the storage layouts."""
@@ -42,7 +42,6 @@ from maasserver.storage_layouts import (
StorageLayoutForm,
StorageLayoutMissingBootDiskError,
VMFS6StorageLayout,
- VMFS7StorageLayout,
)
from maasserver.testing.factory import factory
from maasserver.testing.testcase import MAASServerTestCase
@@ -87,7 +86,6 @@ class TestFormHelpers(MAASServerTestCase):
("lvm", "LVM layout"),
("bcache", "Bcache layout"),
("vmfs6", "VMFS6 layout"),
- ("vmfs7", "VMFS7 layout"),
("blank", "No storage (blank) layout"),
],
get_storage_layout_choices(),
@@ -1886,7 +1884,7 @@ class TestVMFS6StorageLayout(MAASServerTestCase):
layout = VMFS6StorageLayout(node)
error = self.assertRaises(StorageLayoutFieldsError, layout.configure)
self.assertEqual(
- {"size": ["Boot disk must be at least 10G."]}, error.message_dict
+ {"size": ["Boot disk must be atleast 10G."]}, error.message_dict
)
def test_accepts_root_device_param(self):
@@ -1984,139 +1982,6 @@ class TestVMFS6StorageLayout(MAASServerTestCase):
self.assertIsNone(vmfs_layout.is_layout(), layout_name)
-class TestVMFS7StorageLayout(MAASServerTestCase):
- def test_init_sets_up_all_fields(self):
- node = factory.make_Node(with_boot_disk=False)
- factory.make_PhysicalBlockDevice(node=node, size=LARGE_BLOCK_DEVICE)
- layout = VMFS7StorageLayout(node)
- self.assertItemsEqual(
- ["root_device", "root_size", "boot_size"], layout.fields.keys()
- )
-
- def test_creates_layout(self):
- node = factory.make_Node(with_boot_disk=False)
- node.boot_disk = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node)
- self.assertEqual("VMFS7", layout.configure())
- pt = node.boot_disk.get_partitiontable()
- self.assertDictEqual(
- {
- "%s-part1" % node.boot_disk.name: 105 * 1024 ** 2,
- "%s-part5" % node.boot_disk.name: 1074 * 1024 ** 2,
- "%s-part6" % node.boot_disk.name: 1074 * 1024 ** 2,
- "%s-part7" % node.boot_disk.name: 8704 * 1024 ** 2,
- "%s-part8"
- % node.boot_disk.name: (
- node.boot_disk.size
- - 105 * 1024 ** 2
- - 1074 * 1024 ** 2
- - 1074 * 1024 ** 2
- - 8704 * 1024 ** 2
- - 7 * 1024 ** 2
- ),
- },
- {part.name: part.size for part in pt.partitions.all()},
- )
-
- def test_clean_validates_min_size(self):
- node = factory.make_Node(with_boot_disk=False)
- node.boot_disk = factory.make_PhysicalBlockDevice(
- node=node, size=1024 ** 3 - 1
- )
- layout = VMFS7StorageLayout(node)
- error = self.assertRaises(StorageLayoutFieldsError, layout.configure)
- self.assertEqual(
- {"size": ["Boot disk must be at least 10G."]}, error.message_dict
- )
-
- def test_accepts_root_device_param(self):
- # Regression test for LP:1825241
- node = factory.make_Node(with_boot_disk=False)
- node.boot_disk = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- root_disk = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node, {"root_device": root_disk.id})
- self.assertEqual("VMFS7", layout.configure())
- pt = root_disk.get_partitiontable()
- self.assertDictEqual(
- {
- "%s-part1" % root_disk.name: 105 * 1024 ** 2,
- "%s-part5" % root_disk.name: 1074 * 1024 ** 2,
- "%s-part6" % root_disk.name: 1074 * 1024 ** 2,
- "%s-part7" % root_disk.name: 8704 * 1024 ** 2,
- "%s-part8"
- % root_disk.name: (
- root_disk.size
- - 105 * 1024 ** 2
- - 1074 * 1024 ** 2
- - 1074 * 1024 ** 2
- - 8704 * 1024 ** 2
- - 7 * 1024 ** 2
- ),
- },
- {part.name: part.size for part in pt.partitions.all()},
- )
-
- def test_accepts_root_size_param(self):
- node = factory.make_Node(with_boot_disk=False)
- node.boot_disk = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node, {"root_size": 10 * 1024 ** 3})
- self.assertEqual("VMFS7", layout.configure())
- pt = node.boot_disk.get_partitiontable()
- self.assertDictEqual(
- {
- "%s-part1" % node.boot_disk.name: 105 * 1024 ** 2,
- "%s-part5" % node.boot_disk.name: 1074 * 1024 ** 2,
- "%s-part6" % node.boot_disk.name: 1074 * 1024 ** 2,
- "%s-part7" % node.boot_disk.name: 8704 * 1024 ** 2,
- "%s-part8" % node.boot_disk.name: 10 * 1024 ** 3,
- },
- {part.name: part.size for part in pt.partitions.all()},
- )
-
- def test_is_layout(self):
- node = make_Node_with_uefi_boot_method()
- bd = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node)
- layout.configure()
- self.assertEqual(bd, layout.is_layout())
-
- def test_is_layout_without_datastore(self):
- node = make_Node_with_uefi_boot_method()
- bd = factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE
- )
- layout = VMFS7StorageLayout(node)
- layout.configure()
- # A user can delete the VMFS Datastore but the layout should still
- # be detected for the UI.
- node.virtualblockdevice_set.delete()
- self.assertEqual(bd, layout.is_layout())
-
- def test_is_layout_returns_none_when_not_found(self):
- node = make_Node_with_uefi_boot_method()
- factory.make_PhysicalBlockDevice(node=node, size=LARGE_BLOCK_DEVICE)
- factory.make_PhysicalBlockDevice(
- node=node, size=LARGE_BLOCK_DEVICE, tags=["ssd"]
- )
- for layout_name, layout_class in STORAGE_LAYOUTS.values():
- if layout_class == VMFS7StorageLayout:
- continue
- layout = layout_class(node)
- layout.configure()
- vmfs_layout = VMFS7StorageLayout(node)
- self.assertIsNone(vmfs_layout.is_layout(), layout_name)
-
-
class TestBlankStorageLayout(MAASServerTestCase):
def __init__(self, *args, **kwargs):
# Make sure any existing storage layout can be cleared.
diff --git a/src/maasserver/websockets/handlers/tests/test_machine.py b/src/maasserver/websockets/handlers/tests/test_machine.py
index 8adacc4..8c7493b 100644
--- a/src/maasserver/websockets/handlers/tests/test_machine.py
+++ b/src/maasserver/websockets/handlers/tests/test_machine.py
@@ -14,7 +14,6 @@ from django.core.exceptions import ValidationError
from django.http import HttpRequest
from lxml import etree
from testtools import ExpectedException
-from testtools.content import text_content
from testtools.matchers import (
ContainsDict,
Equals,
@@ -3503,16 +3502,14 @@ class TestMachineHandler(MAASServerTestCase):
handler = MachineHandler(user, {}, None)
node = factory.make_Node(with_boot_disk=False)
node.boot_disk = factory.make_PhysicalBlockDevice(
- node=node, size=40 * 1024 ** 3
+ node=node, size=10 * 1024 ** 3
)
- factory.make_PhysicalBlockDevice(node=node, size=20 * 1024 ** 3)
- storage_layout = factory.pick_choice(
- get_storage_layout_choices(), but_not=("blank",)
- )
- self.addDetail("storage_layout", text_content(storage_layout))
+ factory.make_PhysicalBlockDevice(node=node, size=10 * 2024 ** 3)
params = {
"system_id": node.system_id,
- "storage_layout": storage_layout,
+ "storage_layout": factory.pick_choice(
+ get_storage_layout_choices(), but_not="blank"
+ ),
}
handler.apply_storage_layout(params)
self.assertTrue(node.boot_disk.partitiontable_set.exists())
diff --git a/src/maasui/src b/src/maasui/src
index 545f413..08f3762 160000
--- a/src/maasui/src
+++ b/src/maasui/src
@@ -1 +1 @@
-Subproject commit 545f41330490b1bbfe3dca0bf30ba637d883dbc0
+Subproject commit 08f3762e110260bfd11deef2385c1134af864d01
Follow ups