UPWORK/ODESK guru: Tips and Tricks for clients

skype: upwork.link , email: [email protected]

Openstack Horizon: Bug of ‘FileField need clean up temp file….’ or how to remove supefluos files in Horizon/Django after uploading..

without comments

After few day envestigation code I created patch. I hope core developers can use it in horizon …

1
2
3
4
5
6
7
8
9
10
11
12
13
14
234 @@ -442,7 +442,12 @@
235                                      {'data': data})
236          else:
237              def upload():
238 -                return glanceclient(request).images.upload(image.id, data)
239 +                glance_answer = glanceclient(request).images.upload(image.id, data)
240 +                if isinstance(data, TemporaryUploadedFile):
241 +                   if glance_answer[0].ok is True :
242 +                      data.file.close_called = False
243 +                      data.file.close()
244 +                return glance_answer
245              thread.start_new_thread(upload, ())
246
247      return Image(image)

Enjoy! Free!

Written by spectre

November 19th, 2017 at 5:16 pm

Posted in Tips and Tricks

Migrating of virtual instance from Ganeti DRBD to OpenStack/Ganeti via Ceph

without comments

On ganeti, shutdown the instance and activate its disks:

1
2
3
4
# gnt-instance shutdown 0030
Waiting for job 187265 for 0030 ...
# gnt-instance activate-disks 0030
snode-iu.gnt:disk/0:/dev/drbd20

Read the rest of this entry »

Written by spectre

October 15th, 2017 at 2:04 pm

Ganeti bug when you try to use special pool and special client for mounting RBD images from special CEPH cluster.

without comments

You can get error message in process work ganeti iwth private ceph cluster, when ganeti must use special pool and special user name. I suppose you already know how add environment for rbd in code of python of ganeti, so as ganeti is very poor guy in this context.

Ganeti tries to parse shell output from command of ‘rbd shomapped’. Child style of coders of google. LOL. And of course is using wrong parameter.

1
2
3
4
5
6
7
8
9
10
11
Sun Oct 15 07:29:03 2017 * disk 0, size 25.0G
Sun Oct 15 07:29:03 2017 * creating instance disks...
Sun Oct 15 07:29:07 2017  - WARNING: Device creation failed
Failure: command execution error:
Can't create block device <disk (type=rbd, logical_id=('rbd',
'
f6487061-7c8d-4f19-9494-cf2af9d346a0.rbd.disk0'),
children=None, visible as /dev/disk/0,
size=25600m)> on node blade-19-int0.g1.blades.uiip.openstack.by for
instance instance-002.g1.blades.uiip.openstack.by: Can'
t create block device:
rbd showmapped failed (exited with exit code 1):
rbd: unrecognised option '-p'

and of course here is place where is bug:

Read the rest of this entry »

Written by spectre

October 15th, 2017 at 1:27 pm

How to set environment variables in systemd service for Ganeti with some cluster of CEPH!

without comments

Best practices:

The current best way to do this is to run ‘systemctl edit service’, which will create an override file for you or let you edit an existing one.

In normal installations this will create a directory /etc/systemd/system/service.service.d, and inside that directory create a file whose name ends in .conf (typically, override.conf), and in this file you can add to or override any part of the unit shipped by the distribution.

For instance:

1
2
3
# systemctl edit ganeti-noded
>>> in vim env you can see
>>> "/etc/systemd/system/ganeti-noded.service.d/.#override.conf6940d208e8dfaced" 0L, 0C

Content may be any, for example:

1
2
3
4
# cat /etc/systemd/system/ganeti-noded.service.d/override.conf
[Service]
Environment="SECRET=123"
Environment="ANOTHER_SECRET=456"

Also note that if the directory exists and is empty, your service will be disabled! If you don’t intend to put something in the directory, ensure that it does not exist.

Written by spectre

October 15th, 2017 at 1:23 pm

