@@ -1007,6 +1007,24 @@ public Answer sendToSecStorage(HostVO ssHost, Command cmd) {
10071007 }
10081008 }
10091009
1010+
1011+ @ Override
1012+ public HostVO getSSAgent (HostVO ssHost ) {
1013+ if ( ssHost .getType () == Host .Type .LocalSecondaryStorage ) {
1014+ return ssHost ;
1015+ } else if ( ssHost .getType () == Host .Type .SecondaryStorage ) {
1016+ Long dcId = ssHost .getDataCenterId ();
1017+ List <HostVO > ssAHosts = _hostDao .listBy (Host .Type .SecondaryStorageVM , dcId );
1018+ if (ssAHosts == null || ssAHosts .isEmpty () ) {
1019+ return null ;
1020+ }
1021+ int size = ssAHosts .size ();
1022+ Random rn = new Random (System .currentTimeMillis ());
1023+ return ssAHosts .get (rn .nextInt (size ));
1024+ }
1025+ return null ;
1026+ }
1027+
10101028 @ Override
10111029 public long sendToSecStorage (HostVO ssHost , Command cmd , Listener listener ) {
10121030 if ( ssHost .getType () == Host .Type .LocalSecondaryStorage ) {
@@ -1021,7 +1039,7 @@ public long sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) {
10211039
10221040
10231041 private long sendToSSVM (final long dcId , final Command cmd , final Listener listener ) {
1024- List <HostVO > ssAHosts = _hostDao .listByTypeDataCenter (Host .Type .SecondaryStorageVM , dcId );
1042+ List <HostVO > ssAHosts = _hostDao .listBy (Host .Type .SecondaryStorageVM , dcId );
10251043 if (ssAHosts == null || ssAHosts .isEmpty () ) {
10261044 return -1 ;
10271045 }
@@ -1496,6 +1514,10 @@ public void disconnect(final long hostId, final Status.Event event, final boolea
14961514 }
14971515 }
14981516
1517+ @ Override
1518+ public void updateStatus (HostVO host , Status .Event event ) {
1519+ _hostDao .updateStatus (host , event , _nodeId );
1520+ }
14991521 public void disconnect (AgentAttache attache , final Status .Event event , final boolean investigate ) {
15001522 _executor .submit (new DisconnectTask (attache , event , investigate ));
15011523 }
@@ -2810,6 +2832,9 @@ protected void processRequest(final Link link, final Request request) {
28102832 } else if (cmd instanceof StartupProxyCommand ) {
28112833 final StartupProxyCommand startup = (StartupProxyCommand ) cmd ;
28122834 answer = new StartupAnswer (startup , attache .getId (), getPingInterval ());
2835+ } else if (cmd instanceof StartupSecondaryStorageCommand ) {
2836+ final StartupSecondaryStorageCommand startup = (StartupSecondaryStorageCommand ) cmd ;
2837+ answer = new StartupAnswer (startup , attache .getId (), getPingInterval ());
28132838 } else if (cmd instanceof StartupStorageCommand ) {
28142839 final StartupStorageCommand startup = (StartupStorageCommand ) cmd ;
28152840 answer = new StartupAnswer (startup , attache .getId (), getPingInterval ());
0 commit comments