Friday, 2022-10-28

opendevreviewDenys Mishchenko proposed openstack/ansible-collections-openstack master: Existing images update name, visibility etc  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/86256507:05
jm1ard_: o/ lets ask gtema about this :D07:34
jm1gtema: update functions such as update_image take a image object or id as first parameter07:35
gtemayes, or something like a dict representing object07:35
jm1gtema: iiuc when an image object is given, then proxy class will take all other update_image args and assign them to the image object07:35
gtema{"id": "fakeid", "name": "fakename"}07:35
jm1gtema: ard_'s issue seems to be that this image+updated-args object is passed to glance api07:37
jm1gtema: from ard_'s description is looks like glance raises an error because it gets stuff which cannot be updated07:38
jm1gtema: is this excepted?07:38
gtemanot really07:39
gtemahttps://opendev.org/openstack/openstacksdk/src/branch/master/openstack/tests/functional/image/v2/test_image.py#L69 - we test changing image name in func tests07:39
jm1gtema: maybe the issue is here: "and this does include kernel_id and ramdisk_id . At the same time version of the script tries to change them if such params defined and differs from the present image."07:39
gtemait should not be the case. If you pass as first param whole image it should only update change attrs07:40
gtemabut image is specific in that it does things differently and tries to construct json patch07:40
ard_I tried to debug and see different body in api calls07:41
gtemawould be good if you give me some reproduce case (small sdk script)07:42
ard_the params are actually updated, when those 'op': 'remove' objects are added. It just complains with 409 error from api 07:43
ard_give me 10 minutes07:43
gtemano hurry, I am going for meeting now anyway07:43
jm1ard_: so we have different issues here? the kernel_id/ramdisk_id issue is separate from the image.id/image issue?07:48
jm1ard_: reading the glance api doc i agree with you that updating kernel_id/ramdisk_id is not going to work: "An attempt to modify any of the “base” image properties that are managed by the Image Service. These are the properties specified as read only in the Image Schema."07:48
opendevreviewJakob Meng proposed openstack/ansible-collections-openstack master: [DNM] Image update test  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/86286407:52
ard_jm1: yes, sorry that I brought multiple questions at the same time. Yes, it is separate and should not be tried to be updated. This is the question 1. Question 2: min_disk and min_ram - they are allowed to be changed07:53
jm1ard_: this should fail if we read the api correctly https://review.opendev.org/c/openstack/ansible-collections-openstack/+/86286407:54
jm1ard_: may i alter your patch?07:55
ard_jm1: of course you can. I came here to get a working solution at the end. 07:56
opendevreviewJakob Meng proposed openstack/ansible-collections-openstack master: Existing images update name, visibility etc  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/86256508:01
jm1ard_: ^ does this answer your question regarding min_disk..? :D08:01
opendevreviewJakob Meng proposed openstack/ansible-collections-openstack master: Existing images update name, visibility etc  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/86256508:06
ard_jm1: yes, this does answer it. I didn't put it in myself, wanted to discuss first as there might been a reason for this. Especially with the kernel parameter present. Also, min_disk has a default value of 0, so you can't just do like you did. It's default value should be moved to _build_params function08:06
*** JqckB_ is now known as JqckB08:07
*** TheJulia_ is now known as TheJulia08:07
*** gouthamr_ is now known as gouthamr08:07
*** PrinzElvis_ is now known as PrinzElvis08:07
ard_jm1: here https://opendev.org/openstack/ansible-collections-openstack/src/branch/master/plugins/modules/image.py#L46008:07
jm1ard_: why does min_disk not work?08:12
ard_if you run update image without this value it will be defaulted to 0 and if image had a limit, it will be reset to 008:14
jm1ard_: sure which is to be expected with default values. but i agree we should think about removing the default values for min_disk and min_ram08:23
jm1ard_: i would not mix create and update parameters though, since they are not necessarily the same08:24
jm1ard_: actually i see more stuff which could be refactored... lets focus on the important parts here and i will refactor this one later08:25
opendevreviewJakob Meng proposed openstack/ansible-collections-openstack master: Existing images update name, visibility etc  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/86256508:41
jm1ard_: does this ^ work for you? are we missing anything?08:44
ard_jm1: I guess having min_disk and min_ram set to 0 if they were not defined is a good idea during image creation, but it is not a good idea during image change. You might try to change only one attribute of the image.08:44
ard_jm1: and it might not be min_disk or min_ram. This way you'll get this value reset to 008:44
jm1ard_: glance uses 0 as the default for both min_disk and min_ram, so i dropped the default values08:45
ard_cool08:45
jm1ard_: those default values werent documented anyway :/08:46
jm1ard_: have you been able to reproduce this image update issue when passing image instead of image.id?08:47
ard_jm1: I can on my sandbox08:47
ard_jm1: just in python shell08:48
jm1ard_: would you mind sharing the code and sdk's debug output with us (without secrets/tokens/..)?08:49
jm1so that gtema can have a look08:49
ard_jm1: and as I said before, I see the difference in formed body. I used pdb to trace what is tried to be sent. I was on the meeting and delayed a bit, but soon I will give you example of the script. 08:49
jm1ard_: ack, fyi sdk has a enable_logging() function which gives all important output, no need to use pdb08:51
ard_jm1: yeah, but sometimes you want to run commands and check how the vars will work in a functions by your hand. I will check enable_logging() I am new to this, so using only tools I used before...08:55
jm1ard_: just mentioning it because you can use this with ansible modules too which are otherwise hard to debug: https://review.opendev.org/c/openstack/bifrost/+/859430/11/playbooks/roles/bifrost-configdrives-dynamic/tasks/main.yml#3809:12
ard_jm1: thanks for this as well. I used epdb to connect to the process on remote systems running ansible tasks. This way I debugged module work. Just had small dependency in venv for the ansible.09:14
jm1ard_:  like this? https://docs.ansible.com/ansible/latest/dev_guide/debugging.html#simple-debugging09:21
ard_jm1: The script to reproduce https://paste.opendev.org/show/817369/09:22
ard_jm1: still looking how to sanitize debug sdk output. Even if it is for the sandbox in private network...09:22
jm1gtema: ^09:23
ard_jm1: exactly and the same way, just always got tracebacks on during debugging and now I know to use raise instead of print :) 09:24
ard_jm1: gtema: here is a log output https://paste.opendev.org/show/bpAMU2si0ezvN8Ckf3KP/ I tried to sanitize it... but it is on the sandbox in a private network, so should not have any sensitive data.10:00
jm1ard_: oh wow, what is this owner_specified.* stuff? gtema handing over to you :D10:06
gtemaowner_specified are the special props of sdk (checksum verification)10:06
ard_gtema: but it should not request them to be removed?10:08
gtemanope, should not10:08
gtemathis means to me (on the first sight) that those props were not returned in the get and therefore it tries to drop them10:08
gtemabtw, what is the update_payload?10:09
gtemaah, sorry10:09
gtemaard_ I can say that your script just worked for me10:19
gtemait is definitely wrong that it tries to unset owner_specified*, but it definitely worked10:20
ard_it change the image, but drop 40910:20
gtema200 for me, I assume you fall into cloud specifics10:21
jm1gtema: where does this 'stores' come from and why is it passed to glance api?10:21
ard_gtema: you mean it is something with my sandbox10:21
gtemawhich cloud you use?10:21
gtemaard_ or is it real upstream deployed as private cloud?10:22
ard_it is aio deployment for testing purposes10:22
gtemaok, never tried that10:23
gtemaI can reproduce it now once I try to set another property10:28
*** arxcruz is now known as arxcruz|ruck10:36
gtemaone awesome finding here: glance responds `Invalid operation: `move`. It must be one of the following: add, remove, replace.` and patch is generated by jsonpatch lib10:47
gtemathis looks like fun10:47
jm1gtema: incompatibility between jsonpatch lib used in glance and ard_'s venv or bug in glance?10:51
gtemano clue. It doesn't mean every user will face it, since you need to have situation where jsonpatch desides attribute is "renamed" keeping the content10:52
gtemajm1 ard_ - I am able to reproduce it now in the unittest, still digging where is it coming from. It is definitely a victim of magic properties handling12:04
jm1ard_: look at that, you can actually update the ramdisk and kernel in devstack https://storage.bhs.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_e3c/862864/1/check/ansible-collections-openstack-functional-devstack/e3c2883/job-output.txt12:25
opendevreviewJakob Meng proposed openstack/ansible-collections-openstack master: Existing images update name, visibility etc  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/86256512:29
*** njohnsto- is now known as njohnsto_14:02
arddennisjm1: yes you can probably update kernel and ramdisk, but at some point of time you could loose this ability. And the question was more to highlight my misunderstanding of the situation. Where the property which is supposed to be changeable is not and vise versa. 14:03
gtemaard_ jm1: instead of invoking update_image a call to update_image_properties can be used (https://paste.opendev.org/show/beYgrcpmaEw1pIM6cFtU/). This is what is currently used in the cloud layer and is working. I am still trying to find out why update_image itself is corrupting extra params14:49
arddennisgtema jm1: Do you think it is reasonable to move update for the properties out of the image update and make two api requests instead of one if properties are defined? It isn't hard to implement. 16:05
gtemapoint is that for historical reasons all "custom" properties of images are stored in OSC and SDK under "properties" attribute16:06
gtemaas customs all attrs not currently defined under Image resource are meant16:06
gtemaso when you want to access such prop - you need to look under image.properties["foo"]16:07
gtemaand when you want to update such props you need to use coinn.image.update_image_properties(foo="bar")16:07
arddennisyes, first when I saw it I was a little bit confused, then accepted it. 16:08
gtemaif you try to pass conn.image.update_image(foo="bar") foo is identified as custom property and then SDK does not know - what do you want to do with other custom properties - only change single one or reset them all16:08
gtemaproblem right now is merging or the nested dicts16:08
gtemabut I agree, this is now pretty confusing and not self-explaining from docs16:10
opendevreviewJakob Meng proposed openstack/ansible-collections-openstack master: Revert openstack.cloud.server parameter user_data to userdata  https://review.opendev.org/c/openstack/ansible-collections-openstack/+/86293516:28
servagemHi, could someone review this patch? It is missing one approval. Thank you. https://review.opendev.org/c/openstack/python-openstackclient/+/86251316:38
jm1arddennis: would you please review the latest patchset? https://review.opendev.org/c/openstack/ansible-collections-openstack/+/862565/17:20

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!