Possible to create Openstack images in qcow2 format with packer without specifying in the post-proc?

1,269 views
Skip to first unread message

Lorena Lobato

unread,
Aug 1, 2016, 3:59:43 AM8/1/16
to Packer
Hello,

Is it possible to create an OS image already compressed? All the tests that I was doing is always in raw format. We are not interested in compress the image in the post-processor. And we need to compress somehow the image since it is too big (impossible to reduce it in our case)

Could I use "qemu" builder and "OS" builder in the same template to carry out this approach?

Thanks so much in advance
Regards
Lorena

Lorena Lobato

unread,
Aug 8, 2016, 10:36:19 AM8/8/16
to Packer
Hello,

Fixed by uploading packer to 0.10.1 version and using post-processor for OpenStack (which is valid with this version). In this post-processor I called to a script which was downloading the "snapshot", convert it to qcow2 (and compress it) and upload it again to glance.

For the record, only using OS builder.

Thanks
Lore

Stacy Véronneau

unread,
Dec 13, 2016, 6:44:54 PM12/13/16
to Packer
Hello Lorena,

Could you post your post-processor syntax and the script to download, convert, compress and upload in Glance?

Thank you!

/Stacy

Lorena Lobato

unread,
Dec 16, 2016, 11:47:43 AM12/16/16
to Packer
Hello Stacy,

Sure. 

   "post-processors": [

    {

    "type": "shell-local",

    "inline": [

      "/usr/bin/glance image-download  snapshotv2016 --file /tmp/tempImage.qcow2

      "/usr/bin/qemu-img convert -p -c -O qcow2  tempImage imagecompressed01.qcow2",

      "/usr/bin/glance image-create --name final_image --file imagecompressed01.qcow2 --disk-format qcow2 --container-format bare"

      ]

    }]

Hope it helps :-)

Cheers,

Lorena

Lorena Lobato

unread,
Dec 16, 2016, 11:52:54 AM12/16/16
to Packer

Sorry, have typed too fast :-)


 "post-processors": [

    {

    "type": "shell-local",

    "inline": [

      "/usr/bin/glance image-download  snapshotv2016 --file /tmp/tempImage.qcow2

      "/usr/bin/qemu-img convert -p -c -O qcow2  /tmp/tempImage.qcow2 imagecompressed01.qcow2",

      "/usr/bin/glance image-create --name final_image --file imagecompressed01.qcow2 --disk-format qcow2 --container-format bare"

      ]

    }]


Reply all
Reply to author
Forward
0 new messages