axsh / wakame-vdc

Datacenter Hypervisor - Open Source Cloud Computing / IaaS
http://wakame-vdc.org
109 stars 28 forks source link

packer build failed because of UnknownBackupStorage #769

Open qb0C80aE opened 8 years ago

qb0C80aE commented 8 years ago

issue

When I tried to build machine image by packer-wakamevdc, an UnknownBackupStorage occured. It said there was no backup storage named 'bkst-local', but I couldn't find any parameters about backup storage in related source files under wakame-vdc/client/. My vdc has no backup storage named 'bkst-local'. It looks packer-builder-wakamevdc always tries to put image into 'bkst-local'.

log:

$ packer build packer-wakamevdc.json 
wakamevdc output will be in this color.

==> wakamevdc: Creating SSH Key...
--snip--
==> wakamevdc: Power off instance...
==> wakamevdc: Instance halted...
==> wakamevdc: Taking instance backup...
==> wakamevdc: Error taking instance backup: API Error: Type: Dcmgr::Endpoints::Errors::UnknownBackupStorage, Code: 153, Message: bkst-local, (HTTP 404)
==> wakamevdc: Terminating the instance because cancelation or error...
==> wakamevdc: Deleting temporary ssh key...
==> wakamevdc: Deleting temporary security group...
Build 'wakamevdc' errored: Error taking instance backup: API Error: Type: Dcmgr::Endpoints::Errors::UnknownBackupStorage, Code: 153, Message: bkst-local, (HTTP 404)

My backup storage setting is like below:

vdc-manage>> backupstorage show
UUID            Storage Type         Base URI            
bkst-demo1      local                file:///opt/axsh/wakame-vdc/images/
vdc-manage>> 

packer-wakamevdc.json:

{
  "builders": [
    {
      "type": "wakamevdc",
      "api_endpoint": "http://xxx.xxx.xxx.xxx:9001/api/12.03/",
      "image_id": "wmi-xxxx",
      "hypervisor": "kvm",
      "cpu_cores": 1,
      "memory_size": 512,
      "network_id": "nw-xxxx",
      "ssh_username": "root",
      "ssh_timeout": "60m"
    }
  ],
  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "echo \"nameserver 8.8.8.8\" > /etc/resolve.conf",
        "yum update -y"
      ]
    }
  ]
}

fyi, It works almost fine after adding bkst-local. (It still has an error of ssh key/security group deletion, though.)

vdc-manage>> backupstorage add --uuid bkst-local --base-uri=file:///opt/axsh/wakame-vdc/images/ --storage-type=local
bkst-local
vdc-manage>> backupstorage show
UUID            Storage Type         Base URI            
bkst-demo1      local                file:///opt/axsh/wakame-vdc/images/
bkst-local      local                file:///opt/axsh/wakame-vdc/images/
==> wakamevdc: Instance halted...
==> wakamevdc: Taking instance backup...
==> wakamevdc: New image: wmi-3cngjx4v
==> wakamevdc: Image created...
==> wakamevdc: Terminate instance...
==> wakamevdc: Deleting temporary ssh key...
==> wakamevdc: Error cleaning up ssh key (ssh-472bri51). Please delete the key manually: API Error: Type: Dcmgr::Endpoints::Errors::ExistsRegisteredInstance, Code: 158, Message: Number of instance reference is not zero: 1., (HTTP 400)
==> wakamevdc: Deleting temporary security group...
==> wakamevdc: Error cleaning up security group (sg-qdnxvr9x). Please delete the security group manually: API Error: Type: Dcmgr::Endpoints::Errors::OperationNotPermitted, Code: 105, Message: Dcmgr::Endpoints::Errors::OperationNotPermitted, (HTTP 403)
Build 'wakamevdc' finished.

==> Builds finished. The artifacts of successful builds are:
--> wakamevdc: A machine image was created: 'wmi-3cngjx4v'

I guess there should be the backup-storage-uuid parameter which is optional. (or perhaps, is there that already? if so, sorry that I couldn't find.)

branch

packer-builder

unakatsuo commented 8 years ago

Since there was no parameter to set the upload destination, I have added new backup_storage_id conf parameter.

Also the fix for some resource cleanup issues are included.

f88814c is the new HEAD of packer-builder branch. packer-builder-wakamevdc.zip