You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Krisztian Horvath (JIRA)" <ji...@apache.org> on 2014/09/08 11:57:28 UTC

[jira] [Commented] (AMBARI-7192) Ability to know the host-hostgroup relationship - from both directions

    [ https://issues.apache.org/jira/browse/AMBARI-7192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14125362#comment-14125362 ] 

Krisztian Horvath commented on AMBARI-7192:
-------------------------------------------

Retrieving which host components are installed to a specific host is already provided by the 
`clusters/<clustername>/hosts/<hostname>/host_components` resource. 

Retrieving the other way around is "sort of" provided with one small modification.
The `clusters/<clustername>/host_components/<hostcomponent>` would be able to retrieve, but
it is not allowed not to specify the <hostname> [here](https://github.com/apache/ambari/blob/trunk/ambari-server/src/main/java/org/apache/ambari/server/api/services/HostComponentService.java#L78)
probably, because you can get the same result by the `/clusters/<clustername>/hosts/<hostname>/host_components/<hostcomponent>`.
If I remove the check whether the <hostname> is provided or not I'll get back all the host responses where the components is installed to, but
the json serializer messes up the response, e.g invalid response (response of 3 hosts): 

{
  "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/hosts/amb1.mycorp.kom/host_components/DATANODE",
  "HostRoles" : {
    "cluster_name" : "multi-node-hdfs-yarn",
    "component_name" : "DATANODE",
    "desired_admin_state" : "INSERVICE",
    "desired_stack_id" : "HDP-2.1",
    "desired_state" : "STARTED",
    "host_name" : "amb1.mycorp.kom",
    "maintenance_state" : "OFF",
    "service_name" : "HDFS",
    "stack_id" : "HDP-2.1",
    "stale_configs" : false,
    "state" : "INSTALL_FAILED",
    "actual_configs" : { }
  },
  "host" : {
    "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/hosts/amb1.mycorp.kom"
  },
  "processes" : [ ],
  "component" : [
    {
      "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/services/HDFS/components/DATANODE",
      "ServiceComponentInfo" : {
        "cluster_name" : "multi-node-hdfs-yarn",
        "component_name" : "DATANODE",
        "service_name" : "HDFS"
      }
    }
  ]
} {
  "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/hosts/amb2.mycorp.kom/host_components/DATANODE",
  "HostRoles" : {
    "cluster_name" : "multi-node-hdfs-yarn",
    "component_name" : "DATANODE",
    "desired_admin_state" : "INSERVICE",
    "desired_stack_id" : "HDP-2.1",
    "desired_state" : "STARTED",
    "host_name" : "amb2.mycorp.kom",
    "maintenance_state" : "OFF",
    "service_name" : "HDFS",
    "stack_id" : "HDP-2.1",
    "stale_configs" : false,
    "state" : "INSTALL_FAILED",
    "actual_configs" : { }
  },
  "host" : {
    "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/hosts/amb2.mycorp.kom"
  },
  "processes" : [ ],
  "component" : [
    {
      "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/services/HDFS/components/DATANODE",
      "ServiceComponentInfo" : {
        "cluster_name" : "multi-node-hdfs-yarn",
        "component_name" : "DATANODE",
        "service_name" : "HDFS"
      }
    }
  ]
} {
  "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/hosts/amb3.mycorp.kom/host_components/DATANODE",
  "HostRoles" : {
    "cluster_name" : "multi-node-hdfs-yarn",
    "component_name" : "DATANODE",
    "desired_admin_state" : "INSERVICE",
    "desired_stack_id" : "HDP-2.1",
    "desired_state" : "STARTED",
    "host_name" : "amb3.mycorp.kom",
    "maintenance_state" : "OFF",
    "service_name" : "HDFS",
    "stack_id" : "HDP-2.1",
    "stale_configs" : false,
    "state" : "INSTALL_FAILED",
    "actual_configs" : { }
  },
  "host" : {
    "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/hosts/amb3.mycorp.kom"
  },
  "processes" : [ ],
  "component" : [
    {
      "href" : "http://172.24.0.21:8080/api/v1/clusters/multi-node-hdfs-yarn/services/HDFS/components/DATANODE",
      "ServiceComponentInfo" : {
        "cluster_name" : "multi-node-hdfs-yarn",
        "component_name" : "DATANODE",
        "service_name" : "HDFS"
      }
    }
  ]
}

Is it a bug in the serializer or it os absolutely not recommended to remove that <hostname> check I mentioned above for some reason (in below)
layers it is handled perfectly.

Could any of you advise how should I proceed, please?  [~u39kun][~swagle][~jspeidel] Thank you.

> Ability to know the host-hostgroup relationship - from both directions
> ----------------------------------------------------------------------
>
>                 Key: AMBARI-7192
>                 URL: https://issues.apache.org/jira/browse/AMBARI-7192
>             Project: Ambari
>          Issue Type: Sub-task
>          Components: contrib
>    Affects Versions: 1.7.0
>            Reporter: Krisztian Horvath
>            Assignee: Krisztian Horvath
>             Fix For: 1.7.0
>
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)