File tree Expand file tree Collapse file tree
plugin/zbs/src/main/java/org/zstack/storage/zbs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -539,6 +539,7 @@ public void handle(Map data) {
539539 error (new FlowErrorHandler (completion ) {
540540 @ Override
541541 public void handle (ErrorCode errCode , Map data ) {
542+ syncMdsStatuses (newAddonInfo );
542543 completion .fail (errCode );
543544 }
544545 });
@@ -1361,6 +1362,24 @@ public void syncConfig(String config) {
13611362 this .config = StringUtils .isEmpty (config ) ? new Config () : JSONObjectUtil .toObject (config , Config .class );
13621363 }
13631364
1365+ private void syncMdsStatuses (AddonInfo newAddonInfo ) {
1366+ if (addonInfo == null || newAddonInfo == null ) {
1367+ return ;
1368+ }
1369+
1370+ for (MdsInfo newMds : newAddonInfo .getMdsInfos ()) {
1371+ for (MdsInfo existMds : addonInfo .getMdsInfos ()) {
1372+ if (existMds .getAddr ().equals (newMds .getAddr ())) {
1373+ existMds .setStatus (newMds .getStatus ());
1374+ }
1375+ }
1376+ }
1377+
1378+ SQL .New (ExternalPrimaryStorageVO .class ).eq (ExternalPrimaryStorageVO_ .uuid , self .getUuid ())
1379+ .set (ExternalPrimaryStorageVO_ .addonInfo , JSONObjectUtil .toJsonString (addonInfo ))
1380+ .update ();
1381+ }
1382+
13641383 @ Deprecated
13651384 private void reloadDbInfo () {
13661385 self = dbf .reload (self );
You can’t perform that action at this time.
0 commit comments