Jeffrey Nguyen created JCLOUDS-493:
--------------------------------------
Summary: Extend TemplateOptions and CreateServerOptions to support
fixed private IPs and more
Key: JCLOUDS-493
URL: https://issues.apache.org/jira/browse/JCLOUDS-493
Project: jclouds
Issue Type: Improvement
Components: jclouds-compute
Affects Versions: 1.7.1
Environment: jClouds 1.7.1
Reporter: Jeffrey Nguyen
Hi jClouds Devs,
I'm currently working an enhancement related to recent enhancements to support
networks in jClouds compute layer [1] and OpenStack nova [2]. In jClouds
1.7.1, both of these are invoked via the method "networks(Iterable<String>
networks)". I believe the intention is to set a list of network UUIDs.
For each network UUID, I want to be able to assign a fixed private IP address,
and possibly MAC address and port number. [3] Below is an example of how I
assign (network UUID, fixed private IP) tuples for the 3 network interfaces
when creating a server in OpenStack.
Ideally, we need a more generic API like "TemplateOptions
networks(Iterable<Map<String, String>> networks)". This will support all of
the network attributes instead of just the network UUID.
Obviously Java does not allow the above overloaded method because we already
have a "networks(Iterable<String> networks)" in the existing implementation.
I'd like to propose we create a new method "networkConfig(Iterable<Map<String,
String>> networkConfig)" and deprecate "networks(Iterable<String> networks)".
This will allow each individual Iaas to take time to migrate to the new API.
What I like about the new API is that since it's a Map, it'll take any network
attributes supported by the underlined Iaas. All we need to do is specify the
attribute names in the JSON payload (not hard-coded in the code). For example,
when I apply this new API against OpenStack nova, I can specify network UUID,
fix_ip, and port UUID for each interface. Also, if any new attribute is
introduced under networks, we'll get it for free with this new enhancement.
Please let me know what you think.
Regards,
-Jeffrey
[1] https://issues.apache.org/jira/browse/JCLOUDS-416
[2] https://issues.apache.org/jira/browse/JCLOUDS-202
[3] OpenStack JSON payload for creating server with network uuid and fixed
private IP:
"{"server":{"name":"testp-e12","imageRef":"66dac7ce-992c-43a4-b765-029c0b6fc1fe","flavorRef":"1d89ff82-5981-4a14-91e5-fc769f82a2f9","metadata":{"jclouds-group":"testp"},"key_name":"test","security_groups":[{"name":"default"}],"user_data":"U0VSVk...VAx","networks":[{"uuid":"fb9c21f4-0672-48b2-8279-77334bb63a53","fixed_ip":"172.16.0.10"},{"uuid":"aa1809a2-c32d-4eb8-a5c5-e46f692416e0","fixed_ip":"172.16.1.11"},{"uuid":"1e43f86f-4165-4f2e-8017-dd4cfb5548b0","fixed_ip":"172.16.2.12"}]}}"
--
This message was sent by Atlassian JIRA
(v6.2#6252)