Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Notes: Persistence (Local Storage)

Avery Yen edited this page Jan 12, 2016 · 15 revisions

Local Disk

Each disk is a physical hard drive or partition. BOSH / RackHD CPI will not manage partition for user. User cannot change the size of a disk.

Changes to CPI

create_vm

VM_CID will be stored in metadata of RackHD as:

cid: "XYZ"
  • If there is a disk_cid in the create_vm call, then the node with disk.id must be selected. If node with disk.id (disk_locality) cannot be found, the create_vm call errors out.
  • If there is no persistent disk locality passed in, select node with disk_cid and vm_cid randomly and wipe data from SDB (if there is one) in node by RackHD before provisioning.

create_disk

VM_CID may or may not be specified. If VM_CID is specified, look up node based on VM_CID. If VM_CID is not specified, choose node randomly. Steps:

  • Assume system disk, swap and ephemeral disk are always on /dev/sda (partitioned to sda1, sda2, and sda3)
  • Assume persistent disk is always on /dev/sdb

if VM_CID is specified

  • choose node based on VM_CID

  • If a disk is already on the VM, error out. if VM_CID is not specified

  • choose node without DISK and VM_CID randomly

  • Generate GUID and add into metadata in RackHD node:

cid: "25892e17-80f6-415f-9c65-7395632f0223"
persistent_disk: {
	disk_cid: "e33898de-6302-4756-8f0c-5f6c5218e02e"
	location: "/dev/sdb"
	attached: false
}

attach_disk

Set persistent_disk.attached = true

Set Agent Env with the disk location (ie. /dev/sdb). OR always assume sdb is disk to avoid communication with Agent

detach_disk

Set persistent_disk.attached = false

Set Agent Env to remove persistent disk info OR always assume sdb is disk to avoid communication with Agent

has_disk?

Scan all nodes to see if a disk with the Disk CID

delete_disk

  • Find by disk_id
  • If not found, errors out
  • If disk is still attached, error out
  • Remove persistent_disk

snapshot_disk

Not implemented error OR no op

delete_snapshot

Not implemented OR no op

get_disks

Scan all attached disks attached to the VM

Assumptions

  1. When create_vm is called, we pick a random node that has no disk metadata.
  2. User cannot pick which node / which disk to use.
  • If CPI selects a node without enough capacity, it will error out at create_disk.
  1. Migration is not supported.
  • CPI will error out when user changes the size of persistent disk.
  1. System disk, swap and ephemeral disk are always on /dev/sda (partitioned to sda1, sda2, and sda3)
  2. Persistent disk is always on /dev/sdb