Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build image when using root block storage volume #123

Open
nqngo opened this issue Apr 11, 2024 · 0 comments
Open

Unable to build image when using root block storage volume #123

nqngo opened this issue Apr 11, 2024 · 0 comments
Labels

Comments

@nqngo
Copy link

nqngo commented Apr 11, 2024

I have been building the glance image without using Cinder block storage volume and that works fine. However, building the a packer Openstack image using block storage volume errored out with HTTP 403 Forbidden: Access was denied to this resource.: Attribute 'os_glance_failed_import' is reserved.

I have also did a manual test by:

  • Create a bootable volume in Openstack using the external image.
  • Run cinder upload-to-image.
  • The glance image is successful created.

cinder upload-to-image uses the same API endpoint as Packer Openstack plugin

http://api.openstack.cloud:8776/v3/0a3ec33c5c634ae58ed420ff1daa222e/volumes/5f42fd30-23cb-4956-95ab-ae885c66ca24/action

We are running Openstack Yoga. I suspect this is due to the really old version of gophercloud that this plugin uses:
https://github.com/hashicorp/packer-plugin-openstack/blob/main/go.mod#L7

The current stable gophercloud release is already at v1.1.0 and on track to release v2.0.0.

Reproduction Steps

Steps to reproduce this issue:

packer build ubuntu.pkr.hcl

Plugin and Packer version

packer --version
Packer v1.10.2
packer plugins installed
/home/ubuntu/.config/packer/plugins/github.com/hashicorp/openstack/packer-plugin-openstack_v1.1.2_x5.0_linux_amd64

Simplified Packer Buildfile

source "openstack" "linux" {
  image_tags                    = ["ubuntu-lts", "ubuntu-20.04"]
  external_source_image_url     = "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
  external_source_image_format  = "qcow2"
  cloud                         = "packer-image-builder"
  flavor                        = "small"
  region                        = "nova"
  availability_zone             = "nova"
  image_disk_format             = "raw"
  image_visibility              = "private"
  image_min_disk                = 10
  networks                      = ["cdcdb248-9cba-498b-9227-ca04b03c038e"]
  security_groups               = ["dff27e7d-56dc-49a8-a3f9-e8bc3dd0972a"]
  communicator                  = "ssh"
  ssh_clear_authorized_keys     = true
  ssh_timeout                   = "10m"
  ssh_bastion_host              = "packer-bastion"
  ssh_bastion_username          = "ubuntu"
  ssh_bastion_private_key_file  = "~/.ssh/id_rsa"
  ssh_username                  = "ubuntu"
  use_blockstorage_volume       = true
  volume_size                   = 10
  volume_type                   = "ssd"
}

build {
  source "openstack.linux" {
    name                      = "ubuntu-20.04-plain"
    image_name                = "Ubuntu 20.04 LTS Server amd64-${local.timestamp}"
  }
}

Log Fragments and crash.log files

$ packer build no1-u2004-plain.pkr.hcl
openstack.ubuntu-20.04-plain: output will be in this color.

==> openstack.ubuntu-20.04-plain: Loading flavor: small
    openstack.ubuntu-20.04-plain: Verified flavor. ID: 3afdf992-b8a3-41ff-8bf7-c2003ec93822
==> openstack.ubuntu-20.04-plain: Creating temporary RSA SSH key for instance...
==> openstack.ubuntu-20.04-plain: Creating temporary keypair: packer_6617b261-5ac5-5a6c-3377-9f024c66fa6e ...
==> openstack.ubuntu-20.04-plain: Created temporary keypair: packer_6617b261-5ac5-5a6c-3377-9f024c66fa6e
==> openstack.ubuntu-20.04-plain: Creating image using external source image with name packer_6617b261-f0b0-e9b8-72ef-b047343b09bd
==> openstack.ubuntu-20.04-plain: Using disk format qcow2
==> openstack.ubuntu-20.04-plain: Created image with ID ecaa1141-310a-492a-8c10-858d5aeb1599
==> openstack.ubuntu-20.04-plain: Importing External Source Image from URL https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
    openstack.ubuntu-20.04-plain: Image not Active, retrying in 10 seconds
    openstack.ubuntu-20.04-plain: Image not Active, retrying in 10 seconds
==> openstack.ubuntu-20.04-plain: Creating volume...
==> openstack.ubuntu-20.04-plain: Waiting for volume packer_6617b261-84d9-da68-ce53-25d674bb7fde (volume id: 5f42fd30-23cb-4956-95ab-ae885c66ca24) to become available...
    openstack.ubuntu-20.04-plain: Volume ID: 5f42fd30-23cb-4956-95ab-ae885c66ca24
==> openstack.ubuntu-20.04-plain: Launching server...
==> openstack.ubuntu-20.04-plain: Launching server...
    openstack.ubuntu-20.04-plain: Server ID: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3
==> openstack.ubuntu-20.04-plain: Waiting for server to become ready...
    openstack.ubuntu-20.04-plain: Floating IP not required
==> openstack.ubuntu-20.04-plain: Using SSH communicator to connect: 10.0.1.58
==> openstack.ubuntu-20.04-plain: Waiting for SSH to become available...
==> openstack.ubuntu-20.04-plain: Connected to SSH!
==> openstack.ubuntu-20.04-plain: Trying to remove ephemeral keys from authorized_keys files
==> openstack.ubuntu-20.04-plain: Stopping server: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3 ...
    openstack.ubuntu-20.04-plain: Waiting for server to stop: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3 ...
==> openstack.ubuntu-20.04-plain: Terminating the source server: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3 ...
==> openstack.ubuntu-20.04-plain: Creating the image: Ubuntu 20.04 LTS Server amd64-20240411
==> openstack.ubuntu-20.04-plain: Error creating image: Bad request with: [POST http://api.openstack.cloud:8776/v3/0a3ec33c5c634ae58ed420ff1daa222e/volumes/5f42fd30-23cb-4956-95ab-ae885c66ca24/action], error message: {"badRequest": {"code": 400, "message": "HTTP 403 Forbidden: Access was denied to this resource.: Attribute 'os_glance_failed_import' is reserved."}}
==> openstack.ubuntu-20.04-plain: Provisioning step had errors: Running the cleanup provisioner, if present...
==> openstack.ubuntu-20.04-plain: Terminating the source server: 83b4e3ae-a02e-47cb-bf98-06bc6ff3f0a3 ...
==> openstack.ubuntu-20.04-plain: Error terminating server, may still be around: Resource not found
==> openstack.ubuntu-20.04-plain: Deleting volume: 5f42fd30-23cb-4956-95ab-ae885c66ca24 ...
==> openstack.ubuntu-20.04-plain: Deleting temporary external source image: packer_6617b261-f0b0-e9b8-72ef-b047343b09bd ...
==> openstack.ubuntu-20.04-plain: Deleting temporary keypair: packer_6617b261-5ac5-5a6c-3377-9f024c66fa6e ...
Build 'openstack.ubuntu-20.04-plain' errored after 1 minute 31 seconds: Error creating image: Bad request with: [POST http://api.openstack.cloud:8776/v3/0a3ec33c5c634ae58ed420ff1daa222e/volumes/5f42fd30-23cb-4956-95ab-ae885c66ca24/action], error message: {"badRequest": {"code": 400, "message": "HTTP 403 Forbidden: Access was denied to this resource.: Attribute 'os_glance_failed_import' is reserved."}}
@nqngo nqngo added the bug label Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant