Node object status won't get updated automatically - you need to poll for 
changes (either using list_nodes() with filtering on hte node id or get_node() 
method).

Here is an example of how that is implemented in the 
"_wait_until_running_method()" method - 
https://github.com/apache/libcloud/blob/trunk/libcloud/compute/base.py#L1678 
(although that method is more complex since it doesn't just wait for a state 
transition, but also for the node to have IP address assigned).

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

On Wednesday, June 2nd, 2021 at 2:01 PM, Massimo Canonico 
<massimo.canon...@uniupo.it> wrote:

> Hi,
>
> with the code that you can see after my signature, I was able to try to run 
> an instance with libcloud. The problem is that the instance is in "pending" 
> status and it seems not able to change status. Here the info about the 
> instance:
>
> > > > print(instance)
>
> <Node: uuid=53f0e5b8705d36c291787ac41c86ff38d601b730, name=PracticeInstance, 
> state=PENDING, public_ips=[], private_ips=[], provider=OpenStack ...>
>
> Could you please check if something is wrong in my script, please?. Please 
> note also that I'm testing libcloud and I'm tring to start a VM with only the 
> mandatory parameters: image, flavor and name.
>
> Thanks in advance for your support,
>
> Massimo
>
> [mex@hope code]$ python
>
> Python 3.8.10 (default, May 4 2021, 00:00:00)
>
> [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
>
> Type "help", "copyright", "credits" or "license" for more information.
>
> > > > from libcloud.compute.types import Provider
> > > >
> > > > from libcloud.compute.providers import get_driver
> > > >
> > > > auth_username = 'mcanonic'
> > > >
> > > > auth_password = '<MYPASSOWORD>'
> > > >
> > > > project_name = 'CCC-19/20'
> > > >
> > > > auth_url = 'https://kvm.tacc.chameleoncloud.org:5000'
> > > >
> > > > region_name = 'KVM@TACC'
> > > >
> > > > provider = get_driver(Provider.OPENSTACK)
> > > >
> > > > conn = 
> > > > provider(auth_username,auth_password,ex_force_auth_url=auth_url,ex_force_auth_version='3.x_password',ex_tenant_name=project_name,ex_force_service_region=region_name,api_version='2.1')
> > > >
> > > > image_id = 'b89f851a-d32a-410c-bf75-9deb2b1c2b63'
> > > >
> > > > image = conn.get_image(image_id)
> > > >
> > > > flavor_id = '3'
> > > >
> > > > flavor = conn.ex_get_size(flavor_id)
> > > >
> > > > instance = conn.create_node(name='PracticeInstance', image=image, 
> > > > size=flavor)

Reply via email to