Skip to content

Commit 6e22208

Browse files
committed
Optimize resulted vm
1 parent e9f0e0e commit 6e22208

5 files changed

Lines changed: 18 additions & 17 deletions

File tree

cloudify_libvirt/network_tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ def link(**kwargs):
151151
ctx.logger.info("{}:Found: {}"
152152
.format(vm_id, lease.get('ipaddr')))
153153
return
154-
time.sleep(30)
154+
# we have never get ip before 60 sec, so wait 60 as minimum
155+
time.sleep(60)
155156

156157
raise cfy_exc.RecoverableError(
157158
'No ip for now, try later'

cloudify_libvirt/templates/domain.xml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,22 @@
1515
<alias name="balloon0"/>
1616
<address function="0x0" type="pci" domain="0x0000" slot="0x04" bus="0x00"/>
1717
</memballoon>
18-
<controller type="usb" index="0">
19-
<alias name="usb0"/>
20-
<address function="0x2" type="pci" domain="0x0000" slot="0x01" bus="0x00"/>
21-
</controller>
2218
<controller type="pci" index="0" model="pci-root">
2319
<alias name="pci.0"/>
2420
</controller>
2521
<controller type="ide" index="0">
2622
<alias name="ide0"/>
2723
<address function="0x1" type="pci" domain="0x0000" slot="0x01" bus="0x00"/>
2824
</controller>
29-
<video>
30-
<alias name="video0"/>
31-
<model heads="1" type="cirrus" vram="9216"/>
32-
<address function="0x0" type="pci" domain="0x0000" slot="0x02" bus="0x00"/>
33-
</video>
3425
<emulator>/usr/bin/qemu-system-x86_64</emulator>
35-
<graphics autoport="yes" type="vnc" listen="127.0.0.1" port="5900">
36-
<listen type="address" address="127.0.0.1"/>
37-
</graphics>
3826
{% for network in networks %}
3927
<interface type="network">
4028
<target dev="{{ network.dev }}"/>
4129
<source network="{{ network.network }}"/>
4230
<mac address="{{ network.mac }}"/>
31+
{% if network.type %}
32+
<model type="{{ network.type }}" />
33+
{% endif %}
4334
</interface>
4435
{% endfor %}
4536
<input type="mouse" bus="ps2"/>

examples/scripts/download_vm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
ctx logger info "Download base image ${DISK}"
22

3-
LANG=C wget -cv "https://cloud-images.ubuntu.com/trusty/20170919/${DISK}"
3+
LANG=C wget -cv "https://cloud-images.ubuntu.com/trusty/current/${DISK}"
44

55
ctx instance runtime-properties vm_image "`pwd`/${DISK}"

examples/scripts/vm_preconfigure.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535

3636
networks = ctx.source.instance.runtime_properties["params"].get('networks')
3737
for network in networks:
38+
if not network.get('type'):
39+
network['type'] = "virtio"
3840
if not network.get('mac'):
3941
octet_full = (time.time() * 1000) % (256 * 256 * 256)
4042
octet_low = octet_full / 256

examples/templates/domain-arm.xml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
<on_poweroff>destroy</on_poweroff>
88
<devices>
99
<emulator>/usr/bin/qemu-system-aarch64</emulator>
10+
<memballoon model="virtio">
11+
<alias name="balloon0"/>
12+
<address function="0x0" type="pci" domain="0x0000" slot="0x04" bus="0x00"/>
13+
</memballoon>
1014
<controller type='scsi' index='0' model='virtio-scsi'>
1115
<alias name='scsi0'/>
1216
<address type='virtio-mmio'/>
@@ -30,15 +34,18 @@
3034
<target dev="{{ network.dev }}"/>
3135
<source network="{{ network.network }}"/>
3236
<mac address="{{ network.mac }}"/>
37+
{% if network.type %}
38+
<model type="{{ network.type }}" />
39+
{% endif %}
3340
</interface>
3441
{% endfor %}
35-
<console type='pty' tty='/dev/pts/9'>
36-
<source path='/dev/pts/9'/>
42+
<console type='pty' tty='/dev/pts/1'>
43+
<source path='/dev/pts/1'/>
3744
<target type='serial' port='0'/>
3845
<alias name='serial0'/>
3946
</console>
4047
<serial type='pty'>
41-
<source path='/dev/pts/9'/>
48+
<source path='/dev/pts/1'/>
4249
<target port='0'/>
4350
<alias name='serial0'/>
4451
</serial>

0 commit comments

Comments
 (0)