feature: add global mac prefix option

This commit is contained in:
Qiu Jian
2021-10-15 01:06:17 +08:00
parent 3d96a4c730
commit 6a169b4161
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -212,7 +212,7 @@ func (manager *SGuestnetworkManager) GenerateMac(netId string, suggestion string
log.Errorf("generate random mac failed: %s", err)
continue
}
mac = fmt.Sprintf("00:22:%02x:%02x:%02x:%02x", b[0], b[1], b[2], b[3])
mac = fmt.Sprintf("%s:%02x:%02x:%02x:%02x", options.Options.GlobalMacPrefix, b[0], b[1], b[2], b[3])
}
q := manager.Query().Equals("mac_addr", mac)
if len(netId) > 0 {
+2
View File
@@ -175,6 +175,8 @@ type ComputeOptions struct {
ProhibitRefreshingCloudImage bool `help:"Prohibit refreshing cloud image"`
GlobalMacPrefix string `help:"Global prefix of MAC address, default to 00:22" default:"00:22"`
esxi.EsxiOptions
}