-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable expanding root disk
root_disk_size_gb
Applications such as Nvidia's libraries, required for many AI / LLM applications, aren't easily installed on anywhere but the root disk; however, the amount of free space in the root disk of a Jammy stemcell is too small to accommodate these libraries. To address this, we introduce a new property, `root_disk_size_gb`. Setting this property will expand the root disk during VM creation (in the `create_vm` CPI method, before the BOSH packages are installed). Typical use (in a Cloud Config): ```yaml vm_extensions: - name: 20G_root cloud_properties: root_disk_size_gb: 20 ``` Setting this property disables the VM's "linked clone" feature [0], which is incompatible with extending the size of the root disk. The VM will therefore require more disk space than expected, typically the size of the root disk (in the above example, 20 GiB) Adding this feature brings the vSphere CPI to parity with the AWS, Azure, and GCP CPIs. Root disk size is measured in GiB (1,073,741,824 bytes), not in GB (1,000,000,000 bytes). Drive-by: Removed unnecessary initialization, `config_spec.device_change = []`: `ConfigSpec` class initializes `device_change` to an empty array; we don't need to do it. [0] A linked clone is a copy of a virtual machine that shares virtual disks with the parent virtual machine. Only changes from the parent disk are recorded, saving on disk space. Signed-off-by: Brian Cunnie <[email protected]>
- Loading branch information
Showing
5 changed files
with
93 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/vsphere_cpi/spec/integration/root_size_disk_gb_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
require 'integration/spec_helper' | ||
|
||
describe 'root_disk_size_gb property' do | ||
|
||
let(:vm_type) do | ||
{ | ||
'ram' => 512, | ||
'disk' => 2048, | ||
'cpu' => 1, | ||
} | ||
end | ||
|
||
context 'when "root_disk_size_gb" is not set' do | ||
it 'creates a VM whose system disk is a linked-clone to the stemcell' do | ||
simple_vm_lifecycle(@cpi, @vlan, vm_type) do |vm_id| | ||
vm = @cpi.vm_provider.find(vm_id) | ||
stemcell = @cpi.vm_provider.find(@stemcell_id) | ||
system_disk = vm.system_disk | ||
stemcell_disk = stemcell.system_disk | ||
expect(system_disk.backing.parent.uuid).to eq(stemcell_disk.backing.parent.uuid) | ||
end | ||
end | ||
end | ||
|
||
context 'when "root_disk_size_gb" is set' do | ||
let(:root_disk_size_gb) { 15 } | ||
it 'creates a VM whose system disk is a linked-clone to the stemcell' do | ||
vm_type['root_disk_size_gb'] = root_disk_size_gb | ||
simple_vm_lifecycle(@cpi, @vlan, vm_type) do |vm_id| | ||
vm = @cpi.vm_provider.find(vm_id) | ||
system_disk = vm.system_disk | ||
expect(system_disk.backing.parent).to be_nil # no parent disk, not a linked-clone | ||
expect(system_disk.capacity_in_kb / 1024 / 1024).to eq(root_disk_size_gb) # convert kiB → GiB | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters