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

[DNM]VXFM-10032 Datastore Resize #320

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/puppet/provider/esx_datastore/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ def create
end
end

def datastore_size
@datastore.summary.size
end

def datastore_size=(value)
datastoreExpandOption = host.configManager.datastoreSystem.QueryVmfsDatastoreExpandOptions(:datastore => @datastore)
expandSpec = datastoreExpandOption[0].spec
host.configManager.datastoreSystem.ExpandVmfsDatastore(:datastore => @datastore, :spec => expandSpec)

Choose a reason for hiding this comment

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

Usually a change like this would be done in the create method which the puppet framework will call if the exists? method returns false and ensure=present. I'm not sure at what time exactly the above setter will be called. But if it works for you I guess it should be ok.

end

def find_disk

target_iqn = resource[:target_iqn]
Expand Down
4 changes: 4 additions & 0 deletions lib/puppet/type/esx_datastore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
end
end

newproperty(:datastore_size) do
desc "The size of the datastore."
end

newparam(:host) do
desc "The ESX host the datastore is attached to."
validate do |value|
Expand Down