if (bvo.getHostId() != null) {
throw new CloudRuntimeException(String.format("blade[id:%s, dn:%s] has been associated with host[id:%s]", bvo.getId(), bvo.getDn(), bvo.getHostId()));
}
UcsManagerVO mgrvo = ucsDao.findById(cmd.getUcsManagerId());
String cookie = getCookie(cmd.getUcsManagerId());
String pdn = cloneProfile(mgrvo.getId(), cmd.getProfileDn(), "profile-for-blade-" + bvo.getId());
String ucscmd = UcsCommands.associateProfileToBlade(cookie, pdn, bvo.getDn());
UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl());
String res = client.call(ucscmd);
int count = 0;
int timeout = 600;
while (count < timeout) {
if (isProfileAssociated(mgrvo.getId(), bvo.getDn())) {
break;
}
try {
TimeUnit.SECONDS.sleep(2);