Skip to content

Conversation

@josephknierman
Copy link

This allows the hcsshim to create a configuration spec that includes additional disks at creation. This should be used for disks that are required for the image to boot. Functions for attaching/detaching disks is a given vm is included. A command for getting the lun of a attach disk is also included, however this has the condition that only the initial creator of the spec is able to use it properly. This is because the current hcsshim will not retrieve the spec when spec when getting the VirtualMachineSpec from a VMID. see getHcsSpec to see why. As far as I can tell there is not way to get this spec from the hcs functions either.

}
}

func (vm *VirtualMachineSpec) GetDiskInformation(diskPath string) (controlNumber int, err error) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func

move these functions to line#722, keep them in group with other functions for VirtualMachineSpec.

}
}

func (vm *VirtualMachineSpec) GetDiskInformation(diskPath string) (controlNumber int, err error) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GetDiskInformation

return controller location and controller number

return 0, err
}

for lun := 0; lun < 256; lun++ {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lun

why attach the same vhd from lun 0? We should find the free lun and attach the vhd using the free lun.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as far as i can tell there is no way to find the next free lun though any hcs/hcsshim calls. unless we want to make a sperate service to track the lun for each vm we create, we will have to get it through trial and error. The spec will not help us in this case since it is not stored anywhere and will not be populated if we call the GetVirtualMachineSpec function to retrieve the VirtualMachineSpec struct. I can start the lun count at 2 since 0 and 1 are required for creation.

return 0, errors.New("diskpath not found in attached devices")
}

func (vm *VirtualMachineSpec) AttachVhd(vhdPath string) (lun int, err error) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lun

return controller location and controller number

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants