Added functionality for updating and resetting compute quotas. (#214)
* Added functionality for updating and resetting compute quotas.
Unit and acceptance tests added.
* Forgot to add my latest changes.
Modified acceptance test to better find the tenant-id
* Improved test coverage.
And fixed a bug while doing this.
* Moved FillFromQuotaSet to acceptance test package
Refractored ToComputeQuotaUpdateMap()
diff --git a/acceptance/openstack/compute/v2/compute.go b/acceptance/openstack/compute/v2/compute.go
index 3392c2e..97d61f6 100644
--- a/acceptance/openstack/compute/v2/compute.go
+++ b/acceptance/openstack/compute/v2/compute.go
@@ -710,6 +710,24 @@
})
}
+//Convenience method to fill an QuotaSet-UpdateOpts-struct from a QuotaSet-struct
+func FillUpdateOptsFromQuotaSet(src quotasets.QuotaSet,dest *quotasets.UpdateOpts) {
+ dest.FixedIps = &src.FixedIps
+ dest.FloatingIps = &src.FloatingIps
+ dest.InjectedFileContentBytes = &src.InjectedFileContentBytes
+ dest.InjectedFilePathBytes = &src.InjectedFilePathBytes
+ dest.InjectedFiles = &src.InjectedFiles
+ dest.KeyPairs = &src.KeyPairs
+ dest.Ram = &src.Ram
+ dest.SecurityGroupRules = &src.SecurityGroupRules
+ dest.SecurityGroups = &src.SecurityGroups
+ dest.Cores = &src.Cores
+ dest.Instances = &src.Instances
+ dest.ServerGroups = &src.ServerGroups
+ dest.ServerGroupMembers = &src.ServerGroupMembers
+ dest.MetadataItems = &src.MetadataItems
+}
+
// PrintServer will print an instance and all of its attributes.
func PrintServer(t *testing.T, server *servers.Server) {
t.Logf("ID: %s", server.ID)