BUGS of OPENSTACK: broken dependency of version of openstack-novaclient in tarballs of horizon-9.1.2

without comments

WRONG!!!

1
2
3
(.venv) [homitaka@tayn1 horizon]$ egrep novaclient requirements.txt
python-novaclient!=2.33.0,>=2.29.0 # Apache-2.0
(.venv) [homitaka@tayn1 horizon]$

Read the rest of this entry »

Written by spectre

May 15th, 2017 at 9:29 pm

Posted in Tips and Tricks

pip – to show all versions of package

without comments

(.venv) [[email protected] ~]$ pip install python-novaclient==
Collecting python-novaclient==
  Could not find a version that satisfies the requirement python-novaclient== (from versions: 2.6.0, 2.6.0.1, 2.6.10, 2.7.0, 2.8.0, 2.9.0, 2.10.0, 2.11.0, 2.11.1, 2.12.0, 2.13.0, 2.14.0, 2.14.1, 2.15.0, 2.16.0, 2.17.0, 2.18.0, 2.18.1, 2.19.0, 2.20.0, 2.21.0, 2.22.0, 2.23.0, 2.23.1, 2.23.2, 2.23.3, 2.24.0, 2.24.1, 2.25.0, 2.26.0, 2.27.0, 2.28.0, 2.28.1, 2.29.0, 2.30.0, 2.30.1, 2.30.2, 2.30.3, 2.31.0, 2.32.0, 2.33.0, 2.34.0, 2.35.0, 3.0.0, 3.1.0, 3.2.0, 3.3.0, 3.3.1, 3.3.2, 3.4.0, 4.0.0, 4.1.0, 5.0.0, 5.1.0, 6.0.0, 6.0.1, 7.0.0, 7.1.0, 7.1.1, 8.0.0)
No matching distribution found for python-novaclient==
(.venv) [[email protected] ~]$

Written by spectre

May 15th, 2017 at 9:25 pm

Deploy Horizon (any releases) from tarballs with Apache for isolated user in virtual environment.

without comments

If your company use OpenStack clouds without ‘Horizon Dashboard’ interface, you may wish to deploy your own horizon instance. Or you can use this method for permanent deploy any version of Horizont in your clouds.

However, your concern is that http might be insecure… especially if hosted on a VM or machine accessible from the Internet. So you want an SSL connection. It is will be in next parts of articles

ref: https://docs.openstack.org/developer/horizon/topics/install.html

Read the rest of this entry »

Written by spectre

May 15th, 2017 at 1:01 am

Posted in Tips and Tricks

5 – five-minute introduction to the module logging Python

without comments

The use of pirnt is suitable for those programmers who have enough time. But it’s better to use logging. In addition, learn to use the Python debugger for debugging errors and Pylint to prevent errors and to make the code more readable.
In order to display the log messages on the screen, use the following code:

Read the rest of this entry »

Written by spectre

May 7th, 2017 at 2:35 pm

Flush Expired Openstack Keystone Tokens

without comments

After a while of running Openstack and performing a lot of testing (especially Tempest) you may find that your database seems to get pretty full … and this is partly down to expired keystone token’s that remain in the DB table.

To resolve this simply setup a periodic Cron job to execute

1
# /usr/bin/keystone-manage token_flush

This will remove all expired tokens to help clean-up the DB a bit

Of course, this action better to insert as cron task:

1
2
3
4
# cat keystone_token_flush
#!/bin/bash

10 * * * * root /usr/bin/keystone-manage token_flush

Written by spectre

April 24th, 2017 at 2:11 am

Own installation Ganeti Web Manager + own Python environment + localization (by desire).

without comments

Актуально для текущей-последней версии GWM (в репозитории pip), для Python 2.17.13 (собственная оригинальная инсталляция в /opt).
Apache 2.4, Ganeti 2.15.2 on CentOS7.

Read the rest of this entry »

Written by spectre

March 4th, 2017 at 3:33 pm