Commit Graph

84 Commits

Author SHA1 Message Date
Dmytro Aleksandrov c32d152495 Implemented stop_before_destroy behavior
Docs and acceptance test included
2016-06-23 09:20:41 +03:00
Joe Topjian ead1fed897 provider/openstack: Enforce ForceNew on Instance Block Device
This commit causes openstack_compute_instance_v2 resources to be
destroyed and recreated upon changes to any block_device argument.
2016-06-03 02:16:40 +00:00
Joe Topjian 803522a7ce provider/openstack: Rebuild On Network Changes
This commit makes it so that openstack_compute_instance_v2 resources
are recreated when any network setting (except Floating IPs) is
changed.
2016-05-24 03:47:27 +00:00
Kirill Shirinkin 2dc254af13 provider/openstack Increase timeouts 2016-05-19 11:28:55 +02:00
John Bresnahan 99ab233740 Fixes an vet error. 2016-05-17 06:23:53 -10:00
Kirill Shirinkin e24550bb6c Reassociate FIP on network changes 2016-05-10 11:12:19 +02:00
Joe Topjian 9d10028d43 provider/openstack: Fix Access Address Detection
This commit fixes how access ip addresses are detected. The previous
logic used was flawed and would detect the IPs in the wrong order.
2016-04-17 04:38:49 +00:00
Seth Vargo 68a2a2299e Use schema funcs for reading values from the env 2016-04-08 17:28:54 -04:00
Joe Topjian 23b953eea3 provider/openstack: Allow resizing when Flavor Name changes
Previously, resizing would only work if the flavor_id changed and
would create an error if the flavor_name changes. This commit fixes
this behavior.

It also quickly refactors the getFlavorID function to use
Gophercloud's IDFromName function. getFlavorID was the basis of
IDFromName so the exact same code is used.

Fixes #5780
2016-04-05 15:31:14 +00:00
Joe Topjian 65d96ef58a provider/openstack: Account for a 403 reply from os-tenant-networks 2016-03-02 21:17:59 +00:00
Joe Topjian 7d6116d7c2 provider/openstack: Re-Add server.AccessIPv4 and server.AccessIPv6
GH-4812 removed reading server.AccessIPv4 and server.AccessIPv6
because, AFAICT, they are not set by Nova. After removal, a user
reported that they were no longer able to read IPs from access_ip_v4
and access_ip_v6 on Rackspace. It's possible that Rackspace sets
the AccessIPv* attributes, and if that's true, other cloud providers
might as well through custom extensions.

The priority of how access_ip_v* is set might require some tweaks in
the future.
2016-02-28 21:39:45 +00:00
Joe Topjian d82a4c9259 provider/openstack: Safely typecast network during instance update
This commit protects against unsafe typecasting when an instance is
updating its network configuration.
2016-02-28 19:02:53 +00:00
Joe Topjian e872c3d8ba provider/openstack: Instance Block Device cleanup
This commit fixes and cleans up instance block_device configuration.

Reverts #5354 in that `volume_size` is only required in certain
block_device configuration combinations. Therefore, the actual
attribute must be set to Optional and later checks done.

Doc upates, too.
2016-02-27 06:05:01 +00:00
Joe Topjian ed9e7de901 provider/openstack: multi ephemeral support
This commit adds the ability to create instances with multiple
ephemeral disks. The ephemeral disks will appear as local block
devices to the instance.
2016-02-27 04:56:27 +00:00
Joe Topjian 41e6851c15 provider/openstack: Making Block Device Size Required
The `volume_size` of a `block_device` was originally set to Optional,
but it's a required parameter in the OpenStack/Nova API. While it's
possible to infer a default size of the block device, making it required
more closely matches the Nova CLI client as well as provides consistent
experience when working with multiple block_devices.
2016-02-27 04:13:26 +00:00
Trevor Pounds 79742fc367 Enable `go vet -composites` check and fix warnings. 2016-02-17 11:59:50 -08:00
Joe Topjian 7ccaaa12be provider/openstack: Fix crash when access_network was not defined 2016-02-02 22:59:16 +00:00
Joe Topjian df660a26a1 provider/openstack: Per-network Floating IPs
This commit adds the ability to associate a Floating IP to a specific
network. Previously, there only existed a top-level floating IP
attribute which was automatically associated with either the first
defined network or the default network (when no network block was
used).

