cloudfoundry-attic / bosh-init

bosh-init is a tool used to create and update the Director VM
Apache License 2.0
31 stars 33 forks source link

Need support for MicroBOSH feature that allows using pre-uploaded stemcell #32

Open amhuber opened 9 years ago

amhuber commented 9 years ago

MicroBOSH allows you to deploy using the UUID of a stemcell that has been pre-uploaded into the cloud, which makes it much faster to test as you don't need to upload a new stemcell on every deployment. I figured out I could make bosh-init work like that by creating a "blank" state file with just the uploaded stemcell info, as such:

{
    "director_id": "",
    "installation_id": "",
    "current_vm_cid": "",
    "current_stemcell_id": "",
    "current_disk_id": "",
    "current_release_ids": [],
    "current_manifest_sha1": "",
    "disks": null,
    "stemcells": [
        {
            "id": "7c44a033-b95e-4bf6-4ce8-ee02fd5958ab",
            "name": "bosh-openstack-kvm-ubuntu-trusty-go_agent-raw",
            "version": "2865",
            "cid": "11a4e11e-3ce1-4883-a04d-169dd83be777"
        }
    ],
    "releases": []
}

That seems to have worked as it skipped the stemcell upload and just used the existing one, but it would be much cleaner if you could optionally specify a "cid" in the manifest instead of a url/sha1 to use a pre-existing stemcell in the cloud.

Aaron Huber Intel Corporation

cppforlife commented 9 years ago

I am somewhat conflicted about exposing CID as a user input since it's something that CPI defines/uses internally - it's not necessarily just the ID in the IaaS. Also question of ownership arises - should bosh-init delete that stemcell when new stemcell is provided etc? Thoughts?

amhuber commented 9 years ago

I can't speak for other CPIs but with OpenStack the UUID is just the ID in the IaaS, the CPI doesn't modify it. I'd actually be surprised if there were some that did but I haven't looked. If they didn't just use the actual IaaS ID where would they store the mapping? I'd certainly expect this to be an "advanced" feature - even in MicroBOSH it's not actually documented that I can recall, I just found it in code after seeing Ferdy discuss it in the mailing list years ago.

Regarding ownership, I'd expect if I specified one CID and then changed it to another, the old stemcell would not be deleted. Then again, I wasn't aware that bosh-init would ever delete the stemcell, I'm used to having to do it manually with MicroBOSH. My vote would be if url is used, then bosh-init owns the stemcell and deletes on upgrade, but if cid is used, then just switch to the new one and leave the old one alone.

Aaron