Modify headnode_create related function api to pass unit tests