Now floating IPs can be associated with networks beyond the first
defined network as well as each network being able to have their own
floating IP.

Specifying the floating IP by using the top-level floating_ip
attribute and the per-network floating IP attribute is not possible.

Additionally, an `access_network` attribute has been added in order
to easily specify which network should be used for provisioning.
2016-01-31 22:17:51 +00:00
Ian Duffy 47ac10d66b Change resource.StateChangeConf to use an array for target states
Signed-off-by: Ian Duffy <ian@ianduffy.ie>
2016-01-21 01:20:41 +00:00
Joe Topjian 4a4f2ad9e5 provider/openstack: Add Instance Personality
This commit adds the "personality" attribute which is used to provision
destination files on the instance.
2016-01-11 03:53:30 +00:00
Joe Topjian 4716451617 provider/openstack: Convert block_device from TypeSet to TypeList
This change better reflects how block devices are passed to the Nova API
and allows for future enablement of block_device features. It also resolves
an interpolation bug.
2015-12-12 22:18:23 +00:00
Nic Grayson ef9838c796 increased openstack 10 minute timeouts to 30 minutes 2015-12-08 16:03:33 -06:00
Joe Topjian 98a441314b provider/openstack: Make Security Groups Computed
This commit makes security groups in the openstack_compute_instance_v2
resource computed. This fixes issues where a security group is omitted
which causes the instance to have the "default" group applied. When
re-applying without this patch, an error will occur.
2015-11-07 04:01:50 +00:00
Joe Topjian 4a5cd0b415 provider/openstack: Fixing Image ID/Name areas
This commit cleans up areas that configure the image_id and image_name.

It enables the ability to not have to specify an image_id or image_name
when booting from a volume.

It also prevents Terraform from reporting an error when an image name is no
longer able to be resolved from an image ID. This usually happens when the
image has been deleted, but there are still running instances that were based
off of it.

The image_id and image_name parameters no longer immediately take a default
value from the OS_IMAGE_ID and OS_IMAGE_NAME environment variables. If no other
resolution of an image_id or image_name were found, then these variables will
be referenced. This further supports booting from a volume.

Finally, documentation was updated to take into account booting from a volume.
2015-10-31 22:45:34 +00:00
Joe Topjian 3d3f8122a9 provider/openstack: Volume Cleanup
This commit cleans up the volume and block device handling in the instance
resource. It also adds more acceptance tests to deal with different workflows
of attaching and detaching a volume through the instance's lifecycle.

No new functionality has been added.
2015-10-31 22:45:34 +00:00
Joe Topjian e75553fd9d provider/openstack: Fixes Boot From Volume
This commit fixes the previously broken "boot from volume" feature. It also
adds an acceptance test to ensure the feature continues to work.

The "delete_on_termination" option was also added.
2015-10-31 22:45:28 +00:00
Yo Takezawa 59828deb0f provider/openstack: Use security_groups as native set when update 2015-10-28 10:12:05 +09:00
Yo Takezawa d2cf45a057 provider/openstack: Ignore order of security_groups in instance 2015-10-27 15:57:28 +09:00
Radek Simko f9efede852 gofmt files from recently merged PRs 2015-10-07 13:35:06 -07:00
Paul Hinze 50b8161da1 Merge pull request #2008 from dupuy/secgrp-delta-remove-then-add
remove security groups (by name) before adding security groups (by id)
2015-09-24 14:14:48 -05:00
Mitchell Hashimoto ede6af8763 Merge pull request #1921 from jtopjian/openstack-servergroup-schedulerhints
provider/openstack: scheduler_hints and servergroups
2015-06-24 23:13:25 -07:00
Mitchell Hashimoto d1d2a90158 Revert "provider/openstack: change security groups to set"
This reverts commit 646fd76e07.
2015-06-24 23:10:30 -07:00
Mitchell Hashimoto 38151229b1 Merge pull request #2285 from cvvs/b_provider_openstack_router_adminbool
provider/openstack: change router resource admin_state_up from string to bool
2015-06-24 23:09:14 -07:00
Mitchell Hashimoto 09acd1f79d providers/openstack: fix crash case if network is nil [GH-2323] 2015-06-23 16:19:42 -07:00
cvvs 646fd76e07 provider/openstack: change security groups to set
This commit converts the openstack compute instances security groups to
a set from a list.

