Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2015
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.01 KB | None | 0 0
  1. [root@nailgun ~]# fuel --f
  2. DEPRECATION WARNING: /etc/fuel/client/config.yaml exists and will be used as the source for settings. This behavior is deprecated. Please specify the path to your custom settings file in the FUELCLIENT_CUSTOM_SETTINGS environment variable.
  3. api: '1.0'
  4. astute_sha: 6c5b73f93e24cc781c809db9159927655ced5012
  5. auth_required: true
  6. build_id: '301'
  7. build_number: '301'
  8. feature_groups:
  9. - mirantis
  10. fuel-agent_sha: 50e90af6e3d560e9085ff71d2950cfbcca91af67
  11. fuel-library_sha: 5d50055aeca1dd0dc53b43825dc4c8f7780be9dd
  12. fuel-nailgun-agent_sha: d7027952870a35db8dc52f185bb1158cdd3d1ebd
  13. fuel-ostf_sha: 2cd967dccd66cfc3a0abd6af9f31e5b4d150a11c
  14. fuelmain_sha: a65d453215edb0284a2e4761be7a156bb5627677
  15. nailgun_sha: 4162b0c15adb425b37608c787944d1983f543aa8
  16. openstack_version: 2015.1.0-7.0
  17. production: docker
  18. python-fuelclient_sha: 486bde57cda1badb68f915f66c61b544108606f3
  19. release: '7.0'
  20. release_versions:
  21. 2015.1.0-7.0:
  22. VERSION:
  23. api: '1.0'
  24. astute_sha: 6c5b73f93e24cc781c809db9159927655ced5012
  25. build_id: '301'
  26. build_number: '301'
  27. feature_groups:
  28. - mirantis
  29. fuel-agent_sha: 50e90af6e3d560e9085ff71d2950cfbcca91af67
  30. fuel-library_sha: 5d50055aeca1dd0dc53b43825dc4c8f7780be9dd
  31. fuel-nailgun-agent_sha: d7027952870a35db8dc52f185bb1158cdd3d1ebd
  32. fuel-ostf_sha: 2cd967dccd66cfc3a0abd6af9f31e5b4d150a11c
  33. fuelmain_sha: a65d453215edb0284a2e4761be7a156bb5627677
  34. nailgun_sha: 4162b0c15adb425b37608c787944d1983f543aa8
  35. openstack_version: 2015.1.0-7.0
  36. production: docker
  37. python-fuelclient_sha: 486bde57cda1badb68f915f66c61b544108606f3
  38. release: '7.0'
  39.  
  40. Env details:
  41.  
  42. root@node-1:~# nova image-list
  43. +--------------------------------------+--------+--------+--------+
  44. | ID | Name | Status | Server |
  45. +--------------------------------------+--------+--------+--------+
  46. | 94b9d222-dce4-4289-bd03-a4816d3e1c2c | TestVM | ACTIVE | |
  47. +--------------------------------------+--------+--------+--------+
  48.  
  49. root@node-1:~# nova flavor-list | grep m1.micro
  50. | a717b418-c6eb-47f4-a8a1-eb89ac9fbdd7 | m1.micro | 64 | 0 | 0 | | 1 | 1.0 | True |
  51.  
  52. root@node-1:~# neutron net-list
  53. +--------------------------------------+-----------+-------------------------------------------------------+
  54. | id | name | subnets |
  55. +--------------------------------------+-----------+-------------------------------------------------------+
  56. | 484fda23-4fa2-4213-b4c2-31f5c76f54a5 | net04_ext | 160c54d8-7747-4b25-bac0-a6fd40b475f6 10.177.6.0/24 |
  57. | 81931911-b050-44cd-b6fe-681c534a73fb | net04 | cc611f67-8903-413c-834d-db475102972d 192.168.111.0/24 |
  58.  
  59. root@node-1:~# nova list --all-tenant
  60. +--------------------------------------+-------+----------------------------------+--------+------------+-------------+---------------------+
  61. | ID | Name | Tenant ID | Status | Task State | Power State | Networks |
  62. +--------------------------------------+-------+----------------------------------+--------+------------+-------------+---------------------+
  63. | b2c4db87-fdc4-4421-a2fb-7e7b5a50a576 | test | c1bf0d7c0a1c49c4a96ae3581f165ecf | ACTIVE | - | Running | net04=192.168.111.6 |
  64. | abf51202-8850-473b-adb6-33f11ec5176b | test1 | c1bf0d7c0a1c49c4a96ae3581f165ecf | ACTIVE | - | Running | net04=192.168.111.5 |
  65. +--------------------------------------+-------+----------------------------------+--------+------------+-------------+---------------------+
  66.  
  67.  
  68. root@node-1:~# nova hypervisor-list
  69. +----+--------------------------+-------+---------+
  70. | ID | Hypervisor hostname | State | Status |
  71. +----+--------------------------+-------+---------+
  72. | 2 | node-5.test.domain.local | up | enabled |
  73. | 5 | node-4.test.domain.local | up | enabled |
  74. +----+--------------------------+-------+---------+
  75.  
  76.  
  77. I use script attached in upstream desctiption with some modifications:
  78.  
  79. #!/usr/bin/env python
  80. #__author__ = 'ankit.dddagrawal'
  81.  
  82. import datetime
  83. import time
  84.  
  85. from novaclient.client import Client
  86.  
  87. flavor_id = "a717b418-c6eb-47f4-a8a1-eb89ac9fbdd7"
  88. image_id = "94b9d222-dce4-4289-bd03-a4816d3e1c2c" #Cirros
  89. net_id = "81931911-b050-44cd-b6fe-681c534a73fb"
  90.  
  91. nova_client = Client('2',
  92. username="admin",
  93. api_key="admin",
  94. auth_url="http://10.177.6.3:5000/v2.0",
  95. project_id="admin")
  96.  
  97. def resize_instance(api_no):
  98. print "start of api............", api_no
  99. instance = nova_client.servers.create(name="test_%s"%api_no,
  100. image=image_id,
  101. flavor=flavor_id,
  102. nics=[{'net-id': net_id}])
  103. def _resize_instance():
  104. instance_obj = nova_client.servers.get(instance)
  105. instance_status = instance_obj.status
  106. if instance_status == 'ACTIVE':
  107. print("Resize instance with flavor m1.tiny")
  108. nova_client.servers.resize(instance, 1)
  109. return
  110. elif instance_status == 'ERROR':
  111. instance_status = instance_obj.to_dict()['fault']
  112. print("Instance is in error state %s" %instance_status)
  113. else:
  114. time.sleep(2)
  115. _resize_instance()
  116. _resize_instance()
  117.  
  118. def _delete_instance():
  119. instance_obj = nova_client.servers.get(instance)
  120. instance_dict = instance_obj.to_dict()
  121. task_state = instance_dict['OS-EXT-STS:task_state']
  122. vm_state = instance_dict['OS-EXT-STS:vm_state']
  123. if task_state == 'resize_migrated':
  124. print("deleting instance during resize")
  125. nova_client.servers.delete(instance)
  126. elif vm_state == 'resized':
  127. print("deleting unconfirmed resize instance")
  128. nova_client.servers.delete(instance)
  129. else:
  130. time.sleep(2)
  131. _delete_instance()
  132. _delete_instance()
  133.  
  134. if __name__ == '__main__':
  135. start_time = datetime.datetime.now()
  136. duration = 60*240 #in seconds
  137. test_end_time = time.time() + duration
  138. total_count = 0
  139. #while 1:
  140. for _ in xrange(10):
  141. t = time.time()
  142. vm_count = len(nova_client.servers.list())
  143. if t >= test_end_time:
  144. print("---------end of api calls--------")
  145. break
  146. total_count += 1
  147. try:
  148. resize_instance(total_count)
  149. except Exception as e:
  150. print ("Exit on exception %s " %e)
  151. break
  152.  
  153. print("Total instance delete attempts during resize = %s" % total_count)
  154.  
  155.  
  156. Script output:
  157.  
  158. root@node-1:~# python ./test_resize.py
  159. start of api............ 1
  160. Resize instance with flavor m1.tiny
  161. deleting instance during resize
  162. start of api............ 2
  163. Resize instance with flavor m1.tiny
  164. deleting instance during resize
  165. start of api............ 3
  166. Resize instance with flavor m1.tiny
  167. deleting instance during resize
  168. start of api............ 4
  169. Resize instance with flavor m1.tiny
  170. deleting instance during resize
  171. start of api............ 5
  172. Resize instance with flavor m1.tiny
  173. deleting instance during resize
  174. start of api............ 6
  175. Resize instance with flavor m1.tiny
  176. deleting instance during resize
  177. start of api............ 7
  178. Resize instance with flavor m1.tiny
  179. deleting unconfirmed resize instance
  180. start of api............ 8
  181. Resize instance with flavor m1.tiny
  182. deleting instance during resize
  183. start of api............ 9
  184. Resize instance with flavor m1.tiny
  185. deleting instance during resize
  186. start of api............ 10
  187. Resize instance with flavor m1.tiny
  188. deleting instance during resize
  189. Total instance delete attempts during resize = 10
  190.  
  191.  
  192. Results:
  193.  
  194. compute-4:
  195.  
  196. root@node-4:~# ls -l /var/lib/nova/instances/
  197. total 4
  198. drwxr-xr-x 3 nova nova 94 Nov 2 15:51 0d58d3b6-11d6-4441-8ee9-4880a5493e77_del
  199. drwxr-xr-x 2 nova nova 69 Nov 2 15:48 0d58d3b6-11d6-4441-8ee9-4880a5493e77_resize
  200. drwxr-xr-x 2 nova nova 69 Nov 2 15:53 388eb8be-f3ac-4e7e-8af8-20e8688421fd_resize
  201. drwxr-xr-x 2 nova nova 17 Nov 2 15:52 9bd302a9-5775-4882-82bb-29f7bc5724f9_del
  202. drwxr-xr-x 2 nova nova 69 Nov 2 15:52 9bd302a9-5775-4882-82bb-29f7bc5724f9_resize
  203. drwxr-xr-x 2 nova nova 53 Sep 29 12:44 _base
  204. -rw-r--r-- 1 nova nova 46 Nov 2 15:17 compute_nodes
  205. drwxr-xr-x 2 nova nova 91 Sep 29 12:44 locks
  206.  
  207. root@node-4:~# ls -l /var/lib/nova/instances/
  208. total 4
  209. drwxr-xr-x 2 nova nova 53 Sep 29 12:44 _base
  210. -rw-r--r-- 1 nova nova 46 Nov 2 15:17 compute_nodes
  211. drwxr-xr-x 2 nova nova 91 Sep 29 12:44 locks
  212.  
  213.  
  214. compute-5:
  215.  
  216. root@node-5:~# ls -l /var/lib/nova/instances/
  217. total 4
  218. drwxr-xr-x 2 nova nova 69 Nov 2 14:44 abf51202-8850-473b-adb6-33f11ec5176b
  219. drwxr-xr-x 2 nova nova 69 Nov 2 15:30 b2c4db87-fdc4-4421-a2fb-7e7b5a50a576
  220. drwxr-xr-x 2 nova nova 53 Nov 2 14:44 _base
  221. -rw-r--r-- 1 nova nova 47 Nov 2 15:36 compute_nodes
  222. drwxr-xr-x 2 nova nova 91 Nov 2 14:44 locks
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement