Provision loop devices #15

Merged
merged 3 commits into from Jan 28, 2015

Conversation

Projects
None yet
2 participants
Owner

wallyworld commented Jan 28, 2015

Very initial, POC machine storage provisioner for loop devices.

apiserver/provisioner/provisioner.go
@@ -532,8 +532,9 @@ func (p *ProvisionerAPI) machineVolumeParams(m *state.Machine) ([]storage.Volume
return nil, errors.Errorf("cannot get parameters for volume %q", dev.Name())
}
var options map[string]interface{}
+ var providerType storage.ProviderType
if params.Pool != "" {
@axw

axw Jan 28, 2015

Collaborator

I think we guarantee that Pool != "" now right? We should be able to drop this test.

apiserver/provisioner/provisioner.go
pm := pool.NewPoolManager(state.NewStateSettings(st))
p, err := pm.Get(poolName)
if err != nil {
- return nil, errors.Trace(err)
+ return storage.ProviderType(""), nil, errors.Trace(err)
@axw

axw Jan 28, 2015

Collaborator

what's the point of typing the ""?

EDIT: as in, why not just use untyped string, ""?

storage/interface.go
@@ -26,6 +26,9 @@ type VolumeParams struct {
// as defined in a storage pool.
Options map[string]interface{}
+ // The provider type for this volume.
+ VolumeType ProviderType
@axw

axw Jan 28, 2015

Collaborator

I think just call the field Provider. Or ProviderType. VolumeType sounds more like the EBS volume type.

worker/storage/provisioner.go
+
+var _ Provisioner = (*storageProvisioner)(nil)
+
+// TODO - add tests
@axw

axw Jan 28, 2015

Collaborator

Not sure there's any point, because this all needs to change pretty significantly.

+
+func (p *storageProvisioner) loop() error {
+ // TODO - this is a hack.
+ // Provision initial storage for loop devices.
@axw

axw Jan 28, 2015

Collaborator

In case there's any doubt, this is a major hack. We shouldn't be using the machine provisioner API, and we shouldn't be using the machine provisioning info. Instead, we should be watching all unprovisioned storage instances.

Collaborator

axw commented Jan 28, 2015

LGTM, with a few minor changes. I may make some changes tomorrow to enable dynamic provisioning of EBS volumes.

wallyworld added a commit that referenced this pull request Jan 28, 2015

@wallyworld wallyworld merged commit d435992 into storage-feature Jan 28, 2015

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