<div dir="ltr">Its pretty hard for me to parse the above or help more without a live pdb shell looking at this but I wonder if this is a Liberty vs Mitaka difference? We're still on nova liberty. The nova team may know more and/or I can figure out more once we upgrade since we may hit this same issue. One difference is that I'm not using the metadefs stuff but I don't know if that is relevant or not.<div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 11, 2016 at 3:24 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 Matt,<br>
<br>
I found you blog post to this and tried your code, but the problem is, that I get an error:<br>
<br>
“Returning exception 'RequestSpec' object has no attribute 'get' to caller”<br>
<br>
It seems the the call “image_props = spec_obj.get('request_spec', {})” provides an empty object.<br>
If I write an str(spec_obj.image.__dict__) I get:<br>
<br>
{'_obj_checksum': u'<wbr>793c47d1b98f9df93bbc09de4d155c<wbr>1b', '_context': <nova.context.RequestContext object at 0x636eed0>, '_obj_container_format': u'bare', '_obj_name': u'_MY_WINDOWS1', '_obj_min_disk': 1, '_obj_disk_format': u'iso', '_obj_owner': u'<wbr>cec13ed6b7bc42879cea9628dbad01<wbr>dc', '_obj_status': u'active', 'VERSION': u'1.8', '_obj_properties': ImageMetaProps(hw_<wbr>architecture=<?>,hw_auto_disk_<wbr>config=<?>,hw_boot_menu=<?>,<wbr>hw_cdrom_bus=<?>,hw_cpu_cores=<wbr><?>,hw_cpu_max_cores=<?>,hw_<wbr>cpu_max_sockets=<?>,hw_cpu_<wbr>max_threads=<?>,hw_cpu_policy=<wbr><?>,hw_cpu_realtime_mask=<?>,<wbr>hw_cpu_sockets=<?>,hw_cpu_<wbr>thread_policy=<?>,hw_cpu_<wbr>threads=<?>,hw_device_id=<?>,<wbr>hw_disk_bus='scsi',hw_disk_<wbr>type='preallocated',hw_<wbr>firmware_type=<?>,hw_floppy_<wbr>bus=<?>,hw_ipxe_boot=<?>,hw_<wbr>machine_type=<?>,hw_mem_page_<wbr>size=<?>,hw_numa_cpus=<?>,hw_<wbr>numa_mem=<?>,hw_numa_nodes=<?><wbr>,hw_qemu_guest_agent=<?>,hw_<wbr>rng_model=<?>,hw_scsi_model='<wbr>lsisas1068',hw_serial_port_<wbr>count=<?>,hw_video_model=<?>,<wbr>hw_video_ram=<?>,hw_vif_model=<wbr>'vmxnet3',hw_vif_multiqueue_<wbr>enabled=<?>,hw_vm_mode=<?>,hw_<wbr>watchdog_action=<?>,img_bdm_<wbr>v2=<?>,img_bittorrent=<?>,img_<wbr>block_device_mapping=<?>,img_<wbr>cache_in_nova=<?>,img_<wbr>compression_level=<?>,img_<wbr>config_drive=<?>,img_hv_<wbr>requested_version=<?>,img_hv_<wbr>type='vmware',img_linked_<wbr>clone=<?>,img_mappings=<?>,<wbr>img_owner_id=<?>,img_root_<wbr>device_name=<?>,img_signature=<wbr><?>,img_signature_certificate_<wbr>uuid=<?>,img_signature_hash_<wbr>method=<?>,img_signature_key_<wbr>type=<?>,img_use_agent=<?>,<wbr>img_version=<?>,os_admin_user=<wbr><?>,os_command_line=<?>,os_<wbr>distro='windows9Server64Guest'<wbr>,os_require_quiesce=<?>,os_<wbr>skip_agent_inject_files_at_<wbr>boot=<?>,os_skip_agent_inject_<wbr>ssh=<?>,os_type=<?>), '_obj_size': 281018368, '_obj_id': 'e62da4df-318f-48dc-be26-<wbr>b634e82ec4a1', '_changed_fields': set([u'status', u'name', u'container_format', u'created_at', u'disk_format', u'updated_at', u'properties', u'owner', u'min_ram', u'checksum', u'min_disk', u'id', u'size']), '_obj_min_ram': 1024, '_obj_created_at': datetime.datetime(2016, 8, 29, 8, 27, 47, tzinfo=<iso8601.Utc>), '_obj_updated_at': datetime.datetime(2016, 11, 9, 13, 10, 48, tzinfo=<iso8601.Utc>)}<br>
<br>
<br>
Using the spec_obj object itself, I get:<br>
<br>
{'_obj_instance_uuid': '22313c7f-0338-4bed-9131-<wbr>900b458347d9', '_obj_flavor': Flavor(created_at=2016-11-<wbr>01T14:26:31Z,deleted=False,<wbr>deleted_at=None,disabled=<wbr>False,ephemeral_gb=0,extra_<wbr>specs={},flavorid='7d5dbdd9-<wbr>62f9-4824-9e5e-803c69eef223',<wbr>id=23,is_public=True,memory_<wbr>mb=1024,name='1vCPU_1GB-RAM_<wbr>30GB-HDD',projects=<?>,root_<wbr>gb=30,rxtx_factor=1.0,swap=0,<wbr>updated_at=None,vcpu_weight=0,<wbr>vcpus=1), '_obj_scheduler_hints': {}, '_context': <nova.context.RequestContext object at 0x6ae7810>, '_obj_project_id': u'<wbr>027d9ea220bd41e88f9c55227788a8<wbr>63', '_obj_num_instances': 1, '_obj_limits': SchedulerLimits(disk_gb=None,<wbr>memory_mb=None,numa_topology=<wbr>None,vcpu=None), '_obj_instance_group': None, '_obj_ignore_hosts': None, '_obj_image': ImageMeta(checksum='<wbr>793c47d1b98f9df93bbc09de4d155c<wbr>1b',container_format='bare',<wbr>created_at=2016-08-29T08:27:<wbr>47Z,direct_url=<?>,disk_<wbr>format='iso',id=e62da4df-318f-<wbr>48dc-be26-b634e82ec4a1,min_<wbr>disk=1,min_ram=1024,name='_MY_<wbr>WINDOWS1',owner='<wbr>cec13ed6b7bc42879cea9628dbad01<wbr>dc',properties=ImageMetaProps,<wbr>protected=<?>,size=281018368,<wbr>status='active',tags=<?>,<wbr>updated_at=2016-11-09T13:10:<wbr>48Z,virtual_size=<?>,<wbr>visibility=<?>), '_obj_force_hosts': None, 'VERSION': u'1.5', '_obj_force_nodes': None, '_obj_pci_requests': InstancePCIRequests(instance_<wbr>uuid=22313c7f-0338-4bed-9131-<wbr>900b458347d9,requests=[]), '_obj_retry': SchedulerRetries(hosts=<wbr>ComputeNodeList,num_attempts=<wbr>1), '_changed_fields': set([u'instance_uuid', u'retry', u'num_instances', u'pci_requests', u'limits', u'availability_zone', u'force_nodes', u'image', u'instance_group', u'force_hosts', u'numa_topology', u'ignore_hosts', u'flavor', u'project_id', u'scheduler_hints']), '_obj_numa_topology': None, '_obj_availability_zone': u'CV_Inhouse_RZ2', 'config_options': {}}<br>
<br>
So there seems no request_spec present. There's an attribute "image" within spec_obj that has an attribute properties of the type ImageMetaProps that has all the vmware related properties that are defined the same way then our properties, but not our self defined property.<br>
<br>
Mario.<br>
<br>
<br>
Von: <a href="mailto:tadowguy@gmail.com">tadowguy@gmail.com</a> [mailto:<a href="mailto:tadowguy@gmail.com">tadowguy@gmail.com</a>] Im Auftrag von Matt Fischer<br>
Gesendet: Donnerstag, 10. November 2016 15:27<br>
An: Keller, Mario<br>
Cc: <a href="mailto:openstack-operators@lists.openstack.org">openstack-operators@lists.<wbr>openstack.org</a><br>
Betreff: Re: [Openstack-operators] Properties missing in Nova Scheduler Filter<br>
<div class="HOEnZb"><div class="h5"><br>
Mario,<br>
<br>
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:<br>
<br>
        image_props = spec_obj.get('request_spec', {}).\<br>
            get('image', {}).get('properties', {})<br>
<br>
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.<br>
<br>
<br>
On Thu, Nov 10, 2016 at 12:05 AM, Keller, Mario <<a href="mailto:Mario.Keller@cornelsen.de">Mario.Keller@cornelsen.de</a>> wrote:<br>
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>
<br>
</div></div></blockquote></div><br></div></div>