Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New resource: vsphere_datastore_cluster #436

Merged
merged 7 commits into from
Mar 20, 2018
Merged

Conversation

vancluever
Copy link
Contributor

This is the first part of a new push to add clustering and DRS support in the vSphere provider.

This adds vsphere_datastore_cluster, which can be used to create datastore clusters and configure Storage DRS for it respectively. Pretty much everything that's exposed in vSphere is exposed in the resource.

Note that the docs reference functionality that is not implemented yet - this is the datastore_cluster_id attribute, which will basically be a "pseudo-folder" attribute and conflict with folder in the vsphere_nas_datastore and vsphere_vmfs_datastore resources, allowing a datastore to be created in or moved to a datastore cluster.

After this support is in and functional we can use it to start writing datastore cluster support into the vsphere_virtual_machine resource to address #2.

Resource is partially done - part way into read now, also added
StoragePod helpers and made a few other touch ups here and there.
And a few fixes and additions to test helpers to assist.

More complex tests coming.
Tests for a number of cases have been added. This should complete the
resource for all intents and purposes save documentation.
@vancluever vancluever added enhancement Type: Enhancement new-resource Feature: New Resource labels Mar 20, 2018
@vancluever vancluever requested a review from a team March 20, 2018 02:11
@@ -191,6 +191,8 @@ func folderFromObject(client *govmomi.Client, obj interface{}, folderType RootPa
p, err = RootPathParticleNetwork.PathFromNewRoot(o.InventoryPath, folderType, relative)
case *object.Datastore:
p, err = RootPathParticleDatastore.PathFromNewRoot(o.InventoryPath, folderType, relative)
case *object.StoragePod:
p, err = RootPathParticleDatastore.PathFromNewRoot(o.InventoryPath, folderType, relative)

Choose a reason for hiding this comment

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

It would be nice if they just used some interfaces occasionally 😢

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not 100% ruling out there could be some refactoring here, and InventoryPath is part of a Common object that everything embeds, but we still need to know what kind of object is being passed in, and there is no common interface for say datastore clusters. In fact, this would not 100% work here even if there was, as for example, StoragePod actually would inherit from Folder versus Datastore - and indeed emebeds that object instead of Datastore. 😛

ValidateFunc: validation.StringInSlice(storageDrsPodConfigInfoBehaviorAllowedValues, false),
},
"sdrs_load_balance_interval": {
Type: schema.TypeInt,

Choose a reason for hiding this comment

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

I wonder if it would be better UX to express this as a string/time.Duration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is minor, especially in the face of if we changed it here to something like 60m/1h/2d, we would probably need to change it everywhere, else we risk harming the UX more than enriching it.

@vancluever
Copy link
Contributor Author

Thanks @paultyng!

@vancluever vancluever merged commit 23821e3 into master Mar 20, 2018
@vancluever vancluever deleted the f-datastore-cluster branch March 31, 2018 17:41
@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Type: Enhancement new-resource Feature: New Resource
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants