add getBridgeMembers(), Fix Vnet on by default
This commit is contained in:
parent
259c3ee1e0
commit
c19e40b139
27
cmd/utils.go
27
cmd/utils.go
@ -228,7 +228,7 @@ CreateBootEnv no
|
|||||||
"type": "jail",
|
"type": "jail",
|
||||||
"used": "readonly",
|
"used": "readonly",
|
||||||
"vmemoryuse": "off",
|
"vmemoryuse": "off",
|
||||||
"vnet": 0,
|
"vnet": 1,
|
||||||
"vnet0_mac": "none",
|
"vnet0_mac": "none",
|
||||||
"vnet1_mac": "none",
|
"vnet1_mac": "none",
|
||||||
"vnet2_mac": "none",
|
"vnet2_mac": "none",
|
||||||
@ -751,6 +751,30 @@ func executeScript(script string) (string, error) {
|
|||||||
return string(out), err
|
return string(out), err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* Network related operations
|
||||||
|
*
|
||||||
|
*****************************************************************************/
|
||||||
|
func getBridgeMembers(bridge string) ([]string, error) {
|
||||||
|
var members []string
|
||||||
|
cmd := fmt.Sprintf("/sbin/ifconfig %s", bridge)
|
||||||
|
out, err := executeCommand(cmd)
|
||||||
|
if err != nil {
|
||||||
|
return members, errors.New(fmt.Sprintf("%v; command returned \"%s\"", err, out))
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, line := range strings.Split(out, "\n") {
|
||||||
|
if strings.HasPrefix(strings.TrimLeft(line, " \t"), "member:") {
|
||||||
|
m := strings.Split(strings.TrimLeft(strings.Split(line, ":")[1], " "), " ")[0]
|
||||||
|
log.Debugf("%s is member of %s\n", m, bridge)
|
||||||
|
members = append(members, m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return members, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* ZFS datasets/pools operations
|
* ZFS datasets/pools operations
|
||||||
@ -1033,6 +1057,7 @@ func addRcKeyValue(rcconfpath string, key string, value string) error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Parse an fstab file, returning an array of Mount
|
* Parse an fstab file, returning an array of Mount
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user