Browse Source

Enable VRDE option for VMs in vbox scripts

VRDE option makes VMs accessible via RDP.
Fix vboxmanage to run via execute decorator.

Closes-Bug: #1498889
Change-Id: I93560126940457518fc4385c0518ab00d4b3d800
Vasiliy Pleshakov 3 years ago
parent
commit
7dc713ff28

+ 5
- 0
actions/master-node-create-and-install.sh View File

@@ -43,6 +43,11 @@ add_nat_adapter_to_vm $name 3 $vm_master_nat_network
43 43
 # Mount ISO with installer
44 44
 mount_iso_to_vm $name $iso_path
45 45
 
46
+#add RDP connection
47
+if [ ${headless} -eq 1 ]; then
48
+  enable_vrde $name ${RDPport}
49
+fi
50
+
46 51
 # Start virtual machine with the master node
47 52
 echo
48 53
 start_vm $name

+ 8
- 2
actions/slave-nodes-create-and-boot.sh View File

@@ -50,8 +50,14 @@ for idx in $(eval echo {1..$cluster_size}); do
50 50
   add_disk_to_vm $name 2 $vm_slave_third_disk_mb
51 51
 
52 52
   #add NIC1 MAC to description
53
-  mac=$(vboxmanage showvminfo $name |awk -F ': ' '$1~/NIC 1/ {mac=gensub(/^.+ MAC: ([0-9A-F]{12}).+$/,"\\1","g",$0);print mac}')
54
-  vboxmanage modifyvm $name --description $mac
53
+  mac=$(execute vboxmanage showvminfo $name |awk -F ': ' '$1~/NIC 1/ {mac=gensub(/^.+ MAC: ([0-9A-F]{12}).+$/,"\\1","g",$0);print mac}')
54
+  execute vboxmanage modifyvm $name --description $mac
55
+
56
+  #add RDP connection
57
+  if [ ${headless} -eq 1 ]; then
58
+    enable_vrde $name $((${RDPport} + idx))
59
+  fi
60
+
55 61
   enable_network_boot_for_vm $name
56 62
 
57 63
   # The delay required for downloading tftp boot image

+ 1
- 0
config.sh View File

@@ -181,4 +181,5 @@ vm_slave_third_disk_mb=65535
181 181
 
182 182
 # Set to 1 to run VirtualBox in headless mode
183 183
 headless=0
184
+RDPport=5000
184 185
 skipfuelmenu="no"

+ 9
- 0
functions/vm.sh View File

@@ -223,3 +223,12 @@ enable_network_boot_for_vm() {
223 223
     # Set the right boot priority
224 224
     execute VBoxManage modifyvm $name --boot1 net --boot2 disk --boot3 none --boot4 none --nicbootprio1 1
225 225
 }
226
+
227
+enable_vrde(){
228
+    name=$1
229
+    port=${2:-$RDPport}
230
+
231
+    # Enable VRDE, set port and address
232
+    execute VBoxManage modifyvm $name --vrde on
233
+    execute VBoxManage modifyvm $name --vrdeport $port
234
+}

Loading…
Cancel
Save