[ 
https://issues.apache.org/jira/browse/LIBCLOUD-176?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jouke Waleson updated LIBCLOUD-176:
-----------------------------------

    Description: 
The Rackspace driver's list_nodes method will not include a brand new node 
right away. Therefore, the following code will fail when being called after 
deploy_node.

        while time.time() < end:
            nodes = self.list_nodes()
            nodes = list([n for n in nodes if n.uuid == node.uuid])

            if len(nodes) == 0:
                raise LibcloudError(value=('Booted node[%s] ' % node
                                    + 'is missing from list_nodes.'),
                                    driver=self)

            if len(nodes) > 1:
                raise LibcloudError(value=('Booted single node[%s], ' % node
                                    + 'but multiple nodes have same UUID'),
                                    driver=self)

            node = nodes[0]

            if (node.public_ips and node.state == NodeState.RUNNING):
                return node
            else:
                time.sleep(wait_period)
                continue



I fixed this by rewriting it like this:


        while time.time() < end:
            nodes = self.list_nodes()
            nodes = list([n for n in nodes if n.uuid == node.uuid])

            if len(nodes) > 1:
                raise LibcloudError(value=('Booted single node[%s], ' % node
                                    + 'but multiple nodes have same UUID'),
                                    driver=self)

            if (len(nodes) == 1 and nodes[0].public_ips and nodes[0].state == 
NodeState.RUNNING):
                return nodes[0]
            else:
                time.sleep(wait_period)
                continue


  was:
The Rackspace driver's list_nodes method will not include a brand new node node 
right away. Therefore, this code will fail when being called after deploy_node.

        while time.time() < end:
            nodes = self.list_nodes()
            nodes = list([n for n in nodes if n.uuid == node.uuid])

            if len(nodes) == 0:
                raise LibcloudError(value=('Booted node[%s] ' % node
                                    + 'is missing from list_nodes.'),
                                    driver=self)

            if len(nodes) > 1:
                raise LibcloudError(value=('Booted single node[%s], ' % node
                                    + 'but multiple nodes have same UUID'),
                                    driver=self)

            node = nodes[0]

            if (node.public_ips and node.state == NodeState.RUNNING):
                return node
            else:
                time.sleep(wait_period)
                continue



I fixed this by rewriting it like this:


        while time.time() < end:
            nodes = self.list_nodes()
            nodes = list([n for n in nodes if n.uuid == node.uuid])

            if len(nodes) > 1:
                raise LibcloudError(value=('Booted single node[%s], ' % node
                                    + 'but multiple nodes have same UUID'),
                                    driver=self)

            if (len(nodes) == 1 and nodes[0].public_ips and nodes[0].state == 
NodeState.RUNNING):
                return nodes[0]
            else:
                time.sleep(wait_period)
                continue


    
> Compute, base.py: _wait_until_running fails for Rackspace
> ---------------------------------------------------------
>
>                 Key: LIBCLOUD-176
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-176
>             Project: Libcloud
>          Issue Type: Bug
>    Affects Versions: 0.8.0
>            Reporter: Jouke Waleson
>              Labels: rackspace
>
> The Rackspace driver's list_nodes method will not include a brand new node 
> right away. Therefore, the following code will fail when being called after 
> deploy_node.
>         while time.time() < end:
>             nodes = self.list_nodes()
>             nodes = list([n for n in nodes if n.uuid == node.uuid])
>             if len(nodes) == 0:
>                 raise LibcloudError(value=('Booted node[%s] ' % node
>                                     + 'is missing from list_nodes.'),
>                                     driver=self)
>             if len(nodes) > 1:
>                 raise LibcloudError(value=('Booted single node[%s], ' % node
>                                     + 'but multiple nodes have same UUID'),
>                                     driver=self)
>             node = nodes[0]
>             if (node.public_ips and node.state == NodeState.RUNNING):
>                 return node
>             else:
>                 time.sleep(wait_period)
>                 continue
> I fixed this by rewriting it like this:
>         while time.time() < end:
>             nodes = self.list_nodes()
>             nodes = list([n for n in nodes if n.uuid == node.uuid])
>             if len(nodes) > 1:
>                 raise LibcloudError(value=('Booted single node[%s], ' % node
>                                     + 'but multiple nodes have same UUID'),
>                                     driver=self)
>             if (len(nodes) == 1 and nodes[0].public_ips and nodes[0].state == 
> NodeState.RUNNING):
>                 return nodes[0]
>             else:
>                 time.sleep(wait_period)
>                 continue

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to