Ask Your Question

FilipGontko's profile - activity

2019-03-08 07:56:20 -0500 received badge  Famous Question (source)
2019-03-08 07:56:20 -0500 received badge  Notable Question (source)
2019-01-28 12:57:36 -0500 received badge  Notable Question (source)
2018-03-28 04:49:45 -0500 received badge  Famous Question (source)
2018-02-23 15:36:28 -0500 received badge  Notable Question (source)
2018-02-23 15:36:28 -0500 received badge  Famous Question (source)
2018-01-22 02:33:53 -0500 asked a question Authentication fail version 3.12.0

Hi guys,

I have problem, that I can't use openstack commands on version 3.12.0 but on version 2.3.1 it works perfectly. Is it just not supported yet ?

Thanks for suggestions.

2017-12-18 12:22:51 -0500 received badge  Popular Question (source)
2017-12-17 04:56:11 -0500 received badge  Popular Question (source)
2017-12-14 05:24:20 -0500 asked a question I can't use openrc file on remote machine

Hello guys! I get this error and I don't know why because on my local machine it works perfectly. I run

. demo-openrc.sh

Failed to discover available identity versions when contacting https://someurl:5000/v3. Attempting to parse version from URL. Unable to establish connection to https://someurl:5000/v3/auth/tokens: ('Connection aborted.', BadStatusLine('\x17\x03\x03%Iklt\x1f3\xad~¯\x81Ø\x8b5få¦+\x92ÃZ\x87õSçº\x1b¬0\x0f\x17\x19ëO®\x03V\x05çmG\x01T\x06>Rxs°\x9ah5H\x10º0Â{ðn\x9a±¼â(3\x05º}Vê\x1f0®!\x8cÆz«v\x9b\x18¡\x1b\x9aãÕ\x98+}°éhxúZ*s\x01n\x98\x0f)>Ó5C8|°Qµv\x16\x17\x85\n',))

2017-12-14 05:18:47 -0500 answered a question OpenStack task_state in Python API

I solved the problem :)

def get_node_task(node_cloud_id):
server = server_exists(node_cloud_id)
if not server:
    raise RuntimeError("Server does not exist")
else:
    for attr, value in vars(server).items():
        if attr == 'OS-EXT-STS:task_state':
            return value
2017-12-14 05:17:42 -0500 received badge  Popular Question (source)
2017-12-14 05:17:42 -0500 received badge  Famous Question (source)
2017-12-14 05:17:42 -0500 received badge  Notable Question (source)
2017-11-06 04:07:32 -0500 asked a question OpenStack task_state in Python API

Hello guys!

I have a problem that I need to get task_state of a VM via Python but I don't know how. Here's the thing:

{
"server": {
    "OS-DCF:diskConfig": "AUTO",
    "OS-EXT-AZ:availability_zone": "nova",
    "OS-EXT-SRV-ATTR:host": "compute",
    "OS-EXT-SRV-ATTR:hostname": "new-server-test",
    "OS-EXT-SRV-ATTR:hypervisor_hostname": "fake-mini",
    "OS-EXT-SRV-ATTR:instance_name": "instance-00000001",
    "OS-EXT-SRV-ATTR:kernel_id": "",
    "OS-EXT-SRV-ATTR:launch_index": 0,
    "OS-EXT-SRV-ATTR:ramdisk_id": "",
    "OS-EXT-SRV-ATTR:reservation_id": "r-ov3q80zj",
    "OS-EXT-SRV-ATTR:root_device_name": "/dev/sda",
    "OS-EXT-SRV-ATTR:user_data": "IyEvYmluL2Jhc2gKL2Jpbi9zdQplY2hvICJJIGFtIGluIHlvdSEiCg==",
    "OS-EXT-STS:power_state": 1,
    "OS-EXT-STS:task_state": null,
    "OS-EXT-STS:vm_state": "active",
    "OS-SRV-USG:launched_at": "2017-02-14T19:23:59.895661",
    "OS-SRV-USG:terminated_at": null,
    "accessIPv4": "1.2.3.4",
    "accessIPv6": "80fe::",
    "addresses": {
        "private": [
            {
                "OS-EXT-IPS-MAC:mac_addr": "aa:bb:cc:dd:ee:ff",
                "OS-EXT-IPS:type": "fixed",
                "addr": "192.168.0.3",
                "version": 4
            }
        ]
    },
    "config_drive": "",
    "created": "2017-02-14T19:23:58Z",
    "description": null,
    }
 }

If I want to get e.g. created I can use this:

return server.created

but when I want to use task_state I cannot use this:

return server.OS-EXT-STS:task_state

Can you please give me some ideas how to solve this ?

I already tried to iterate through the keys but it says that Server (object) is not iterable, neither has keys() nor values(). I ran out of ideas :D Here's my code:

