Issue 452 os_name -> os_description, +description

This commit is contained in:
Adrian Cole 2011-01-28 16:22:57 -08:00
parent ce82c05222
commit f0a4a23265
9 changed files with 47 additions and 34 deletions

View File

@ -40,18 +40,21 @@ context = new ComputeServiceContextFactory().createContext("byon", "foo", "bar",
You must define your nodes in yaml, and they must be in a collection called nodes. You must define your nodes in yaml, and they must be in a collection called nodes.
Here are the properties: Here are the properties:
* id - opaque unique id * id - opaque unique id
* name - optional; user specified name * name - optional; user specified name
* hostname - name or ip address to contact the node on * description - optional; long description of this node
* os_arch - ex. x86 * note this is not yet in jclouds NodeMetadata
* os_family - must conform to org.jclouds.compute.domain.OsFamily in lower-hyphen format * hostname - name or ip address to contact the node on
ex. rhel, ubuntu, centos, debian, amzn-linux * os_arch - ex. x86
* os_name - ex. redhat * os_family - must conform to org.jclouds.compute.domain.OsFamily in lower-hyphen format
* os_version - normalized to numbers when possible. ex. for centos: 5.3, ubuntu: 10.10 ex. rhel, ubuntu, centos, debian, amzn-linux
* group - primary group of the machine. ex. hadoop * os_description - long description of the os ex. Ubuntu with lamp stack
* tags - list of arbitrary tags. * note this list is not yet in jclouds NodeMetadata * os_version - normalized to numbers when possible. ex. for centos: 5.3, ubuntu: 10.10
* username - primary login user to the os. ex. ubuntu, vcloud, root * group - primary group of the machine. ex. hadoop
* sudo_password - optional; base 64 encoded sudo password (ex. input to sudo -S) * tags - optional; list of arbitrary tags.
* note this list is not yet in jclouds NodeMetadata
* username - primary login user to the os. ex. ubuntu, vcloud, root
* sudo_password - optional; base 64 encoded sudo password (ex. input to sudo -S)
one of: one of:
* credential - base 64 encoded RSA private key or password * credential - base 64 encoded RSA private key or password
* credential_url - location of plain-text RSA private key or password. * credential_url - location of plain-text RSA private key or password.
@ -61,12 +64,13 @@ Here are the properties:
=== Example File === === Example File ===
nodes: nodes:
- id: cluster-1 - id: i-sdfkjh7
name: cluster-1 name: cluster-1
description: accounting analytics cluster
hostname: cluster-1.mydomain.com hostname: cluster-1.mydomain.com
os_arch: x86 os_arch: x86
os_family: rhel os_family: rhel
os_name: redhat os_description: redhat with CDH
os_version: 5.3 os_version: 5.3
group: hadoop group: hadoop
tags: tags:

View File

@ -36,15 +36,16 @@ public class Node {
public Node() { public Node() {
} }
public Node(String id, String name, String hostname, String osArch, String osFamily, public Node(String id, String name, String description, String hostname, String osArch, String osFamily,
String osName, String osVersion, String group, List<String> tags, String username, String credential, String osDescription, String osVersion, String group, List<String> tags, String username,
URI credentialUrl, String sudo_password) { String credential, URI credentialUrl, String sudo_password) {
this.id = id; this.id = id;
this.name = name; this.name = name;
this.description = description;
this.hostname = hostname; this.hostname = hostname;
this.os_arch = osArch; this.os_arch = osArch;
this.os_family = osFamily; this.os_family = osFamily;
this.os_name = osName; this.os_description = osDescription;
this.os_version = osVersion; this.os_version = osVersion;
this.group = group; this.group = group;
this.tags = ImmutableList.copyOf(tags); this.tags = ImmutableList.copyOf(tags);
@ -57,10 +58,11 @@ public class Node {
// public due to snakeyaml // public due to snakeyaml
public String id; public String id;
public String name; public String name;
public String description;
public String hostname; public String hostname;
public String os_arch; public String os_arch;
public String os_family; public String os_family;
public String os_name; public String os_description;
public String os_version; public String os_version;
public String group; public String group;
public List<String> tags; public List<String> tags;
@ -77,6 +79,10 @@ public class Node {
return name; return name;
} }
public String getDescription() {
return description;
}
public String getGroup() { public String getGroup() {
return group; return group;
} }
@ -93,8 +99,8 @@ public class Node {
return os_family; return os_family;
} }
public String getOsName() { public String getOsDescription() {
return os_name; return os_description;
} }
public String getOsVersion() { public String getOsVersion() {
@ -138,10 +144,10 @@ public class Node {
@Override @Override
public String toString() { public String toString() {
return Objects.toStringHelper(this).add("id", id).add("name", name).add( return Objects.toStringHelper(this).add("id", id).add("name", name).add("description", description).add(
"hostname", hostname).add("osArch", os_arch).add("osFamily", os_family).add("osName", os_name).add( "hostname", hostname).add("osArch", os_arch).add("osFamily", os_family).add("osDescription",
"osVersion", os_version).add("group", group).add("tags", tags).add("username", username).add( os_description).add("osVersion", os_version).add("group", group).add("tags", tags).add("username",
"hasCredential", credential != null || credential_url != null).add("hasSudoPassword", username).add("hasCredential", credential != null || credential_url != null).add("hasSudoPassword",
sudo_password != null).toString(); sudo_password != null).toString();
} }

View File

@ -76,7 +76,7 @@ public class NodeToNodeMetadata implements Function<Node, NodeMetadata> {
builder.tag(from.getGroup()); builder.tag(from.getGroup());
// TODO add tags! // TODO add tags!
builder.operatingSystem(new OperatingSystemBuilder().arch(from.getOsArch()).family( builder.operatingSystem(new OperatingSystemBuilder().arch(from.getOsArch()).family(
OsFamily.fromValue(from.getOsFamily())).name(from.getOsName()).description(from.getOsName()).version( OsFamily.fromValue(from.getOsFamily())).description(from.getOsDescription()).version(
from.getOsVersion()).build()); from.getOsVersion()).build());
builder.state(NodeState.RUNNING); builder.state(NodeState.RUNNING);
builder.publicAddresses(ImmutableSet.<String> of(from.getHostname())); builder.publicAddresses(ImmutableSet.<String> of(from.getHostname()));

View File

@ -47,7 +47,7 @@ import com.google.common.collect.Maps;
* hostname: cluster-1.mydomain.com * hostname: cluster-1.mydomain.com
* os_arch: x86 * os_arch: x86
* os_family: linux * os_family: linux
* os_name: redhat * os_description: redhat
* os_version: 5.3 * os_version: 5.3
* group: hadoop * group: hadoop
* tags: * tags:

View File

@ -63,7 +63,7 @@ public class BYONComputeServiceLiveTest {
nodes.append(" hostname: localhost\n"); nodes.append(" hostname: localhost\n");
nodes.append(" os_arch: ").append(System.getProperty("os.arch")).append("\n"); nodes.append(" os_arch: ").append(System.getProperty("os.arch")).append("\n");
nodes.append(" os_family: ").append(OsFamily.UNIX).append("\n"); nodes.append(" os_family: ").append(OsFamily.UNIX).append("\n");
nodes.append(" os_name: ").append(System.getProperty("os.name")).append("\n"); nodes.append(" os_description: ").append(System.getProperty("os.name")).append("\n");
nodes.append(" os_version: ").append(System.getProperty("os.version")).append("\n"); nodes.append(" os_version: ").append(System.getProperty("os.version")).append("\n");
nodes.append(" group: ").append("ssh").append("\n"); nodes.append(" group: ").append("ssh").append("\n");
nodes.append(" tags:\n"); nodes.append(" tags:\n");

View File

@ -50,7 +50,7 @@ public class NodeToNodeMetadataTest {
public static final NodeMetadata TEST1 = new NodeMetadataBuilder().ids("cluster-1").tag("hadoop").name("cluster-1") public static final NodeMetadata TEST1 = new NodeMetadataBuilder().ids("cluster-1").tag("hadoop").name("cluster-1")
.location(location).state(NodeState.RUNNING).operatingSystem( .location(location).state(NodeState.RUNNING).operatingSystem(
new OperatingSystemBuilder().name("redhat").description("redhat").family(OsFamily.RHEL) new OperatingSystemBuilder().description("redhat").family(OsFamily.RHEL)
.arch("x86").version("5.3").build()).publicAddresses( .arch("x86").version("5.3").build()).publicAddresses(
ImmutableSet.of("cluster-1.mydomain.com")).credentials(new Credentials("myUser", "fancyfoot")) ImmutableSet.of("cluster-1.mydomain.com")).credentials(new Credentials("myUser", "fancyfoot"))
.adminPassword("sudo").build(); .adminPassword("sudo").build();

View File

@ -37,9 +37,10 @@ import com.google.common.collect.ImmutableMap;
*/ */
public class NodesFromYamlTest { public class NodesFromYamlTest {
public static final Node TEST1 = new Node("cluster-1", "cluster-1", "cluster-1.mydomain.com", "x86", "rhel", public static final Node TEST1 = new Node("cluster-1", "cluster-1", "accounting analytics cluster",
"redhat", "5.3", "hadoop", ImmutableList.of("vanilla"), "myUser", CryptoStreams.base64("fancyfoot" "cluster-1.mydomain.com", "x86", "rhel", "redhat", "5.3", "hadoop", ImmutableList
.getBytes()), null, CryptoStreams.base64("sudo".getBytes())); .of("vanilla"), "myUser", CryptoStreams.base64("fancyfoot".getBytes()), null, CryptoStreams
.base64("sudo".getBytes()));
@Test @Test
public void testNodesParse() throws Exception { public void testNodesParse() throws Exception {

View File

@ -1,10 +1,11 @@
nodes: nodes:
- id: cluster-1 - id: cluster-1
name: cluster-1 name: cluster-1
description: accounting analytics cluster
hostname: cluster-1.mydomain.com hostname: cluster-1.mydomain.com
os_arch: x86 os_arch: x86
os_family: rhel os_family: rhel
os_name: redhat os_description: redhat
os_version: 5.3 os_version: 5.3
group: hadoop group: hadoop
tags: tags:

View File

@ -1,10 +1,11 @@
nodes: nodes:
- id: cluster-1 - id: cluster-1
name: cluster-1 name: cluster-1
description: accounting analytics cluster
hostname: cluster-1.mydomain.com hostname: cluster-1.mydomain.com
os_arch: x86 os_arch: x86
os_family: rhel os_family: rhel
os_name: redhat os_description: redhat
os_version: 5.3 os_version: 5.3
group: hadoop group: hadoop
tags: tags: