some fixes
This commit is contained in:
parent
0994baf5b0
commit
07f48d4369
1 changed files with 7 additions and 5 deletions
12
server.go
12
server.go
|
|
@ -55,11 +55,11 @@ func (s *Server) body() (httpbody, error) {
|
|||
}
|
||||
|
||||
func (s *Server) InstanceID() string {
|
||||
return s.String()
|
||||
return NewURL("", s.Node, s.ID)
|
||||
}
|
||||
|
||||
func (s *Server) String() string {
|
||||
return NewURL(s.Node, s.ID)
|
||||
func (s *Server) K8sID(pool string) string {
|
||||
return NewURL(pool, "", s.ID)
|
||||
}
|
||||
|
||||
type Resources struct {
|
||||
|
|
@ -166,7 +166,7 @@ func (c *ServerClient) NextID(ctx context.Context) (id string, err error) {
|
|||
|
||||
func (c *ServerClient) getConfig(ctx context.Context, node, id string) (cfg serverConfig, err error) {
|
||||
cfg = make(serverConfig)
|
||||
req, err := c.client.NewRequest(ctx, "GET", fmt.Sprintf("/nodes/%s/qemu/%s/config", node, id), nil)
|
||||
req, err := c.client.NewRequest(ctx, "GET", fmt.Sprintf("/nodes/%s/qemu/%s/config?current=1", node, id), nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
|
@ -261,10 +261,12 @@ func (c *ServerClient) CreateFromTemplate(ctx context.Context, opts ServerTempla
|
|||
}
|
||||
body := opts.body()
|
||||
body["newid"] = nextid
|
||||
node := opts.TemplateNode
|
||||
if opts.TargetNode != "" && opts.TemplateNode != opts.TargetNode {
|
||||
node = opts.TargetNode
|
||||
body["target"] = opts.TargetNode
|
||||
}
|
||||
url = NewURL(opts.Pool, nextid)
|
||||
url = NewURL(opts.Pool, node, nextid)
|
||||
req, err := c.client.NewRequest(ctx, "POST", fmt.Sprintf("/nodes/%s/qemu/%s/clone", opts.TemplateNode, opts.TemplateID), body.Reader())
|
||||
if err != nil {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue