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

Why does bosh-init always do disk migration when migrating BOSH director? #80

Open mattcui opened 8 years ago

mattcui commented 8 years ago

We found there always triggered disk migration during BOSH director migration using bosh-init. There are much data on the persistence disk of BOSH director, it needs to take lots of time to do disk migration. Is there a way to disable disk migration to keep using the old disk? it's really not needed and very time consuming. Thanks.

/cc @maximilien @jianqiu

cppforlife commented 8 years ago

are you using recent enough version of bosh-init? mine never does disk migration unless size/cloud props are changing.

Sent from my iPhone

On Jun 6, 2016, at 1:55 AM, Matt Cui notifications@github.com wrote:

We found there always triggered disk migration during BOSH director migration using bosh-init. There are much data on the persistence disk of BOSH director, it needs to take lots of time to do disk migration. Is there a way to disable disk migration to keep using the old disk? it's really not needed and very time consuming. Thanks.

/cc @maximilien @jianqiu

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

jianqiu commented 8 years ago

@cppforlife @mattcui

We tried bosh-init-0.0.92. The migration we mentioned is that migrating migrating to bosh-init from the micro CLI plugin, bosh-init will read bosh-deployments.yml, and generated a new state json file, but in the state json file, I saw the disk size is "0", so bosh-init will do disk migration. I am not sure how to indicate disk_size in bosh-deployments.yml which could be parsed and updated into state json.

 "disks": [
        {
            "id": "0cc5c167-4d1d-4e2f-50dc-0f472c015bf9",
            "cid": "11765207",
            "size": 0,
            "cloud_properties": {}
        }
    ],

legacy_deployment_state_migrator.go

if len(legacyDeploymentState.Instances) > 0 {
        instance := legacyDeploymentState.Instances[0]
        diskCID := instance.DiskCID
        if diskCID != "" {
            uuid, err := m.uuidGenerator.Generate()
            if err != nil {
                return deploymentState, bosherr.WrapError(err, "Generating UUID")
            }

            deploymentState.CurrentDiskID = uuid
            deploymentState.Disks = []DiskRecord{
                {
                    ID:              uuid,
                    CID:             diskCID,
                    Size:            0,
                    CloudProperties: biproperty.Map{},
                },
            }
        }
cppforlife commented 8 years ago

right, during migration from micro CLI to bosh-init it needs to do it because it doesnt have enough information. if you want to bypass this you can manually migrate your state file to a new format which if migrated correctly wouldnt result in disk migration.