<div dir="ltr">Mario,<div><br></div><div>If I remember right I had a similar issue with getting image_props when I was doing this to pull in custom properties. Through some trial and error and poking around with pdb I ended up with this:</div><div><br></div><div><div>        image_props = spec_obj.get('request_spec', {}).\</div><div>            get('image', {}).get('properties', {})</div></div><div><br></div><div>Perhaps that will help?  If not I'd recommend putting a pdb break at the top of host_passes and digging through the spec_obj.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 10, 2016 at 12:05 AM, Keller, Mario <span dir="ltr"><<a href="mailto:Mario.Keller@cornelsen.de" target="_blank">Mario.Keller@cornelsen.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
we are trying to build our own nova scheduler filter to separate machines to different compute nodes / host aggregates.<br>
Our setup is based on OpenStack Mitaka and we are using VMware as hypervisor on 3 different compute nodes.<br>
<br>
We have created a /etc/glance/metadefs/CV_<wbr>AggSelect.json file to define the new property "os_selectagg"<br>
<br>
{<br>
    "namespace": "OS::Compute::cv-host-agg",<br>
    "display_name": "CV-CUSTOM: Select Host Aggregate",<br>
    "description": "Cornelsen CUSTOM: Select Host Aggregate",<br>
    "visibility": "public",<br>
    "protected": true,<br>
    "resource_type_associations": [<br>
        {<br>
            "name": "OS::Glance::Image"<br>
        },<br>
        {<br>
            "name": "OS::Nova::Aggregate"<br>
        }<br>
    ],<br>
        "properties": {<br>
            "os_selectagg": {<br>
                "title": "selectagg",<br>
                "description": "Cornelsen CUSTOM: Select Host Aggregate",<br>
                "type": "string",<br>
                "enum": [<br>
                    "windows",<br>
                    "linux",<br>
                    "desktop",<br>
                    "test1",<br>
                    "test2"<br>
                ],<br>
                "default" : "test2"<br>
        }<br>
    },<br>
    "objects": []<br>
}<br>
<br>
<br>
Getting the details from our image and the host aggregate we see that the property is set correctly:<br>
<br>
openstack image show e62da4df-318f-48dc-be26-<wbr>b634e82ec4a1<br>
+------------------+----------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>+<br>
| Field            | Value                                                                                                                            |<br>
+------------------+----------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>+<br>
...<br>
| properties       | description='', hw_vif_model='VirtualVmxnet3', hypervisor_type='vmware', os_selectagg='windows',            |<br>
|                  | vmware_adaptertype='<wbr>lsiLogicsas', vmware_disktype='preallocated'<wbr>, vmware_ostype='<wbr>windows9Server64Guest<br>
...<br>
<br>
We also see the property in the aggregate:<br>
<br>
openstack aggregate show 5<br>
+-------------------+---------<wbr>------------------------------<wbr>-----------+<br>
| Field             | Value                                            |<br>
+-------------------+---------<wbr>------------------------------<wbr>-----------+<br>
...<br>
| properties        | hypervisor_type='vmware', os_selectagg='windows' |<br>
..<br>
<br>
I have created a new simple filter in /usr/lib/python2.7/site-<wbr>packages/nova/scheduler/<wbr>filters  just to see what properties are set for the current image and the host_state.<br>
The filter is also set in the  /etc/nova/nova.conf and is executed, because I'm getting the logfile that ist created by the filter.<br>
<br>
The filter only implements the " def host_passes(self, host_state, spec_obj)" function.<br>
<br>
I'm getting the image properties by " image_props = spec_obj.image.properties if spec_obj.image else {} ", but the property "os_selectagg" is missing. All other properties like hw_vif_model='VirtualVmxnet3' are set.<br>
<br>
The property is set in the host_state.aggregates list, but not in the spec_obj.image.properties. What do we miss?<br>
<br>
With best regards,<br>
Mario Keller.<br>
<br>
<br>
<br>
Mit freundlichen Grüßen<br>
Mario Keller<br>
IT-Operations Engineer<br>
 <br>
--<br>
Cornelsen Verlag GmbH, Mecklenburgische Straße 53, 14197 Berlin<br>
Tel: +49 30 897 85-8364, Fax: +49 30 897 85-97-8364<br>
E-Mail: <a href="mailto:mario.keller@cornelsen.de">mario.keller@cornelsen.de</a> | <a href="http://cornelsen.de" rel="noreferrer" target="_blank">cornelsen.de</a><br>
<br>
AG Charlottenburg, HRB 114796 B<br>
Geschäftsführung: Dr. Anja Hagen, Joachim Herbst, Mark van Mierle (Vorsitz),<br>
Patrick Neiss, Michael von Smolinski, Frank Thalhofer<br>
<br>
<br>
______________________________<wbr>_________________<br>
OpenStack-operators mailing list<br>
<a href="mailto:OpenStack-operators@lists.openstack.org">OpenStack-operators@lists.<wbr>openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators" rel="noreferrer" target="_blank">http://lists.openstack.org/<wbr>cgi-bin/mailman/listinfo/<wbr>openstack-operators</a><br>
</blockquote></div><br></div>