Skip to content

Commit b58a489

Browse files
committed
nic 상태 up, down 시 가상머신 상태값 상관없이 반영되도록 수정
1 parent a7f5646 commit b58a489

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

server/src/main/java/com/cloud/vm/UserVmManagerImpl.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9680,13 +9680,12 @@ public UserVm updateVmNicLinkState(UpdateVmNicLinkStateCmd cmd){
96809680
throw new InvalidParameterValueException(nic + " is not a nic on " + vmInstance);
96819681
}
96829682

9683-
//make sure the VM is Running or Stopped
9684-
if ((vmInstance.getState() != State.Running)) {
9685-
throw new CloudRuntimeException("refusing to set default " + vmInstance + " is not Running");
9686-
}
96879683
final NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), _networkModel.getNetworkRate(network.getId(), vmInstance.getId()),
96889684
_networkModel.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmInstance.getHypervisorType(), network));
96899685

9686+
nic.setLinkState(cmd.getLinkState());
9687+
_nicDao.update(nicId, nic);
9688+
96909689
if (vmInstance.getState() == State.Running) {
96919690
VirtualMachineProfile vmProfile = new VirtualMachineProfileImpl(vmInstance);
96929691
final HypervisorGuru hvGuru = _hvGuruMgr.getGuru(vmProfile.getVirtualMachine().getHypervisorType());
@@ -9695,9 +9694,6 @@ public UserVm updateVmNicLinkState(UpdateVmNicLinkStateCmd cmd){
96959694
Long hostId = vmInstance.getHostId() != null ? vmInstance.getHostId() : vmInstance.getLastHostId();
96969695
NicLinkStateCommand nlscmd = new NicLinkStateCommand(nicTO, vmInstance.getInstanceName(), cmd.getLinkState());
96979696

9698-
nic.setLinkState(cmd.getLinkState());
9699-
_nicDao.update(nicId, nic);
9700-
97019697
try {
97029698
Answer answer = _agentMgr.send(hostId, nlscmd);
97039699
if (answer == null || !answer.getResult()) {

0 commit comments

Comments
 (0)