def server_exists(name, smn=False):
    # create a session
    nova_client = Client_nova(session=get_session(), version=2)
    # creates a list of servers
    servers_list = nova_client.servers.list()
    # search the server in the list
    for s in servers_list:
        if s.name == name:
            return s
    return False


def get_node_task(node_cloud_id):
    server = server_exists(node_cloud_id)
    if not server:
        raise RuntimeError("Server does not exist")
    else:
        #TODO

Thanks!

2017-08-22 04:20:45 -0500 received badge  Notable Question (source)
2017-08-22 03:51:49 -0500 commented answer Why can't I update mac address ?

Thank you!

2017-08-22 02:55:26 -0500 received badge  Organizer (source)
2017-08-22 01:32:56 -0500 asked a question Why can't I update mac address ?

Hello guys!

I have a problem that I can't update mac_address on my instance. It says it is disallowed by policy. I don't understand why.

neutron port-update a788ee80-355e-415a-afcf-bea667125838 mac_address=fa:16:3e:f1:ee:58

Please any suggestions ?

Thanks :)

2017-08-22 01:29:00 -0500 answered a question How to upload image via Python API?

I figured it out thanks. I had to add 2 other params:

image = glance.images.create(name=image_name, disk_format=disk_format, container_format="bare")
2017-08-03 11:09:08 -0500 commented question How to upload image via Python API?

I figured it out thanks. I had to add 2 other params:

image = glance.images.create(name=image_name, disk_format=disk_format, container_format="bare")
2017-08-03 11:06:07 -0500 received badge  Enthusiast
2017-08-02 03:22:56 -0500 commented question How to upload image via Python API?

I tried it and it fails during images.upload. Basically it creates an image but it is empty because it won't upload an iso file to it (not just iso).

2017-08-02 03:21:37 -0500 received badge  Popular Question (source)
2017-07-26 07:24:26 -0500 answered a question How to connect 2 VM's via VXLAN ?

Thank you for your ideas!

2017-07-26 07:19:35 -0500 marked best answer How to connect 2 VM's via VXLAN ?

I have task to create 2 VM's .. one as a web server and another as a client and I should connect them via VXLAN. Please how can I do that ? I have no experience with OpenStack. Only things I've read about it but I couln't find out anything about this problem. Please help me!

2017-07-26 07:18:19 -0500 asked a question How to upload image via Python API?

Hello guys!

I have a problem with uploading Glance image via Python API. Here is my code:

def upload_image(image_name, path, desc=None):
glance = get_session(opt="glance")
image = glance.images.create(name=image_name)
glance.images.upload(image.id, open(path, 'rb'))
return 0

And when I run this I get this Error:

glanceclient.exc.CommunicationError: Error finding address for https://ostack..........................: Unable to establish connection to https://ostack..................../file: [Errno 32] Broken pipe

I thought that the session was not created but I tested it out and everything works.

Please can you help me figure this out ?

Thanks!

2017-07-26 04:48:49 -0500 received badge  Popular Question (source)
2017-07-20 03:54:24 -0500 received badge  Notable Question (source)
2017-07-10 02:23:57 -0500 marked best answer How to get status of an instance

Hello!

Is there a function in OpenStack that returns you a status of an instance ? I need something like "nova image-status <id>". Is there anything like this ?

Thank you very much for your help!

Have a nice day :) Filip

2017-07-10 02:23:47 -0500 received badge  Famous Question (source)
2017-07-10 02:22:13 -0500 received badge  Supporter (source)
2017-07-03 05:55:33 -0500 asked a question Get Instance Status via Python API

Hello guys!

Please, is there a way to get a status of an instance via Python API but not using cmd in source code? I mean original Python API function. I was looking everywhere and I can not find it, but I am not sure wheter I am not searching good enough or it does not exist.

I created this:

def get_node_state(name):
# create a session
nova_client = Client_nova(session=get_session(), version=2)
# creates a list of servers
servers_list = nova_client.servers.list()
server_state = name
server_exists = False
# search the server in the list
for s in servers_list:
    if s.name == server_state:
        server_exists = True
        break
if not server_exists:
    print("server %s does not exist" % server_state)
    status = None
else:
    # runs a command to find status
    status = os.popen("openstack server show -c status --format value %s" % name).read()
status = status.strip("\r\n")
return status

But I need to exchange the os.popen command.

Thank you!

2017-04-30 12:34:11 -0500 received badge  Notable Question (source)
2017-04-28 08:20:14 -0500 received badge  Popular Question (source)
2017-04-27 03:09:06 -0500 asked a question How can I create_vm with Python API?

Hello guys!

I found the documentation for Python API and I prepared some functions but I don't know how to try it out. Would you please give me some advice how to import or use the python file in order to create vm's via Python API ?

Thank you for your help!