vmtypes names cannot be used as machine names

florent found a bug where he used "applehv" as a machine name.  it turns out when we use a vmtype name, esp. the active type, it really messes up directory structures for configuration and images alike.

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2023-11-17 11:36:34 -06:00
parent 71aac2f430
commit d32f61d91b
3 changed files with 14 additions and 1 deletions

View File

@ -41,6 +41,12 @@ var _ = Describe("podman machine init", func() {
Expect(err).ToNot(HaveOccurred())
Expect(session).To(Exit(125))
reservedName := initMachine{}
reservedNameSession, err := mb.setName(testProvider.VMType().String()).setCmd(&reservedName).run()
Expect(err).ToNot(HaveOccurred())
Expect(reservedNameSession).To(Exit(125))
Expect(reservedNameSession.errorToString()).To(ContainSubstring(fmt.Sprintf("cannot use %q", testProvider.VMType().String())))
badName := "foobar"
bm := basicMachine{}
sysConn, err := mb.setCmd(bm.withPodmanCommand([]string{"system", "connection", "add", badName, "tcp://localhost:8000"})).run()