vlead / ovpl

ADS - Automated Deployment Service
MIT License
0 stars 22 forks source link

[CentOSVZAdapter] [CentOSBridgeVZAdapter] specifying OS which is not supported, silently fails lab deployment - gives misleading errors #57

Closed ecthiender closed 9 years ago

ecthiender commented 9 years ago

When an OS is specified in the labspec which is not supported, the find_os_template function in CentOSVZAdapter and CentOSBridgeVZAdapter silently returns from the function instead of raising and exception. As a result, the error is caught in construct_vzctl_args as the os_template is set to None.

More specifically, the following error is thrown:

[D 150506 02:37:06 CentOSBridgeVZAdapter:382] hostname = virt-eng.vlabs.ac.in, lab_ID = virt-eng, adapter_hostname = vlabs.ac.in
[D 150506 02:37:06 CentOSBridgeVZAdapter:383] ostemplate = None, disk_soft = 10G, disk_hard = 15.0G, host_name = virt-eng.vlabs.ac.in
[E 150506 02:37:06 web:1421] Uncaught exception POST /api/1.0/vm/create (::1)
    HTTPServerRequest(protocol='http', host='localhost:8000', method='POST', uri='/api/1.0/vm/create', version='HTTP/1.1', remote_ip='::1', headers={'Content-Length': '2805', 'Host': 'localhost:8000', 'Accept-Encoding': 'gzip, deflate', 'Content-Type': 'application/x-www-form-urlencoded', 'Connection': 'keep-alive', 'Accept': '*/*', 'User-Agent': 'python-requests/2.6.2 CPython/2.6.6 Linux/2.6.32-042stab090.5'})
    Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/tornado-4.1-py2.6-linux-x86_64.egg/tornado/web.py", line 1346, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "adapters/AdapterServer.py", line 39, in post
        (success, vm_id) = adapter_instance.create_vm(lab_spec)
      File "/root/ovpl/src/adapters/CentOSBridgeVZAdapter.py", line 159, in create_vm
        (vm_create_args, vm_set_args) = construct_vzctl_args(lab_spec)
      File "/root/ovpl/src/adapters/CentOSBridgeVZAdapter.py", line 387, in construct_vzctl_args
        " --hostname " + host_name
    TypeError: cannot concatenate 'str' and 'NoneType' objects
[E 150506 02:37:06 web:1825] 500 POST /api/1.0/vm/create (::1) 3074.42ms
[D 150506 02:37:06 VMPool:87] VMPool: create_vm(): Response text from adapter: Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/tornado-4.1-py2.6-linux-x86_64.egg/tornado/web.py", line 1346, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "adapters/AdapterServer.py", line 39, in post
        (success, vm_id) = adapter_instance.create_vm(lab_spec)
      File "/root/ovpl/src/adapters/CentOSBridgeVZAdapter.py", line 159, in create_vm
        (vm_create_args, vm_set_args) = construct_vzctl_args(lab_spec)
      File "/root/ovpl/src/adapters/CentOSBridgeVZAdapter.py", line 387, in construct_vzctl_args
        " --hostname " + host_name
    TypeError: cannot concatenate 'str' and 'NoneType' objects

[E 150506 02:37:06 VMPool:96] VMPool: create_vm(): Error communicating with adapter: VMPool: create_vm(): Error creating VM: Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/tornado-4.1-py2.6-linux-x86_64.egg/tornado/web.py", line 1346, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "adapters/AdapterServer.py", line 39, in post
        (success, vm_id) = adapter_instance.create_vm(lab_spec)
      File "/root/ovpl/src/adapters/CentOSBridgeVZAdapter.py", line 159, in create_vm
        (vm_create_args, vm_set_args) = construct_vzctl_args(lab_spec)
      File "/root/ovpl/src/adapters/CentOSBridgeVZAdapter.py", line 387, in construct_vzctl_args
        " --hostname " + host_name
    TypeError: cannot concatenate 'str' and 'NoneType' objects

[E 150506 02:37:06 Controller:55] test_lab(): Test failed with error: VMPool: create_vm(): Error creating VM: VMPool: create_vm(): Error creating VM: Traceback (most recent call last):
      File "/usr/lib/python2.6/site-packages/tornado-4.1-py2.6-linux-x86_64.egg/tornado/web.py", line 1346, in _execute
        result = method(*self.path_args, **self.path_kwargs)
      File "adapters/AdapterServer.py", line 39, in post
        (success, vm_id) = adapter_instance.create_vm(lab_spec)
      File "/root/ovpl/src/adapters/CentOSBridgeVZAdapter.py", line 159, in create_vm
        (vm_create_args, vm_set_args) = construct_vzctl_args(lab_spec)
      File "/root/ovpl/src/adapters/CentOSBridgeVZAdapter.py", line 387, in construct_vzctl_args
        " --hostname " + host_name
    TypeError: cannot concatenate 'str' and 'NoneType' objects

FIX: find_os_template should raise an exception if corresponding OS template is not found!

ecthiender commented 9 years ago

@madhavipuliraju please update the status of the issue! :)

madhavipuliraju commented 9 years ago

Implemented sample python code with the required functionality and tested. working fine. Now I need to Integrate the same code in CentOSVZAdapter and CentOSVZBridgeAdapter and test them.

madhavipuliraju commented 9 years ago

created a branch on ovpl repository with name =fix-issue-#57= and code was checked in.

ecthiender commented 9 years ago

Once tested, we will close the issue.

On Thu, May 28, 2015 at 2:38 PM, madhavipuliraju notifications@github.com wrote:

created a branch on ovpl repository with name =fix-issue-#57 https://github.com/vlead/ovpl/issues/57= and code was checked in.

— Reply to this email directly or view it on GitHub https://github.com/vlead/ovpl/issues/57#issuecomment-106242261.

madhavipuliraju commented 9 years ago

Integrated the sample code with required functionality to CentOSVZAdapter.py file and after integration, I faced few issues and resolved them. Now the code was working fine and able to deploy the lab. I checked in the code to the same repository. @ecthiender can you please review the code.

madhavipuliraju commented 9 years ago

Implemented code to handle exceptions and integrated to CentOSBridgeVZAdapter.py file and after integration, I faced few issues while testing the code in bridge environment and resolved. Now the code was working fine and able to deploy the lab. I checked in the code to the same repository. @ecthiender can you please review this code also. and once tested close this issue