Repository: luthermonson/go-proxmox (language: go)

Issue:
Unmount Cloudinit ISO
As part of capi provider for proxmox. 

We need a way of unmounting the Cloud init ISO.


Discussion / hints:
unmount the cdrom from the vm? this is so on reboots it doesnt run a second time or something?
Yes i think we probably can check the status of cloud init via qemu quest agent. Then we are safe to remove the ISO. 


Fix patch:
diff --git a/virtual_machine.go b/virtual_machine.go
index 3e379d8..df95e15 100644
--- a/virtual_machine.go
+++ b/virtual_machine.go
@@ -643,3 +643,22 @@ func (v *VirtualMachine) ConvertToTemplate(ctx context.Context) (task *Task, err
 	}
 	return NewTask(upid, v.client), nil
 }
+
+func (v *VirtualMachine) UnmountCloudInitISO(ctx context.Context, device string) error {
+	if !v.HasTag(MakeTag(TagCloudInit)) {
+		return nil
+	}
+
+	_, err := v.Config(ctx, VirtualMachineOption{
+		Name:  device,
+		Value: "none,media=cdrom",
+	})
+	if err != nil {
+		return err
+	}
+
+	if _, err = v.deleteCloudInitISO(ctx); err != nil {
+		return err
+	}
+	return nil
+}


Test patch: