lima icon indicating copy to clipboard operation
lima copied to clipboard

generate qemu vm uuid

Open dictcp opened this issue 3 years ago • 4 comments

Background

Some application may requires the product_uuid from sysfs, OR it will be broken, eg.

  • https://github.com/nestybox/sysbox/issues/439
  • https://bugs.launchpad.net/ubuntu/+source/qemu-kvm/+bug/959308

The patch will generate a UUID, based of the MD5 sum of the VM name, and append as qemu --uuid parameter. It should be safe and no impact to others usecase.

dictcp avatar Mar 24 '22 15:03 dictcp

Thanks, but please sign the commit for DCO https://github.com/apps/dco

(run git commit -a -s --amend, and make sure that the Signed-off-by: NAME <EMAIL> line with your real name is included in the commit message)

AkihiroSuda avatar Mar 24 '22 15:03 AkihiroSuda

To have a globally unique, but persistent (accross VM restarts) id we include both the machine id and the full path to the VM directory:

https://github.com/lima-vm/lima/blob/3aca16d2a762fdb1ba9f50d6749cb03240d0a963/pkg/limayaml/defaults.go#L44

The instance name alone isn't even locally unique because you can have multiple LIMA_HOME settings on the same machine.

I would suggest to extract the sha function from limayaml.MACAddress into a separate function and also use it as input for the qemu UUID. The uniqueID passed into the function is the instance directory.

jandubois avatar Mar 24 '22 15:03 jandubois

@dictcp Hi, are you still working on this PR? I need it too.

junnplus avatar May 11 '22 10:05 junnplus

@junnplus Feel free to open a new PR to carry this (if you would like to)

AkihiroSuda avatar Aug 18 '22 08:08 AkihiroSuda