{"action":"created","issue":{"url":"https://api.github.com/repos/mitchellh/packer/issues/3959","repository_url":"https://api.github.com/repos/mitchellh/packer","labels_url":"https://api.github.com/repos/mitchellh/packer/issues/3959/labels{/name}","comments_url":"https://api.github.com/repos/mitchellh/packer/issues/3959/comments","events_url":"https://api.github.com/repos/mitchellh/packer/issues/3959/events","html_url":"https://github.com/mitchellh/packer/issues/3959","id":180831348,"number":3959,"title":"[FEATURE] qemu builder using existing qcow2 image file","user":{"login":"candlerb","id":44789,"avatar_url":"https://avatars.githubusercontent.com/u/44789?v=3","gravatar_id":"","url":"https://api.github.com/users/candlerb","html_url":"https://github.com/candlerb","followers_url":"https://api.github.com/users/candlerb/followers","following_url":"https://api.github.com/users/candlerb/following{/other_user}","gists_url":"https://api.github.com/users/candlerb/gists{/gist_id}","starred_url":"https://api.github.com/users/candlerb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/candlerb/subscriptions","organizations_url":"https://api.github.com/users/candlerb/orgs","repos_url":"https://api.github.com/users/candlerb/repos","events_url":"https://api.github.com/users/candlerb/events{/privacy}","received_events_url":"https://api.github.com/users/candlerb/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mitchellh/packer/labels/builder/qemu","name":"builder/qemu","color":"d4c5f9"},{"url":"https://api.github.com/repos/mitchellh/packer/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-10-04T08:19:38Z","updated_at":"2016-10-04T10:34:10Z","closed_at":null,"body":"I would like a variant of the qemu builder which instead of installing from an ISO image, starts from an existing qcow2 image<sup>1</sup>\r\n\r\nUse case: you are building lots of VM variations from the same base ISO image, with different provisioners.\r\n\r\nThe ISO install process is by far the slowest part of the build; hence it would be *much* faster to run the ISO install once and then run multiple provisioner installs using the same qcow2 base.\r\n\r\nThis could also be thought of as an analog to the EC2 builder working from an existing AMI.\r\n\r\nThis builder would still have to create the qcow2 file and start qemu with the right options. Making it a mode of the existing qemu provisioner might be the simplest approach?\r\n\r\n-----\r\n\r\n<sup>1</sup> you could simply `cp` the existing qcow2 file, but a better solution is to make a new qcow2 file with the original one as copy-on-write base:\r\n\r\n~~~\r\nqemu-img create -f qcow2 -b path/to/old.qcow2 path/to/new.qcow2\r\n~~~\r\n\r\nThis is fast and cheap. The user can later flatten out the base+clone to a single file using `qemu-img convert` if required."},"comment":{"url":"https://api.github.com/repos/mitchellh/packer/issues/comments/251353265","html_url":"https://github.com/mitchellh/packer/issues/3959#issuecomment-251353265","issue_url":"https://api.github.com/repos/mitchellh/packer/issues/3959","id":251353265,"user":{"login":"rickard-von-essen","id":557699,"avatar_url":"https://avatars.githubusercontent.com/u/557699?v=3","gravatar_id":"","url":"https://api.github.com/users/rickard-von-essen","html_url":"https://github.com/rickard-von-essen","followers_url":"https://api.github.com/users/rickard-von-essen/followers","following_url":"https://api.github.com/users/rickard-von-essen/following{/other_user}","gists_url":"https://api.github.com/users/rickard-von-essen/gists{/gist_id}","starred_url":"https://api.github.com/users/rickard-von-essen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rickard-von-essen/subscriptions","organizations_url":"https://api.github.com/users/rickard-von-essen/orgs","repos_url":"https://api.github.com/users/rickard-von-essen/repos","events_url":"https://api.github.com/users/rickard-von-essen/events{/privacy}","received_events_url":"https://api.github.com/users/rickard-von-essen/received_events","type":"User","site_admin":false},"created_at":"2016-10-04T10:34:10Z","updated_at":"2016-10-04T10:34:10Z","body":"The solution is simple just:\r\n```json\r\n{\r\n  \"variables\": {\r\n    \"pwd\": \"{{ env `PWD` }}\"\r\n  },\r\n  \"builders\": [\r\n    {\r\n      \"type\": \"qemu\",\r\n      \"iso_checksum_url\": \"{{ user `pwd` }}/output-qemu-base/vtp-base.qcow2.sha256\"\r\n    }\r\n  ]\r\n}\r\n```"}}
{"actor":{"display_login":"rickard-von-essen"}}