Skip to content

Commit c8d39b7

Browse files
committed
rebuild metadata when reinstall
Signed-off-by: Jack <[email protected]>
1 parent e6573b5 commit c8d39b7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

web/src/routes/instance.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -662,15 +662,17 @@ func (a *InstanceAdmin) getMetadata(instance *model.Instance, rootPasswd string)
662662
dns := ""
663663
for i, iface := range instance.Interfaces {
664664
subnet := iface.Address.Subnet
665+
address := strings.Split(iface.Address.Address, "/")[0]
665666
instNetwork := &InstanceNetwork{
666-
Address: iface.Address.Address,
667+
Address: address,
667668
Netmask: subnet.Netmask,
668669
Type: "ipv4",
669670
Link: iface.Name,
670671
ID: fmt.Sprintf("network%d", i+1),
671672
}
672673
if iface.PrimaryIf {
673-
instRoute := &NetworkRoute{Network: "0.0.0.0", Netmask: "0.0.0.0", Gateway: subnet.Gateway}
674+
gateway := strings.Split(subnet.Gateway, "/")[0]
675+
instRoute := &NetworkRoute{Network: "0.0.0.0", Netmask: "0.0.0.0", Gateway: gateway}
674676
instNetwork.Routes = append(instNetwork.Routes, instRoute)
675677
dns = subnet.NameServer
676678
}

0 commit comments

Comments
 (0)