diff mbox series

[4/5] hw/nvme: do not auto-generate uuid

Message ID 20220419121039.1259477-5-its@irrelevant.dk
State New
Headers show
Series hw/nvme: fix namespace identifiers | expand

Commit Message

Klaus Jensen April 19, 2022, 12:10 p.m. UTC
From: Klaus Jensen <k.jensen@samsung.com>

Do not default to generate an UUID for namespaces if it is not
explicitly specified.

This is a technically a breaking change in behavior. However, since the
UUID changes on every VM launch, it is not spec compliant and is of
little use since the UUID cannot be used reliably anyway and the
behavior prior to this patch must be considered buggy.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
---
 hw/nvme/ns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Christoph Hellwig April 20, 2022, 5:33 a.m. UTC | #1
On Tue, Apr 19, 2022 at 02:10:38PM +0200, Klaus Jensen wrote:
> From: Klaus Jensen <k.jensen@samsung.com>
> 
> Do not default to generate an UUID for namespaces if it is not
> explicitly specified.
> 
> This is a technically a breaking change in behavior. However, since the
> UUID changes on every VM launch, it is not spec compliant and is of
> little use since the UUID cannot be used reliably anyway and the
> behavior prior to this patch must be considered buggy.

So unlike the EUI, UUIDs are designed to be autogenerated even if the
current algorithm is completely broken.  We'd just need to persist them.
Note that NVMe at least in theory requires providing at least on of
the unique identifiers, and the UUID is the only one designed to be
autogenerated in a distributed fashion.
Klaus Jensen April 20, 2022, 5:51 a.m. UTC | #2
On Apr 20 07:33, Christoph Hellwig wrote:
> On Tue, Apr 19, 2022 at 02:10:38PM +0200, Klaus Jensen wrote:
> > From: Klaus Jensen <k.jensen@samsung.com>
> > 
> > Do not default to generate an UUID for namespaces if it is not
> > explicitly specified.
> > 
> > This is a technically a breaking change in behavior. However, since the
> > UUID changes on every VM launch, it is not spec compliant and is of
> > little use since the UUID cannot be used reliably anyway and the
> > behavior prior to this patch must be considered buggy.
> 
> So unlike the EUI, UUIDs are designed to be autogenerated even if the
> current algorithm is completely broken.  We'd just need to persist them.
> Note that NVMe at least in theory requires providing at least on of
> the unique identifiers, and the UUID is the only one designed to be
> autogenerated in a distributed fashion.

I understand, but it boils down to the fact that we do not have a
general method of storing "metadata" like this persistently.

But maybe it is time that we come up with something to do this.
Christoph Hellwig April 20, 2022, 6:53 a.m. UTC | #3
On Wed, Apr 20, 2022 at 07:51:32AM +0200, Klaus Jensen wrote:
> > So unlike the EUI, UUIDs are designed to be autogenerated even if the
> > current algorithm is completely broken.  We'd just need to persist them.
> > Note that NVMe at least in theory requires providing at least on of
> > the unique identifiers, and the UUID is the only one designed to be
> > autogenerated in a distributed fashion.
> 
> I understand, but it boils down to the fact that we do not have a
> general method of storing "metadata" like this persistently.
> 
> But maybe it is time that we come up with something to do this.

If we can't make the persistent uniqueue identifiers persistent and
unique, we should not provide them.  While NVMe does require a
namespace to report at least one of the three identifies, the failure
mode for now having one is much more graceful than providing one that
is not unique or not persistent.
Klaus Jensen April 20, 2022, 6:58 a.m. UTC | #4
On Apr 20 08:53, Christoph Hellwig wrote:
> On Wed, Apr 20, 2022 at 07:51:32AM +0200, Klaus Jensen wrote:
> > > So unlike the EUI, UUIDs are designed to be autogenerated even if the
> > > current algorithm is completely broken.  We'd just need to persist them.
> > > Note that NVMe at least in theory requires providing at least on of
> > > the unique identifiers, and the UUID is the only one designed to be
> > > autogenerated in a distributed fashion.
> > 
> > I understand, but it boils down to the fact that we do not have a
> > general method of storing "metadata" like this persistently.
> > 
> > But maybe it is time that we come up with something to do this.
> 
> If we can't make the persistent uniqueue identifiers persistent and
> unique, we should not provide them.  While NVMe does require a
> namespace to report at least one of the three identifies, the failure
> mode for now having one is much more graceful than providing one that
> is not unique or not persistent.

Alright. I think we can do that. We can revert the eui64 defaulting as
well.

Thanks for your reviews/comments Christoph.
diff mbox series

Patch

diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c
index 5685221f47c6..960c5124b811 100644
--- a/hw/nvme/ns.c
+++ b/hw/nvme/ns.c
@@ -617,7 +617,7 @@  static Property nvme_ns_props[] = {
     DEFINE_PROP_BOOL("detached", NvmeNamespace, params.detached, false),
     DEFINE_PROP_BOOL("shared", NvmeNamespace, params.shared, true),
     DEFINE_PROP_UINT32("nsid", NvmeNamespace, params.nsid, 0),
-    DEFINE_PROP_UUID("uuid", NvmeNamespace, params.uuid),
+    DEFINE_PROP_UUID_NODEFAULT("uuid", NvmeNamespace, params.uuid),
     DEFINE_PROP_UINT64("eui64", NvmeNamespace, params.eui64, 0),
     DEFINE_PROP_UINT16("ms", NvmeNamespace, params.ms, 0),
     DEFINE_PROP_UINT8("mset", NvmeNamespace, params.mset, 0),