storaged-project / blivet

A python module for configuration of block devices
GNU Lesser General Public License v2.1
97 stars 85 forks source link

unset uuid nvmes, '00000000-0000-0000-0000-000000000000' will raise DuplicateUUIDError #1221

Closed iasunsea closed 4 months ago

iasunsea commented 4 months ago

image

class NVMeNamespaceDevicePopulator(DiskDevicePopulator): has attribute["uuid"] , to get nvme ninfo.uuid. when device has more unset nvmes , but some one uuid is '00000000-0000-0000-0000-000000000000' then class DeviceTreeBase(object): def _add_device(self, newdev, new=True): will raise DuplicateUUIDError so whether we need to set kwargs["uuid"] = None when ninfo.uuid == '00000000-0000-0000-0000-000000000000'

vojtechtrefny commented 4 months ago

cc @tbzatek

tbzatek commented 4 months ago

@iasunsea could you please attach output of nvme id-ns -H and nvme ns-descs from both namespaces?

iasunsea commented 4 months ago

@iasunsea could you please attach output of nvme id-ns -H and nvme ns-descs from both namespaces? these nvmes we have to format,i need to lookup some others,give me time. format commands: nvme delete-ns /dev/nvme[X] -n 1 nvme create-ns /dev/nvme[X] -s 6251233968 -c 6251233968 -f 0 nvme attach-ns /dev/nvme[X] -n 1 -c 1

tbzatek commented 4 months ago

Ah, so if you're creating new namespaces, then I guess the IDs are not set and default to zero. There are multiple ID options for namespaces, not sure what's possible to set on your end.

I guess we'll need to handle such situations either way.

iasunsea commented 4 months ago

@iasunsea could you please attach output of nvme id-ns -H and nvme ns-descs from both namespaces?

image

iasunsea commented 4 months ago

@vojtechtrefny @tbzatek i see the pr https://github.com/storaged-project/blivet/pull/1223 has been merged . i think i can close this issue, can i ?

tbzatek commented 4 months ago

Looking at NVM Express Base Specification, Revision 2.0d, section 5.17.2.3 Namespace Identification Descriptor list (CNS 03h), NIDT=3h: I don't see any mention about special treatment when all the bytes are zeroes, indicating a valid value. Availability of this value is indicated by the NIDT field, i.e. when it's not included in the Namespace Identification Descriptor List, only then it's not supported.

So I think libblockdev is correct by providing this value and it's up to consumers to decide whether to use it. Obviously the value is not unique.

As #1223 has been merged, you can close this ticket. I strongly recommend to set proper identifiers during namespace creation (or avoid setting UUID and have NGUID as a primary identifier), to prevent potential confusion with other tools.

vojtechtrefny commented 4 months ago

@vojtechtrefny @tbzatek i see the pr #1223 has been merged . i think i can close this issue, can i ?

Interesting, merging the PR should've closed this, it has the Fixes keyword. Anyway, thank you for the report and the additional information, this should be fixed in the next release of blivet.