Skip to content

Add option to interact with individual VMs #10

@ent427

Description

@ent427

Hi,

the CONTRIBUTION.md states:

It currently supports API methods contained under the following paths (assume an /api2/json prefix):

/cluster
/nodes

However, I couldn't come up with a way to reach /nodes/{node}/qemu/{vmid}/snapshot/{snapname}/rollback in order to rollback (and restart) a VM. Is it possible somehow and I am just unable to identify how?

Idea would be something like this:

func (s *NodeService) RollbackVM(node string, id uint32, snapshotName string) (*GetNodeQemuResponse, *http.Response, error) {
	u := fmt.Sprintf("nodes/%s/qemu/%d/snapshot/%s/rollback", node, id, snapshotName)

	req, err := s.client.NewRequest(http.MethodPost, u, nil)  //body needs to send start=1
	if err != nil {
		return nil, nil, err
	}

	d := new(string)
	resp, err := s.client.Do(req, d)
	if err != nil {
		return nil, resp, err
	}

	return nil, resp, nil
}

Please let me know if this is already possible, otherwise I'd offer to contribute.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions