Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,13 @@ private void handle(final APIAttachEipMsg msg) {
return;
}

EipInventory eip = EipInventory.valueOf(vo);
final String attachedVmNicUuid = nicInventory.getUuid();
final String attachedGuestIp = guestIp.getIp();
vo.setVmNicUuid(attachedVmNicUuid);
vo.setGuestIp(attachedGuestIp);
final EipVO updated = dbf.updateAndRefresh(vo);

EipInventory eip = EipInventory.valueOf(updated);
String l3NetworkUuid = getEipL3Network(nicInventory, eip);
NetworkServiceProviderType providerType = nwServiceMgr.getTypeOfNetworkServiceProviderForService(
l3NetworkUuid, EipConstant.EIP_TYPE);
Expand All @@ -596,15 +602,19 @@ private void handle(final APIAttachEipMsg msg) {
attachEip(struct, providerType.toString(), new Completion(msg) {
@Override
public void success() {
vo.setVmNicUuid(nicInventory.getUuid());
vo.setGuestIp(guestIp.getIp());
EipVO evo = dbf.updateAndRefresh(vo);
evt.setInventory(EipInventory.valueOf(evo));
evt.setInventory(EipInventory.valueOf(dbf.reload(updated)));
bus.publish(evt);
}

@Override
public void fail(ErrorCode errorCode) {
SQL.New(EipVO.class)
.eq(EipVO_.uuid, msg.getEipUuid())
.eq(EipVO_.vmNicUuid, attachedVmNicUuid)
.eq(EipVO_.guestIp, attachedGuestIp)
.set(EipVO_.vmNicUuid, null)
.set(EipVO_.guestIp, null)
.update();
evt.setError(errorCode);
bus.publish(evt);
}
Expand Down