From f910ba6fa1215fbce631eda45ffab56f2bce4171 Mon Sep 17 00:00:00 2001 From: alperencelik Date: Thu, 22 Feb 2024 20:49:20 +0300 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8feat:=20Add=20DeleteContent=20meth?= =?UTF-8?q?od=20for=20storage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- storage.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/storage.go b/storage.go index f733afd..3a72619 100644 --- a/storage.go +++ b/storage.go @@ -112,6 +112,15 @@ func (s *Storage) GetContent(ctx context.Context) (content []*StorageContent, er return content, err } +func (s *Storage) DeleteContent(ctx context.Context, content string) (*Task, error) { + var upid UPID + err := s.client.Delete(ctx, fmt.Sprintf("/nodes/%s/storage/%s/content/%s", s.Node, s.Name, content), &upid) + if err != nil { + return nil, err + } + return NewTask(upid, s.client), nil +} + func (s *Storage) ISO(ctx context.Context, name string) (iso *ISO, err error) { err = s.client.Get(ctx, fmt.Sprintf("/nodes/%s/storage/%s/content/%s:%s/%s", s.Node, s.Name, s.Name, "iso", name), &iso) if err != nil { From 95711fdcf1a6994fa6c583f70c7ff7a03a28b7bc Mon Sep 17 00:00:00 2001 From: alperencelik Date: Mon, 26 Feb 2024 19:26:33 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=A8feat:=20Add=20ConvertToTemplate=20?= =?UTF-8?q?method?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- virtual_machine.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/virtual_machine.go b/virtual_machine.go index 194b18a..0b313a2 100644 --- a/virtual_machine.go +++ b/virtual_machine.go @@ -631,3 +631,11 @@ func (v *VirtualMachine) RRDData(ctx context.Context, timeframe Timeframe, conso err = v.client.Get(ctx, u.String(), &rrddata) return } + +func (v *VirtualMachine) ConvertToTemplate(ctx context.Context) (task *Task, err error) { + var upid UPID + if err = v.client.Post(ctx, fmt.Sprintf("/nodes/%s/qemu/%d/template", v.Node, v.VMID), nil, &upid); err != nil { + return nil, err + } + return NewTask(upid, v.client), nil +}