Merge ~troyanov/maas:revert-1938296 into maas:master

Proposed by Anton Troyanov
Status: Merged
Approved by: Anton Troyanov
Approved revision: 8234de2908a66a379d8491cc9ae1c94b5ecaf968
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~troyanov/maas:revert-1938296
Merge into: maas:master
Diff against target: 195 lines (+14/-57)
6 files modified
src/maasserver/forms/__init__.py (+3/-3)
src/maasserver/forms/tests/test_blockdevice.py (+1/-2)
src/maasserver/models/filesystemgroup.py (+0/-4)
src/maasserver/models/tests/test_filesystemgroup.py (+0/-29)
src/maasserver/models/tests/test_node.py (+3/-4)
src/maasserver/tests/test_preseed_storage.py (+7/-15)
Reviewer Review Type Date Requested Status
Alberto Donato Approve
MAAS Lander Approve
Review via email: mp+427677@code.launchpad.net

Commit message

Revert "fix RAID device available space reporting"

This reverts commit 47edd13773def85a776d5c517e0dc9830c30f91b.

LP:1981536

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b revert-1938296 lp:~troyanov/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 8234de2908a66a379d8491cc9ae1c94b5ecaf968

review: Approve
Revision history for this message
Alberto Donato (ack) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/maasserver/forms/__init__.py b/src/maasserver/forms/__init__.py
index 59b1b12..e99ad29 100644
--- a/src/maasserver/forms/__init__.py
+++ b/src/maasserver/forms/__init__.py
@@ -2855,10 +2855,10 @@ class FormatBlockDeviceForm(Form):
2855 cleaned_data = super().clean()2855 cleaned_data = super().clean()
2856 if "fstype" not in cleaned_data:2856 if "fstype" not in cleaned_data:
2857 return cleaned_data2857 return cleaned_data
2858 partitions = Partition.objects.filter(2858 partition_table = PartitionTable.objects.filter(
2859 partition_table__block_device=self.block_device2859 block_device=self.block_device
2860 )2860 )
2861 if partitions.exists():2861 if partition_table.exists():
2862 raise ValidationError(2862 raise ValidationError(
2863 "Cannot format block device with a partition table."2863 "Cannot format block device with a partition table."
2864 )2864 )
diff --git a/src/maasserver/forms/tests/test_blockdevice.py b/src/maasserver/forms/tests/test_blockdevice.py
index 7f6f0b2..01a347a 100644
--- a/src/maasserver/forms/tests/test_blockdevice.py
+++ b/src/maasserver/forms/tests/test_blockdevice.py
@@ -36,8 +36,7 @@ class TestFormatBlockDeviceForm(MAASServerTestCase):
36 def test_is_not_valid_if_block_device_has_partition_table(self):36 def test_is_not_valid_if_block_device_has_partition_table(self):
37 fstype = factory.pick_filesystem_type()37 fstype = factory.pick_filesystem_type()
38 block_device = factory.make_PhysicalBlockDevice()38 block_device = factory.make_PhysicalBlockDevice()
39 pt = factory.make_PartitionTable(block_device=block_device)39 factory.make_PartitionTable(block_device=block_device)
40 pt.add_partition()
41 data = {"fstype": fstype}40 data = {"fstype": fstype}
42 form = FormatBlockDeviceForm(block_device, data=data)41 form = FormatBlockDeviceForm(block_device, data=data)
43 self.assertFalse(42 self.assertFalse(
diff --git a/src/maasserver/models/filesystemgroup.py b/src/maasserver/models/filesystemgroup.py
index bc758ba..9250d2c 100644
--- a/src/maasserver/models/filesystemgroup.py
+++ b/src/maasserver/models/filesystemgroup.py
@@ -207,7 +207,6 @@ class RAIDManager(BaseFilesystemGroupManager):
207 spare_devices=[],207 spare_devices=[],
208 spare_partitions=[],208 spare_partitions=[],
209 ):209 ):
210 from maasserver.models import PartitionTable
211 from maasserver.models.filesystem import Filesystem210 from maasserver.models.filesystem import Filesystem
212211
213 # Create a FilesystemGroup for this RAID212 # Create a FilesystemGroup for this RAID
@@ -255,9 +254,6 @@ class RAIDManager(BaseFilesystemGroupManager):
255 filesystem_group=raid,254 filesystem_group=raid,
256 )255 )
257 raid.save(force_update=True)256 raid.save(force_update=True)
258
259 PartitionTable.objects.create(block_device=raid.virtual_device)
260
261 return raid257 return raid
262258
263259
diff --git a/src/maasserver/models/tests/test_filesystemgroup.py b/src/maasserver/models/tests/test_filesystemgroup.py
index 44e7733..a0bf0e9 100644
--- a/src/maasserver/models/tests/test_filesystemgroup.py
+++ b/src/maasserver/models/tests/test_filesystemgroup.py
@@ -19,7 +19,6 @@ from maasserver.enum import (
19 FILESYSTEM_TYPE,19 FILESYSTEM_TYPE,
20 PARTITION_TABLE_TYPE,20 PARTITION_TABLE_TYPE,
21)21)
22from maasserver.models import PartitionTable
23from maasserver.models.blockdevice import MIN_BLOCK_DEVICE_SIZE22from maasserver.models.blockdevice import MIN_BLOCK_DEVICE_SIZE
24from maasserver.models.filesystem import Filesystem23from maasserver.models.filesystem import Filesystem
25from maasserver.models.filesystemgroup import (24from maasserver.models.filesystemgroup import (
@@ -2285,34 +2284,6 @@ class TestRAID(MAASServerTestCase):
2285 (10 * partition.size) - RAID_SUPERBLOCK_OVERHEAD, raid.get_size()2284 (10 * partition.size) - RAID_SUPERBLOCK_OVERHEAD, raid.get_size()
2286 )2285 )
22872286
2288 def test_create_raid_with_partition_table(self):
2289 node = factory.make_Node()
2290 block_devices = [
2291 factory.make_PhysicalBlockDevice(
2292 node=node, size=21470003200, block_size=512
2293 ),
2294 factory.make_PhysicalBlockDevice(
2295 node=node, size=11270004736, block_size=512
2296 ),
2297 ]
2298 partitions = []
2299 for bd in block_devices:
2300 ptable = factory.make_PartitionTable(block_device=bd)
2301 partitions.append(ptable.add_partition())
2302
2303 uuid = str(uuid4())
2304 md0 = RAID.objects.create_raid(
2305 name="md0",
2306 level=FILESYSTEM_GROUP_TYPE.RAID_0,
2307 uuid=uuid,
2308 partitions=partitions,
2309 )
2310 bdev = md0.virtual_device
2311 part_size = bdev.get_available_size()
2312
2313 pt_md0, _ = PartitionTable.objects.get_or_create(block_device=bdev)
2314 pt_md0.add_partition(size=part_size)
2315
2316 def test_add_spare_partition_to_array(self):2287 def test_add_spare_partition_to_array(self):
2317 node = factory.make_Node()2288 node = factory.make_Node()
2318 device_size = 10 * 1000**42289 device_size = 10 * 1000**4
diff --git a/src/maasserver/models/tests/test_node.py b/src/maasserver/models/tests/test_node.py
index 9f54da9..8605163 100644
--- a/src/maasserver/models/tests/test_node.py
+++ b/src/maasserver/models/tests/test_node.py
@@ -92,7 +92,6 @@ from maasserver.models import (
92from maasserver.models import (92from maasserver.models import (
93 NodeDevice,93 NodeDevice,
94 OwnerData,94 OwnerData,
95 PartitionTable,
96 PhysicalInterface,95 PhysicalInterface,
97 RackController,96 RackController,
98 RAID,97 RAID,
@@ -12312,10 +12311,10 @@ class TestNodeStorageClone_ComplexDiskLayout(
12312 block_devices=[raid_5_disk_1, raid_5_disk_2, raid_5_disk_3],12311 block_devices=[raid_5_disk_1, raid_5_disk_2, raid_5_disk_3],
12313 spare_devices=[raid_5_disk_4, raid_5_disk_5],12312 spare_devices=[raid_5_disk_4, raid_5_disk_5],
12314 )12313 )
12315 raid_5_partition_table = PartitionTable.objects.get(12314 raid_5_partition_table = factory.make_PartitionTable(
12316 block_device=raid_5.virtual_device12315 table_type=PARTITION_TABLE_TYPE.GPT,
12316 block_device=raid_5.virtual_device,
12317 )12317 )
12318
12319 raid_5_partition = factory.make_Partition(12318 raid_5_partition = factory.make_Partition(
12320 partition_table=raid_5_partition_table,12319 partition_table=raid_5_partition_table,
12321 uuid="18a6e885-3e6d-4505-8a0d-cf34df11a8b0",12320 uuid="18a6e885-3e6d-4505-8a0d-cf34df11a8b0",
diff --git a/src/maasserver/tests/test_preseed_storage.py b/src/maasserver/tests/test_preseed_storage.py
index befa7c3..6f16bf8 100644
--- a/src/maasserver/tests/test_preseed_storage.py
+++ b/src/maasserver/tests/test_preseed_storage.py
@@ -23,14 +23,7 @@ from maasserver.enum import (
23 NODE_STATUS,23 NODE_STATUS,
24 PARTITION_TABLE_TYPE,24 PARTITION_TABLE_TYPE,
25)25)
26from maasserver.models import (26from maasserver.models import Bcache, Filesystem, RAID, VMFS, VolumeGroup
27 Bcache,
28 Filesystem,
29 PartitionTable,
30 RAID,
31 VMFS,
32 VolumeGroup,
33)
34from maasserver.models.partitiontable import (27from maasserver.models.partitiontable import (
35 BIOS_GRUB_PARTITION_SIZE,28 BIOS_GRUB_PARTITION_SIZE,
36 PARTITION_TABLE_EXTRA_SPACE,29 PARTITION_TABLE_EXTRA_SPACE,
@@ -1264,8 +1257,9 @@ class TestComplexDiskLayout(MAASServerTestCase, AssertStorageConfigMixin):
1264 block_devices=[raid_5_disk_1, raid_5_disk_2, raid_5_disk_3],1257 block_devices=[raid_5_disk_1, raid_5_disk_2, raid_5_disk_3],
1265 spare_devices=[raid_5_disk_4, raid_5_disk_5],1258 spare_devices=[raid_5_disk_4, raid_5_disk_5],
1266 )1259 )
1267 raid_5_partition_table = PartitionTable.objects.get(1260 raid_5_partition_table = factory.make_PartitionTable(
1268 block_device=raid_5.virtual_device1261 table_type=PARTITION_TABLE_TYPE.GPT,
1262 block_device=raid_5.virtual_device,
1269 )1263 )
1270 raid_5_partition = factory.make_Partition(1264 raid_5_partition = factory.make_Partition(
1271 partition_table=raid_5_partition_table,1265 partition_table=raid_5_partition_table,
@@ -1687,7 +1681,6 @@ class TestBootableRaidLayoutMBR(MAASServerTestCase, AssertStorageConfigMixin):
1687 - sdc-part21681 - sdc-part2
1688 id: md01682 id: md0
1689 name: md01683 name: md0
1690 ptable: gpt
1691 raidlevel: 11684 raidlevel: 1
1692 spare_devices: []1685 spare_devices: []
1693 type: raid1686 type: raid
@@ -1819,7 +1812,6 @@ class TestBootableRaidLayoutUEFI(MAASServerTestCase, AssertStorageConfigMixin):
1819 - sdc-part11812 - sdc-part1
1820 id: md01813 id: md0
1821 name: md01814 name: md0
1822 ptable: gpt
1823 raidlevel: 11815 raidlevel: 1
1824 spare_devices: []1816 spare_devices: []
1825 type: raid1817 type: raid
@@ -1969,7 +1961,6 @@ class TestBootableRaidLayoutGPT(MAASServerTestCase, AssertStorageConfigMixin):
1969 - sdc-part21961 - sdc-part2
1970 id: md01962 id: md0
1971 name: md01963 name: md0
1972 ptable: gpt
1973 raidlevel: 11964 raidlevel: 1
1974 spare_devices: []1965 spare_devices: []
1975 type: raid1966 type: raid
@@ -2180,8 +2171,9 @@ class TestBootableRaidLayoutGPTWithPartition(
2180 uuid="uuid-raid",2171 uuid="uuid-raid",
2181 partitions=partitions,2172 partitions=partitions,
2182 )2173 )
2183 raid_part_table = PartitionTable.objects.get(2174 raid_part_table = factory.make_PartitionTable(
2184 block_device=raid.virtual_device2175 table_type=PARTITION_TABLE_TYPE.GPT,
2176 block_device=raid.virtual_device,
2185 )2177 )
2186 raid_partition = factory.make_Partition(2178 raid_partition = factory.make_Partition(
2187 partition_table=raid_part_table,2179 partition_table=raid_part_table,

Subscribers

People subscribed via source and target branches