Import existing LXC containers into CLICD

This commit is contained in:
MengMengCode
2026-06-05 20:01:24 +08:00
parent 7613d9135b
commit 49a6981e28
3 changed files with 31 additions and 15 deletions
+4
View File
@@ -68,6 +68,7 @@ type Container struct {
ID int `json:"id"`
UUID string `json:"uuid"`
Name string `json:"name"`
LXCName string `json:"lxc_name,omitempty"`
Template string `json:"template"`
VCPU float64 `json:"vcpu"`
RAMMB int `json:"ram_mb"`
@@ -97,6 +98,9 @@ type Container struct {
// LxcName returns the internal LXC container name (ct-{id})
func (c *Container) LxcName() string {
if c.LXCName != "" {
return c.LXCName
}
return fmt.Sprintf("ct-%d", c.ID)
}