saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.16k stars 5.48k forks source link

Azure: salt-cloud should be able to set specific cloud service for VM #15959

Closed egilh closed 9 years ago

egilh commented 10 years ago

As it seems now, salt-cloud cannot set a VM to a specific cloud service in Azure. Setting service_name, or cloud_service in config makes no difference on deploy.

For creating load-balanced VM's in Azure, they have to be in the same cloud-service.

rallytime commented 10 years ago

Thanks for the request @egilh! This seems like it would be a helpful feature to have. I've approved it for a future release.

flavianh commented 9 years ago

Any idea of when this will be available?

rallytime commented 9 years ago

@traxair Thanks for the bump. I don't think anything has been done with this yet, as we are trying to get our bug count under control before jumping on features. However, we'd happily accept a pull request if someone else wants to tackle this one.

flavianh commented 9 years ago

Well do you have some pointers on how that could be done?

rallytime commented 9 years ago

Hrm, I don't for this particular issue, but I bet @techhat might have some pointers.

techhat commented 9 years ago

@egilh and @traxair, take a look at #15959 and see if that helps.

flavianh commented 9 years ago

Isn't #15959 already what we are looking at?

techhat commented 9 years ago

@traxair, sorry, I meant #19155.

flavianh commented 9 years ago

OK seems nice, how can I try it? I use the regular installation. I could just replace the right lines in clouds/msazure.py on my master but that seems ugly, is there a standard way?

techhat commented 9 years ago

You can do that, you can install from git, or you can wait for the next release.

egilh commented 9 years ago

I tried to install latest from Git, unfortunatly, I'm still blocked by another issue, so I cannot confirm.

~$ salt-cloud --versions-report
            Salt: 2015.2.0-49-gadbcb96
          Python: 2.7.6 (default, Mar 22 2014, 22:59:56)
          Jinja2: 2.7.2
        M2Crypto: 0.21.1
  msgpack-python: 0.3.0
    msgpack-pure: Not Installed
        pycrypto: 2.6.1
         libnacl: Not Installed
          PyYAML: 3.10
           ioflo: Not Installed
           PyZMQ: 14.0.1
            RAET: Not Installed
             ZMQ: 4.0.4
            Mako: 0.9.1
 Apache Libcloud: 0.14.1
