Skip to content

Commit cc6e01a

Browse files
author
FuBang
committed
improve the means of fixing ZSTAC-9944
1 parent 6a812da commit cc6e01a

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

plugin/localstorage/src/main/java/org/zstack/storage/primary/local/LocalStorageBase.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@
5555
import javax.persistence.LockModeType;
5656
import javax.persistence.Tuple;
5757
import javax.persistence.TypedQuery;
58+
import javax.persistence.metamodel.SingularAttribute;
59+
5860
import java.util.*;
5961
import java.util.concurrent.Callable;
6062

@@ -788,10 +790,17 @@ private void handle(APIGetLocalStorageHostDiskCapacityMsg msg) {
788790
long totalPhy = 0;
789791

790792
if (ref == null) {
791-
logger.error(errf.instantiateErrorCode(SysErrors.RESOURCE_NOT_FOUND,
792-
String.format("local primary storage[uuid:%s] doesn't have the host[uuid:%s]",
793-
self.getUuid(), msg.getHostUuid())).toString());
794-
}else {
793+
HostStatus status = Q.New(HostVO.class).select(HostVO_.status)
794+
.eq(HostVO_.uuid, msg.getHostUuid()).findValue();
795+
if (status == HostStatus.Connected) {
796+
reply.setError(errf.instantiateErrorCode(SysErrors.RESOURCE_NOT_FOUND,
797+
String.format(
798+
"local primary storage[uuid:%s] doesn't have the host[uuid:%s]",
799+
self.getUuid(), msg.getHostUuid())));
800+
bus.reply(msg, reply);
801+
return;
802+
}
803+
} else {
795804
total = ref.getTotalCapacity();
796805
available = ref.getAvailableCapacity();
797806
availablePhy = ref.getAvailablePhysicalCapacity();

0 commit comments

Comments
 (0)