<div>
<div>Hi everyone,</div><div><br></div><div>This is my first question here. I hope I could get an answer for the problem I'm currently facing in the development of a nova API extension. I am trying to add a couple of API endpoints that would serve as an interface to the table storing some data. I was able to create an API endpoint by placing my extension in api/openstack/compute/contrib and modifying the policy.json file. This is now working.</div><div><br></div><div>I then added the migration to create a table to nova/db/sqlalchemy/migrate_repo_versions/245_add_custom_table.</div><div><br></div><div>After unstack.sh and stack.sh (I'm using devstack) I can see my table being created. Great.</div><div><br></div><div>Next, I proceeded with creating an object definition and created a file in nova/objects. I am basing myself on keypairs.py example (https://github.com/openstack/nova/blob/2efd3faa3e07fdf16c2d91c16462e7e1e3f33e17/nova/api/openstack/compute/contrib/keypairs.py#L97)</div><div><br></div><div> self.api.create_key_pair</div><div><br></div><div>calls this https://github.com/openstack/nova/blob/839fe777e256d36e69e9fd7c571aed2c860b122c/nova/compute/api.py#L3512</div><div>the important part is</div><div><br></div><div> keypair = keypair_obj.KeyPair()</div><div> keypair.user_id = user_id</div><div> keypair.name = key_name</div><div> keypair.fingerprint = fingerprint</div><div> keypair.public_key = public_key</div><div> keypair.create(context)</div><div><br></div><div>`KeyPair()` is https://github.com/openstack/nova/blob/master/nova/objects/keypair.py</div><div><br></div><div>this has a method https://github.com/openstack/nova/blob/master/nova/objects/keypair.py#L52</div><div>and it's calling `db_keypair = db.key_pair_create(context, updates)`</div><div>`db` points to `from nova import db`</div><div><br></div><div>which I believe points to this https://github.com/openstack/nova/blob/master/nova/db/__init__.py</div><div>which loads https://github.com/openstack/nova/blob/master/nova/db/api.py</div><div>there's a function called https://github.com/openstack/nova/blob/master/nova/db/api.py#L922</div><div>`key_pair_create` https://github.com/openstack/nova/blob/master/nova/db/api.py#L924</div><div><br></div><div>`IMPL` is https://github.com/openstack/nova/blob/master/nova/db/api.py#L69-L95</div><div>but where is `IMPL.key_pair_create`?</div><div><br></div><div>Is there an easy way to insert a record into the table?</div><div>Thank you for any pointers.</div><div><br></div><div>I’ve posted the same question on ask.openstack.org (https://ask.openstack.org/en/questions/30231) and I also asked this question on openstack-dev (which I know by now is wrong).</div></div><div>
<p style="font-family: Helvetica; font-size: 10pt; margin-bottom: 0cm;">
</p><p style="font-family: Helvetica; font-size: 10pt; margin-bottom: 0cm;">
</p><p style="margin-bottom: 0cm;">
</p><p style="margin-bottom: 0cm"><font color="#000000"><font face="Helvetica, sans-serif"><font style="font-size: 9pt">Kind
regards,
<br>Radek
Gruchalski<br>
</font></font></font><font face="Helvetica, sans-serif"><font style="font-size: 9pt"><a href="mailto:radek@gruchalski.com">radek@gruchalski.com</a><a href="mailto:radek@gruchalski.com">
</a></font></font><font color="#0084d1"><font face="Helvetica, sans-serif"><font style="font-size: 9pt"><br></font></font></font><a href="http://de.linkedin.com/in/radgruchalski/"><font color="#0084d1"><font face="Helvetica, sans-serif"><font style="font-size: 9pt">de.linkedin.com/in/radgruchalski/</font></font></font></a><font color="#0084d1"><font face="Helvetica, sans-serif"><font style="font-size: 9pt"><u><br></u></font></font></font><font color="#000000"><font face="Helvetica, sans-serif"><font style="font-size: 9pt">+4917685656526<br><br></font></font></font><font color="#878787"><font face="Helvetica, sans-serif"><font style="font-size: 8pt"><b>Confidentiality:<br></b></font></font></font><font color="#878787"><font face="Helvetica, sans-serif"><font style="font-size: 8pt">This
communication is intended for the above-named person and may be
confidential and/or legally privileged.<br>If it has come to you in
error you must take no action based on it, nor must you copy or show
it to anyone; please delete/destroy and inform the sender
immediately.</font></font></font></p></div>