This fixes ordering problems which forces or indicates change to security
groups where none exist, and mimics the functionality in the aws
provider's compute resource.

Includes fixes from dupuy addressing crashes due to an empty state.
2015-06-09 10:04:06 -06:00
Alexander Dupuy 739a411b4d debug security group ids 2015-05-18 23:02:19 +02:00
Joe Topjian 4daaacd292 Minor volume fixes
This commit follows suit of #1897 by fixing volume-related
parameters which allow the volume attach acceptance test
to work. It also re-enables the volume attach test.
2015-05-14 02:59:21 +00:00
Joe Topjian 7ca7eeabe7 Added scheduler_hints to the OpenStack instance resource.
This allows various hints to be passed to the OpenStack scheduler
that will determine where the instance will be hosted in the cloud.
2015-05-12 01:08:20 +00:00
Joe Topjian fe0a7a5ec5 Allow Blank Region
When OS_REGION_NAME is not set, fall back to a blank string. This
will cause gophercloud to use the cloud's only region in
single-region clouds.
2015-04-11 05:10:10 +00:00
Joe Topjian ef4e03a729 Workaround for missing tenant-network
This commit resolves an issue where the tenant-network api extension
does not exist. The caveat is that the user must either specify no
networks (single network environment) or can only specify UUIDs for
network configurations.
2015-04-01 21:31:55 +00:00
Joe Topjian 4244d0947e Making the network resource computable
This allows the obtained network information to be successfully stored
for environments that do not require a network resource to be specified.
2015-04-01 16:06:47 +00:00
Joe Topjian bb81228205 typo with netname when no networks are specified 2015-04-01 15:39:36 +00:00
Joe Topjian 30b0fc7489 Only attempt to get the MAC address if it exists. 2015-04-01 15:39:36 +00:00
Joe Topjian 0d77232196 Fixing computed parameters 2015-04-01 15:39:36 +00:00
Joe Topjian ccba698370 Network Read changes
This commit changes how the network info is read from OpenStack.
It pulls all relevant information from server.Addresses and merges
it with the available information from the networks parameters.
The access_v4, access_v6, and floating IP information is then
determined from the result.

A MAC address parameter is also added since that information is
available in server.Addresses.
2015-04-01 15:39:36 +00:00
Joe Topjian b160654cb3 Allow networks to be specified by name
This commit allows the user to specify a network by name rather than
just uuid. This is done via the os-tenant-networks api extension.
This works for both neutron and nova-network.
2015-04-01 15:39:36 +00:00
Joe Topjian b90a6152c5 Renamed fixed_ip to fixed_ip_v4 and added fixed_ip_v6 2015-04-01 15:39:36 +00:00
Joe Topjian d768a01cab Removes check for a "public" network
This is only possible if the OpenStack cloud explicitly has a network
called "public".
2015-04-01 15:39:36 +00:00
Joe Topjian 141b40189e os-floating-ips support
This commit causes the resource to manage floating IPs by way of the
os-floating-ips API.

At the moment, it works with both nova-network and Neutron environments,
but if you use multiple Neutron networks, the network that supports the
floating IP must be listed first.
2015-04-01 15:39:18 +00:00
Guillaume Giamarchi a90b9db397 Bugfix on floating IP assignment
The `getFirstNetworkID` does not work correctly because the first
network is not always the private network of the instance.

As long as the `GET /networks` gives a list containing also public
networks we don't have any guarantee that the first network is the
one we want. Furthermore, with a loop over the network list we are
not able to determine which network is the one we want.

Instead of retrieving the network ID and then finding the port ID,
it's better to basically take the first port ID of the instance.
2015-04-01 00:14:56 +02:00