Skip to content

Commit 44d7fe1

Browse files
author
neil
committed
fix
1 parent c01619c commit 44d7fe1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

vbox.sh

+9-9
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ createVM() {
106106
$_SUDO_VIR_ virt-install \
107107
--name $_osname \
108108
--memory 6144 \
109-
--vcpus 2 \
109+
--vcpus ${VM_CPU:-2} \
110110
--arch aarch64 \
111111
--disk $_iso \
112112
--disk path=$_vdi,format=qcow2,bus=${VM_DISK:-virtio} \
@@ -132,8 +132,8 @@ createVM() {
132132
$_SUDO_VIR_ virt-install \
133133
--name $_osname \
134134
--memory 6144 \
135-
--vcpus 2 \
136-
--arch x86_64 \
135+
--vcpus ${VM_CPU:-2} \
136+
--arch ${VM_ARCH:-x86_64} \
137137
--disk path=$_vdi,format=qcow2,bus=${VM_DISK:-virtio} \
138138
--cdrom $_iso \
139139
--os-variant=$_ostype \
@@ -166,7 +166,7 @@ createVMFromVHD() {
166166
$_SUDO_VIR_ virt-install \
167167
--name $_osname \
168168
--memory 6144 \
169-
--vcpus 2 \
169+
--vcpus ${VM_CPU:-2} \
170170
--arch ${VM_ARCH} \
171171
--disk $_vhd,format=qcow2,bus=${VM_DISK:-virtio} \
172172
--os-variant=$_ostype \
@@ -178,8 +178,8 @@ createVMFromVHD() {
178178
$_SUDO_VIR_ virt-install \
179179
--name $_osname \
180180
--memory 6144 \
181-
--vcpus 2 \
182-
--arch x86_64 \
181+
--vcpus ${VM_CPU:-2} \
182+
--arch ${VM_ARCH:-x86_64} \
183183
--disk $_vhd,format=qcow2,bus=${VM_DISK:-virtio} \
184184
--os-variant=$_ostype \
185185
--network network=default,model=e1000 \
@@ -226,7 +226,7 @@ importVM() {
226226
$_SUDO_VIR_ virt-install \
227227
--name $_osname \
228228
--memory 6144 \
229-
--vcpus 2 \
229+
--vcpus ${VM_CPU:-2} \
230230
--arch aarch64 \
231231
--disk $_ova,format=qcow2,bus=${VM_DISK:-virtio} \
232232
--os-variant=$_ostype \
@@ -754,8 +754,8 @@ getVMIP() {
754754
return
755755
fi
756756
fi
757-
if ! $_SUDO_VIR_ virsh net-dhcp-leases default | grep "$_osname" | grep -o -E '192.168.[0-9]*.[0-9]*' ; then
758-
$_SUDO_VIR_ virsh net-dhcp-leases default | grep -o -E '192.168.[0-9]*.[0-9]*' | tail -1
757+
if ! $_SUDO_VIR_ virsh net-dhcp-leases default | sort | grep "ipv4" | tail -1 | grep "$_osname" | grep -o -E '192.168.[0-9]*.[0-9]*'; then
758+
$_SUDO_VIR_ virsh net-dhcp-leases default | sort | grep "ipv4" | tail -1 | grep -o -E '192.168.[0-9]*.[0-9]*'
759759
fi
760760
}
761761

0 commit comments

Comments
 (0)