File tree Expand file tree Collapse file tree
plugin/localstorage/src/main/java/org/zstack/storage/primary/local Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555import javax .persistence .LockModeType ;
5656import javax .persistence .Tuple ;
5757import javax .persistence .TypedQuery ;
58+ import javax .persistence .metamodel .SingularAttribute ;
59+
5860import java .util .*;
5961import 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 ();
You can’t perform that action at this time.
0 commit comments