$ sudo salt-cloud -p azure-ubuntu yrsaltdevtest -l debug
[DEBUG   ] Reading configuration from /etc/salt/cloud
[DEBUG   ] Reading configuration from /etc/salt/master
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: madmzlxyrsalt01.dmz.nrk.no
[DEBUG   ] Missing configuration file: /etc/salt/cloud.providers
[DEBUG   ] Including configuration from '/etc/salt/cloud.providers.d/azure.conf'
[DEBUG   ] Reading configuration from /etc/salt/cloud.providers.d/azure.conf
[DEBUG   ] Missing configuration file: /etc/salt/cloud.profiles
[DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/azure-coreos.conf'
[DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/azure-coreos.conf
[DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/azure-ubuntu.conf'
[DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/azure-ubuntu.conf
[DEBUG   ] Including configuration from '/etc/salt/cloud.profiles.d/azure-win.conf'
[DEBUG   ] Reading configuration from /etc/salt/cloud.profiles.d/azure-win.conf
[DEBUG   ] Configuration file path: /etc/salt/cloud
[INFO    ] salt-cloud starting
[DEBUG   ] The 'azure' cloud driver is unable to be optimized.
[DEBUG   ] Failed to execute 'azure.list_nodes()' while querying for running nodes: Not found (Not Found)
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 2232, in run_parallel_map_providers_query
    cloud.clouds[data['fun']]()
  File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/msazure.py", line 242, in list_nodes
    nodes = list_nodes_full(conn, call)
  File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/msazure.py", line 261, in list_nodes_full
    services = list_hosted_services(conn=conn, call=call)
  File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/msazure.py", line 363, in list_hosted_services
    role_name=role.role_name,
  File "/usr/local/lib/python2.7/dist-packages/azure/servicemanagement/servicemanagementservice.py", line 997, in get_role
    PersistentVMRole)
  File "/usr/local/lib/python2.7/dist-packages/azure/servicemanagement/servicemanagementclient.py", line 108, in _perform_get
    response = self._perform_request(request)
  File "/usr/local/lib/python2.7/dist-packages/azure/servicemanagement/servicemanagementclient.py", line 97, in _perform_request
    return _management_error_handler(ex)
  File "/usr/local/lib/python2.7/dist-packages/azure/servicemanagement/__init__.py", line 1336, in _management_error_handler
    return _general_error_handler(http_error)
  File "/usr/local/lib/python2.7/dist-packages/azure/__init__.py", line 910, in _general_error_handler
    _ERROR_NOT_FOUND.format(str(http_error)))
WindowsAzureMissingResourceError: Not found (Not Found)
[DEBUG   ] Generating minion keys for 'yrsaltdevtest'
[DEBUG   ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Sending event - data = {'profile': 'azure-ubuntu', 'event': 'starting create', '_stamp': '2015-01-06T12:45:46.993309', 'name': 'yrsaltdevtest', 'provider': 'yr-azure-config:azure'}
[INFO    ] Creating Cloud VM yrsaltdevtest
[DEBUG   ] vm_kwargs: {'system_config': <azure.servicemanagement.LinuxConfigurationSet object at 0x7f0569c7af10>, 'deployment_slot': 'production', 'role_size': 'Small', 'deployment_name': 'yrsaltdevtest', 'service_name': 'yrsaltdevtest', 'role_name': 'yrsaltdevtest', 'network_config': <azure.servicemanagement.ConfigurationSet object at 0x7f056f83b310>, 'os_virtual_hard_disk': <azure.servicemanagement.OSVirtualHardDisk object at 0x7f0569c7ac10>, 'label': 'yrsaltdevtest'}
[DEBUG   ] MasterEvent PUB socket URI: ipc:///var/run/salt/master/master_event_pub.ipc
[DEBUG   ] MasterEvent PULL socket URI: ipc:///var/run/salt/master/master_event_pull.ipc
[DEBUG   ] Sending event - data = {'_stamp': '2015-01-06T12:45:47.045471', 'service_kwargs': {'service_name': 'yrsaltdevtest', 'label': 'yrsaltdevtest', 'location': 'West Europe', 'description': 'yrsaltdevtest'}, 'event': 'requesting instance', 'vm_kwargs': {'deployment_slot': 'production', 'role_size': 'Small', 'deployment_name': 'yrsaltdevtest', 'service_name': 'yrsaltdevtest', 'label': 'yrsaltdevtest', 'role_name': 'yrsaltdevtest'}}
[DEBUG   ] vm_kwargs: {'system_config': <azure.servicemanagement.LinuxConfigurationSet object at 0x7f0569c7af10>, 'deployment_slot': 'production', 'role_size': 'Small', 'deployment_name': 'yrsaltdevtest', 'service_name': 'yrsaltdevtest', 'role_name': 'yrsaltdevtest', 'network_config': <azure.servicemanagement.ConfigurationSet object at 0x7f056f83b310>, 'os_virtual_hard_disk': <azure.servicemanagement.OSVirtualHardDisk object at 0x7f0569c7ac10>, 'label': 'yrsaltdevtest'}
[DEBUG   ] Attempting function <function wait_for_hostname at 0x7f0569c69cf8>
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 1)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 2)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 3)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 4)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 5)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 6)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 7)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 8)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 9)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 10)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 11)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 12)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 13)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 14)
[DEBUG   ] Caught exception in wait_for_fun: local variable 'data' referenced before assignment
[DEBUG   ] Retrying function <function wait_for_hostname at 0x7f0569c69cf8> on  (try 15)
^C
Exiting gracefully on Ctrl-c
flavianh commented 9 years ago

I have added two comments on commit 566d477

flavianh commented 9 years ago

Well it's done now you can close it

rallytime commented 9 years ago

Thanks for following up here @traxair! Since this looks to be resolved, I am going to close this out.

@egilh If this isn't quite working for you or see any problems here, leave a comment and we will be happy to take another look are re-open this issue.