Ejemplo n.º 1
0
    def _use(self, namespaces):
        """Represents update for NVDIMM disks selected in UI."""
        storage = create_storage()
        self.storage_module._set_storage(storage)

        for number, namespace in enumerate(namespaces):
            device = NVDIMMNamespaceDevice("dev{}".format(number),
                                           fmt=get_format("disklabel"),
                                           size=Size("10 GiB"),
                                           mode="sector",
                                           devname=namespace,
                                           sector_size=512,
                                           id_path="pci-0000:00:00.0-bla-1",
                                           exists=True)
            storage.devicetree._add_device(device)
Ejemplo n.º 2
0
    def get_nvdimm_device_data_test(self):
        """Test GetDeviceData for NVDIMM."""
        self._add_device(
            NVDIMMNamespaceDevice("dev1",
                                  fmt=get_format("ext4"),
                                  size=Size("10 GiB"),
                                  mode="sector",
                                  devname="namespace0.0",
                                  sector_size=512))

        data = self.interface.GetDeviceData("dev1")
        self.assertEqual(data['type'], get_variant(Str, 'nvdimm'))
        self.assertEqual(
            data['attrs'],
            get_variant(Dict[Str, Str], {
                "mode": "sector",
                "namespace": "namespace0.0"
            }))
    def test_get_nvdimm_device_data(self):
        """Test GetDeviceData for NVDIMM."""
        self._add_device(
            NVDIMMNamespaceDevice("dev1",
                                  fmt=get_format("ext4"),
                                  size=Size("10 GiB"),
                                  mode="sector",
                                  devname="namespace0.0",
                                  sector_size=512,
                                  id_path="pci-0000:00:00.0-bla-1"))

        data = self.interface.GetDeviceData("dev1")
        assert data['type'] == get_variant(Str, 'nvdimm')
        assert data['attrs'] == get_variant(
            Dict[Str, Str], {
                "mode": "sector",
                "namespace": "namespace0.0",
                "path-id": "pci-0000:00:00.0-bla-1"
            })