Mario, 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:
image_props = spec_obj.get('request_spec', {}).\ get('image', {}).get('properties', {}) 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. On Thu, Nov 10, 2016 at 12:05 AM, Keller, Mario <mario.kel...@cornelsen.de> wrote: > Hello, > > we are trying to build our own nova scheduler filter to separate machines > to different compute nodes / host aggregates. > Our setup is based on OpenStack Mitaka and we are using VMware as > hypervisor on 3 different compute nodes. > > We have created a /etc/glance/metadefs/CV_AggSelect.json file to define > the new property "os_selectagg" > > { > "namespace": "OS::Compute::cv-host-agg", > "display_name": "CV-CUSTOM: Select Host Aggregate", > "description": "Cornelsen CUSTOM: Select Host Aggregate", > "visibility": "public", > "protected": true, > "resource_type_associations": [ > { > "name": "OS::Glance::Image" > }, > { > "name": "OS::Nova::Aggregate" > } > ], > "properties": { > "os_selectagg": { > "title": "selectagg", > "description": "Cornelsen CUSTOM: Select Host Aggregate", > "type": "string", > "enum": [ > "windows", > "linux", > "desktop", > "test1", > "test2" > ], > "default" : "test2" > } > }, > "objects": [] > } > > > Getting the details from our image and the host aggregate we see that the > property is set correctly: > > openstack image show e62da4df-318f-48dc-be26-b634e82ec4a1 > +------------------+---------------------------------------- > ------------------------------------------------------------ > ------------------------------+ > | Field | Value > > | > +------------------+---------------------------------------- > ------------------------------------------------------------ > ------------------------------+ > ... > | properties | description='', hw_vif_model='VirtualVmxnet3', > hypervisor_type='vmware', os_selectagg='windows', | > | | vmware_adaptertype='lsiLogicsas', > vmware_disktype='preallocated', vmware_ostype='windows9Server64Guest > ... > > We also see the property in the aggregate: > > openstack aggregate show 5 > +-------------------+--------------------------------------------------+ > | Field | Value | > +-------------------+--------------------------------------------------+ > ... > | properties | hypervisor_type='vmware', os_selectagg='windows' | > .. > > I have created a new simple filter in /usr/lib/python2.7/site- > packages/nova/scheduler/filters just to see what properties are set for > the current image and the host_state. > 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. > > The filter only implements the " def host_passes(self, host_state, > spec_obj)" function. > > 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. > > The property is set in the host_state.aggregates list, but not in the > spec_obj.image.properties. What do we miss? > > With best regards, > Mario Keller. > > > > Mit freundlichen Grüßen > Mario Keller > IT-Operations Engineer > > -- > Cornelsen Verlag GmbH, Mecklenburgische Straße 53, 14197 Berlin > Tel: +49 30 897 85-8364, Fax: +49 30 897 85-97-8364 > E-Mail: mario.kel...@cornelsen.de | cornelsen.de > > AG Charlottenburg, HRB 114796 B > Geschäftsführung: Dr. Anja Hagen, Joachim Herbst, Mark van Mierle > (Vorsitz), > Patrick Neiss, Michael von Smolinski, Frank Thalhofer > > > _______________________________________________ > OpenStack-operators mailing list > OpenStack-operators@lists.openstack.org > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators >
_______________________________________________ OpenStack-operators mailing list OpenStack-operators@lists.openstack.org http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators