External_source_image_url for type:openstack

I am using following json file to create qcow from external_source_image.

{
“builders”: [
{
“type”: “openstack”,
“identity_endpoint”: “http://10.10.10.1:5000/v3”,
“tenant_id”: <tenant_id>,
“username”: “parallel”,
“password”: “wireless”,
“region”: “RegionOne”,
“ssh_username”: “root”,
“image_name”: “Rishikesh-test-packer-1”,
“external_source_image_url”: “/root/rshinde/input_image/abcd.qcow”,
“external_source_image_format”: “qcow2”,
“networks”: ,
“flavor”: “flavourOne”
}
]
}

I am getting following error on this

==> openstack: Error importing source image: Bad request with: [POST http://10.10.10.1:9292/v2/images/255094d5-4d41-4c30-b7a4-79848df4050c/import], error message: {“message”: “URI for web-download does not pass filtering: /root/rshinde/input_image/abcd.qcow2

\n\n\n”, “code”: “400 Bad Request”, “title”: “Bad Request”}

is there some specific format that needs to be followed for external_source_image_url ?? pls suggest

I’m not sure it works for local files; but try providing the file prefix and see if the API accepts it: “file://root/rshinde/input_image/abcd.qcow”

The image specified in the external_source_image_url is downloaded by OpenStack Glance using the web-download image import method (see packer/builder/openstack/step_source_image_info.go#L72-L77).

You will need to specify an HTTP endpoint that is accessible from the machine running the Glance Store.

Thanks , making it as http endpoint worked.

guys, I’m having a similar problem using the openstack plugin:

here is my hcl file

packer {
  required_plugins {
    openstack = {
      version = ">= 1.1.2"
      source  = "github.com/hashicorp/openstack"
    }
  }
}

source "openstack" "demo" {
  identity_endpoint         = "https://FQDN:5000"
  flavor                    = "small"
  image_name                = "packer-image"
  external_source_image_url = "https://FQDN:9292/v3/images/837712cf-c4ad-44ab-bbf0-9d5220c642a7"
  ssh_username              = "rocky"
  security_groups           = ["build-group"]
}

build {
  sources = ["source.openstack.demo"]
}

and here are the errors:

$ packer build .
openstack.demo: output will be in this color.

==> openstack.demo: Loading flavor: small
==> openstack.demo: Verified flavor. ID: 09abb77a-39d6-47a2-8f46-635def3d45f8
==> openstack.demo: Creating temporary RSA SSH key for instance...
==> openstack.demo: Creating temporary keypair: packer_685eb426-08e7-e9e6-9124-df45368c8617 ...
==> openstack.demo: Created temporary keypair: packer_685eb426-08e7-e9e6-9124-df45368c8617
==> openstack.demo: Creating image using external source image with name packer_685eb426-1bca-9b02-3440-74e849409f7b
==> openstack.demo: Using disk format qcow2
==> openstack.demo: Created image with ID 77cf07c9-ca25-4a05-bdc9-1276736c8b8a
==> openstack.demo: Importing External Source Image from URL https://FQDN:9292/v3/images/837712cf-c4ad-44ab-bbf0-9d5220c642a7
==> openstack.demo: Error importing source image: Bad request with: [POST https://FQDN:9292/v2/images/77cf07c9-ca25-4a05-bdc9-1276736c8b8a/import], error message: {"message": "URI for web-download does not pass filtering: https://FQDN:9292/v3/images/837712cf-c4ad-44ab-bbf0-9d5220c642a7<br /><br />\n\n\n", "code": "400 Bad Request", "title": "Bad Request"}
==> openstack.demo: Deleting temporary external source image: packer_685eb426-1bca-9b02-3440-74e849409f7b ...
==> openstack.demo: error cleaning up external source image: Resource not found
==> openstack.demo: Deleting temporary keypair: packer_685eb426-08e7-e9e6-9124-df45368c8617 ...
Build 'openstack.demo' errored after 2 seconds 233 milliseconds: error cleaning up external source image: Resource not found

==> Wait completed after 2 seconds 233 milliseconds

==> Some builds didn't complete successfully and had errors:
--> openstack.demo: error cleaning up external source image: Resource not found

==> Builds finished but no artifacts were created.

Please help.