mirror of
https://github.com/churchers/vm-bhyve.git
synced 2025-12-11 09:20:17 +01:00
Merge pull request #440 from runhyve/vm-name-length
Allow to use up to 229 characters for VM names on >=13.0
This commit is contained in:
@@ -153,7 +153,7 @@ core::create(){
|
||||
[ -z "${_name}" ] && util::usage
|
||||
|
||||
# check guest name
|
||||
util::check_name "${_name}" 46 || util::err "invalid virtual machine name - '${_name}'"
|
||||
util::check_name "${_name}" || util::err "invalid virtual machine name - '${_name}'"
|
||||
datastore::get_guest "${_name}" && util::err "virtual machine already exists in ${VM_DS_PATH}/${_name}"
|
||||
datastore::get "${_ds}" || util::err "unable to load datastore - '${_ds}'"
|
||||
|
||||
|
||||
@@ -360,7 +360,12 @@ util::check_name(){
|
||||
local _name="$1"
|
||||
local _maxlen="$2"
|
||||
|
||||
: ${_maxlen:=30}
|
||||
if [ ${VERSION_BSD} -ge 1300000 ]; then
|
||||
: ${__maxlen:=229}
|
||||
else
|
||||
: ${_maxlen:=30}
|
||||
fi
|
||||
|
||||
echo "${_name}" | egrep -iqs "^[a-z0-9][.a-z0-9_-]{0,${_maxlen}}[a-z0-9]\$"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user