# OpenStack Tacker 散筆: VNF Package `no images matching` 今天照著 OpenStack Tacker 他們[官方的教學文件](https://docs.openstack.org/tacker/2023.1/install/etsi_getting_started.html)實作一次,在 instantiate VNF 的時候發現不論怎麼嘗試都會進到 ERROR State,Tacker cli 跟 Tacker Horizon 又沒有詳細的細節 = =。 於是乎,花了幾個小時的時間終於在茫茫大海裡找到了這個 Log, ``` ERROR oslo_messaging.rpc.server tacker.common.exceptions.VnfInstantiationFailed: Vnf instantiation failed for vnf ebd84c1e-83f2-41e7-bb0b-c0b0628ef07e, error: ERROR: Property error: : resources.VDU1.properties.image: : Error validating value '': No images matching {'name': ''}. ``` `No images matching {'name': ''}` !? 怎麼回事?照著做居然會找不到 VDU 的 image。 再花幾個小時終於撈到了[解析 TOSCA template 的 library](https://github.com/openstack/heat-translator/blame/da40f68136625ace7c5eb42961dd65c2c97e18d1/translator/hot/tosca/etsi_nfv/tosca_nfv_vdu_compute.py#L30),發現在[這行](https://github.com/openstack/heat-translator/blame/da40f68136625ace7c5eb42961dd65c2c97e18d1/translator/hot/tosca/etsi_nfv/tosca_nfv_vdu_compute.py#L59)解析 `sw_image_data` 的時候居然沒有拿 template 裡面的值。 再次在茫茫大海中找資料,找到了某位[日本網友分享的內容](https://qiita.com/nakkoh/items/10d225fc8f029145987d#vnf%E3%81%AE%E4%BD%9C%E6%88%90),他發現 `tosca.nodes.nfv.Vdu.Compute` 底下要加上 Artifacts 才能讓 heat 找到 image 。 再回到[上面提到的 library](https://github.com/openstack/heat-translator/blame/da40f68136625ace7c5eb42961dd65c2c97e18d1/translator/hot/tosca/etsi_nfv/tosca_nfv_vdu_compute.py#L30) commit 裡面有提到他們實做的 spec ,可以發現在 5.9.6.2 Artifacts 的章節提到有另一個必須要填的欄位 `SwImage`。 全部改完之後會像是這樣: ```yaml= VDU1: type: tosca.nodes.nfv.Vdu.Compute artifacts: sw_image: file: ../Files/images/cirros-0.5.2-x86_64-disk.img type: tosca.artifacts.nfv.SwImage properties: name: VDU1 description: VDU1 compute node vdu_profile: min_number_of_instances: 1 max_number_of_instances: 1 sw_image_data: name: cirros-0.5.2-x86_64-disk version: '0.5.2' checksum: algorithm: sha-512 hash: 6b813aa46bb90b4da216a4d19376593fa3f4fc7e617f03a92b7fe11e9a3981cbe8f0959dbebe36225e5f53dc4492341a4863cac4ed1ee0909f3fc78ef9c3e869 container_format: bare disk_format: qcow2 min_disk: 1 GB size: 1 GB # ... ``` 基本上只要在 `Files/images/` 底下有對應的 image 檔案就可以成功跑起來摟。 # Refs - https://docs.openstack.org/tacker/2023.1/install/etsi_getting_started.html - https://qiita.com/nakkoh/items/10d225fc8f029145987d - https://github.com/openstack/heat-translator - https://docs.oasis-open.org/tosca/tosca-nfv/v1.0/tosca-nfv-v1.0.html