diff --git a/compass/api/api.py b/compass/api/api.py
index fe169f3e..7af27217 100644
--- a/compass/api/api.py
+++ b/compass/api/api.py
@@ -3164,19 +3164,19 @@ def update_host_state(host_id):
 
 
 @util.deprecated
-@app.route("/hosts/<hostname>/state_internal", methods=['PUT', 'POST'])
-def update_host_state_internal(hostname):
+@app.route("/hosts/<host_id>/state_internal", methods=['PUT', 'POST'])
+def update_host_state_internal(host_id):
     """update host state.
 
     Supported fields: ['ready']
     """
     data = _get_request_data()
-    hosts = host_api.list_hosts(name=hostname)
+    host_id = int(host_id)
+    hosts = host_api.list_hosts(id=host_id)
     if not hosts:
         raise exception_handler.ItemNotFound(
-            'no hosts found for hostname %s' % hostname
+            'no hosts found for host_id %s' % host_id
         )
-    host_id = hosts[0]['id']
     return utils.make_json_response(
         200,
         host_api.update_host_state_internal(
diff --git a/compass/db/api/host.py b/compass/db/api/host.py
index f485a245..15e0bb61 100644
--- a/compass/db/api/host.py
+++ b/compass/db/api/host.py
@@ -28,7 +28,7 @@ from compass.db import models
 from compass.utils import util
 
 
-SUPPORTED_FIELDS = ['name', 'os_name', 'owner', 'mac']
+SUPPORTED_FIELDS = ['name', 'os_name', 'owner', 'mac', 'id']
 SUPPORTED_MACHINE_HOST_FIELDS = [
     'mac', 'tag', 'location', 'os_name', 'os_id'
 ]
@@ -884,6 +884,7 @@ def update_host_state_internal(
     """
     # TODO(xicheng): should be merged into update_host_state
     host = _get_host(host_id, session=session)
+    logging.info("======host state: %s", host.state)
     if 'ready' in kwargs and kwargs['ready'] and not host.state.ready:
         ready_triggered = True
     else:
diff --git a/compass/deployment/installers/os_installers/cobbler/cobbler.py b/compass/deployment/installers/os_installers/cobbler/cobbler.py
index 302c9be2..9c2a9359 100644
--- a/compass/deployment/installers/os_installers/cobbler/cobbler.py
+++ b/compass/deployment/installers/os_installers/cobbler/cobbler.py
@@ -232,7 +232,7 @@ class CobblerInstaller(OSInstaller):
             err_msg = "Template '%s' does not exists!" % tmpl_path
             logging.error(err_msg)
             raise Exception(err_msg)
-
+        host_vars_dict[const.BASEINFO]['host_id'] = host_id
         system_config = self.get_config_from_template(tmpl_path,
                                                       host_vars_dict)
 
diff --git a/conf/templates/cobbler/CentOS-7-Minimal-1511-x86_64/system.tmpl b/conf/templates/cobbler/CentOS-7-Minimal-1511-x86_64/system.tmpl
index 8e4cbbbe..e2032988 100644
--- a/conf/templates/cobbler/CentOS-7-Minimal-1511-x86_64/system.tmpl
+++ b/conf/templates/cobbler/CentOS-7-Minimal-1511-x86_64/system.tmpl
@@ -71,6 +71,7 @@
         "timezone": "$timezone",
         "ignore_proxy": "$no_proxy",
         "local_repo": "$getVar('local_repo', '')",
-        "disk_num": "1"
+        "disk_num": "1",
+        "host_id": "$getVar('host_id', int())"
     }
 }
diff --git a/conf/templates/cobbler/CentOS-7.0-x86_64/system.tmpl b/conf/templates/cobbler/CentOS-7.0-x86_64/system.tmpl
index 8e4cbbbe..e2032988 100644
--- a/conf/templates/cobbler/CentOS-7.0-x86_64/system.tmpl
+++ b/conf/templates/cobbler/CentOS-7.0-x86_64/system.tmpl
@@ -71,6 +71,7 @@
         "timezone": "$timezone",
         "ignore_proxy": "$no_proxy",
         "local_repo": "$getVar('local_repo', '')",
-        "disk_num": "1"
+        "disk_num": "1",
+        "host_id": "$getVar('host_id', int())"
     }
 }
diff --git a/conf/templates/cobbler/Ubuntu-14.04-x86_64/system.tmpl b/conf/templates/cobbler/Ubuntu-14.04-x86_64/system.tmpl
index cfcc883e..3e46a110 100644
--- a/conf/templates/cobbler/Ubuntu-14.04-x86_64/system.tmpl
+++ b/conf/templates/cobbler/Ubuntu-14.04-x86_64/system.tmpl
@@ -70,6 +70,7 @@
         "timezone": "$timezone",
         "ignore_proxy": "$no_proxy",
         "local_repo": "$getVar('local_repo', '')",
-        "disk_num": "1"
+        "disk_num": "1",
+        "host_id": "$getVar('host_id', int())"
     }
 }
diff --git a/conf/templates/cobbler/ubuntu-14.04.3-server-x86_64/system.tmpl b/conf/templates/cobbler/ubuntu-14.04.3-server-x86_64/system.tmpl
index cfcc883e..3e46a110 100644
--- a/conf/templates/cobbler/ubuntu-14.04.3-server-x86_64/system.tmpl
+++ b/conf/templates/cobbler/ubuntu-14.04.3-server-x86_64/system.tmpl
@@ -70,6 +70,7 @@
         "timezone": "$timezone",
         "ignore_proxy": "$no_proxy",
         "local_repo": "$getVar('local_repo', '')",
-        "disk_num": "1"
+        "disk_num": "1",
+        "host_id": "$getVar('host_id', int())"
     }
 }
diff --git a/misc/adapter_changes/preseed_post_anamon b/misc/adapter_changes/preseed_post_anamon
index 216e70dc..aae183a9 100644
--- a/misc/adapter_changes/preseed_post_anamon
+++ b/misc/adapter_changes/preseed_post_anamon
@@ -66,7 +66,7 @@ cat << EOF > /etc/init.d/set_state
 # Description: set_state runs the first time a machine is booted after
 #              installation.
 #end raw
-wget -O /tmp/os_state --post-data='{"ready": true}' --header=Content-Type:application/json "http://c.stack360.io/api/hosts/${hostname}/state_internal"
+wget -O /tmp/os_state --post-data='{"ready": true}' --header=Content-Type:application/json "http://c.stack360.io/api/hosts/${host_id}/state_internal"
 update-rc.d -f set_state remove
 mv /etc/init.d/set_state /tmp/set_state
 EOF