def forwards(self, orm):
        PartitionTable = orm['maasserver.PartitionTable']
        Partition = orm['maasserver.Partition']
        Filesystem = orm['maasserver.Filesystem']
        FilesystemGroup = orm['maasserver.FilesystemGroup']
        PhysicalBlockDevice = orm['maasserver.PhysicalBlockDevice']
        VirtualBlockDevice = orm['maasserver.VirtualBlockDevice']
        for node in orm['maasserver.Node'].objects.filter(installable=True):
            if (node.status in IGNORE_STATUS and
                    node.blockdevice_set.count() == 0):
                # Node needs to be the correct status and have storage devices.
                continue

            # Clear the current storage configration just to be sure.
            clear_full_storage_configuration(
                node,
                PhysicalBlockDevice=PhysicalBlockDevice,
                VirtualBlockDevice=VirtualBlockDevice,
                PartitionTable=PartitionTable,
                Filesystem=Filesystem,
                FilesystemGroup=FilesystemGroup)

            # Create the flat layout on the boot disk.
            boot_device = node.boot_disk
            if boot_device is None:
                boot_device = PhysicalBlockDevice.objects.filter(
                    node=node).order_by('id').first()
            if boot_device is not None:
                create_flat_layout(
                    node,
                    boot_device,
                    PartitionTable=PartitionTable,
                    Partition=Partition,
                    Filesystem=Filesystem)
示例#2
0
    def test__creates_layout_for_1TiB_disk(self):
        node = factory.make_Node(with_boot_disk=False)
        boot_disk = factory.make_PhysicalBlockDevice(node=node,
                                                     size=1024**4,
                                                     block_size=512)
        create_flat_layout(node,
                           boot_disk,
                           PartitionTable=PartitionTable,
                           Partition=Partition,
                           Filesystem=Filesystem)

        # Validate the filesystem on the root partition.
        partition_table = boot_disk.get_partitiontable()
        partitions = partition_table.partitions.order_by('id').all()
        root_partition = partitions[0]
        self.assertThat(
            root_partition.get_effective_filesystem(),
            MatchesStructure.byEquality(
                fstype=FILESYSTEM_TYPE.EXT4,
                label="root",
                mount_point="/",
            ))