@@ -95,17 +95,17 @@ public class DiagnosticsServiceImpl extends ManagerBase implements PluggableServ
9595 private NfsMountManager mountManager ;
9696
9797 // This 2 settings should require a restart of the management server?
98- private static final ConfigKey <Boolean > EnableGarbageCollector = new ConfigKey <>("Advanced" , Boolean .class ,
98+ static final ConfigKey <Boolean > EnableGarbageCollector = new ConfigKey <>("Advanced" , Boolean .class ,
9999 "diagnostics.data.gc.enable" , "true" , "enable the diagnostics data files garbage collector" , false );
100- private static final ConfigKey <Integer > GarbageCollectionInterval = new ConfigKey <>("Advanced" , Integer .class ,
100+ static final ConfigKey <Integer > GarbageCollectionInterval = new ConfigKey <>("Advanced" , Integer .class ,
101101 "diagnostics.data.gc.interval" , "86400" , "garbage collection interval in seconds" , false );
102102
103103 // These are easily computed properties and need not need a restart of the management server
104- private static final ConfigKey <Long > DataRetrievalTimeout = new ConfigKey <>("Advanced" , Long .class ,
104+ static final ConfigKey <Long > DataRetrievalTimeout = new ConfigKey <>("Advanced" , Long .class ,
105105 "diagnostics.data.retrieval.timeout" , "3600" , "overall data retrieval timeout in seconds" , true );
106- private static final ConfigKey <Long > MaximumFileAgeforGarbageCollection = new ConfigKey <>("Advanced" , Long .class ,
106+ static final ConfigKey <Long > MaximumFileAgeforGarbageCollection = new ConfigKey <>("Advanced" , Long .class ,
107107 "diagnostics.data.max.file.age" , "86400" , "maximum file age for garbage collection in seconds" , true );
108- private static final ConfigKey <Double > DiskQuotaPercentageThreshold = new ConfigKey <>("Advanced" , Double .class ,
108+ static final ConfigKey <Double > DiskQuotaPercentageThreshold = new ConfigKey <>("Advanced" , Double .class ,
109109 "diagnostics.data.disable.threshold" , "0.95" , "Minimum disk space percentage to initiate diagnostics file retrieval" , true );
110110
111111 final static String COMMAND = "/bin/bash" ;
@@ -221,7 +221,30 @@ public String getDiagnosticsDataCommand(GetDiagnosticsDataCmd cmd) {
221221 }
222222 }
223223
224- private boolean orchestrateMoveToSecondaryStorageNonVMware (final DataStore store , final String vmControlIp , String fileToCopy , Long vmHostId ) {
224+ protected boolean hasValidChars (String optionalArgs ) {
225+ if (Strings .isNullOrEmpty (optionalArgs )) {
226+ return true ;
227+ } else {
228+ final String regex = "^[\\ w\\ -\\ s.]+$" ;
229+ final Pattern pattern = Pattern .compile (regex );
230+ return pattern .matcher (optionalArgs ).find ();
231+ }
232+ }
233+
234+ protected String prepareShellCmd (String cmdType , String ipAddress , String optionalParams ) {
235+ final String CMD_TEMPLATE = String .format ("%s %s" , cmdType , ipAddress );
236+ if (Strings .isNullOrEmpty (optionalParams )) {
237+ return CMD_TEMPLATE ;
238+ } else {
239+ if (hasValidChars (optionalParams )) {
240+ return String .format ("%s %s" , CMD_TEMPLATE , optionalParams );
241+ } else {
242+ return null ;
243+ }
244+ }
245+ }
246+
247+ protected boolean orchestrateMoveToSecondaryStorageNonVMware (final DataStore store , final String vmControlIp , String fileToCopy , Long vmHostId ) {
225248 // Send copy to secondary storage command to hypervisor host for non XenServer/KVM hypervisor
226249 // Let hypervisor host take care of cleaning up file from system VM in case of failures
227250 // We only want to know if file is in secondary storage or not at this point
@@ -230,7 +253,7 @@ private boolean orchestrateMoveToSecondaryStorageNonVMware(final DataStore store
230253 return copyToSecondaryAnswer .getResult ();
231254 }
232255
233- private boolean orchestrateMoveToSecondaryStorageVMware (final DataStore store , final String vmSshIp , String diagnosticsFile ) {
256+ protected boolean orchestrateMoveToSecondaryStorageVMware (final DataStore store , final String vmSshIp , String diagnosticsFile ) {
234257 String mountPoint ;
235258 boolean success ;
236259 try {
@@ -277,31 +300,8 @@ private boolean orchestrateMoveToSecondaryStorageVMware(final DataStore store, f
277300 return success ;
278301 }
279302
280- protected boolean hasValidChars (String optionalArgs ) {
281- if (Strings .isNullOrEmpty (optionalArgs )) {
282- return true ;
283- } else {
284- final String regex = "^[\\ w\\ -\\ s.]+$" ;
285- final Pattern pattern = Pattern .compile (regex );
286- return pattern .matcher (optionalArgs ).find ();
287- }
288- }
289-
290- protected String prepareShellCmd (String cmdType , String ipAddress , String optionalParams ) {
291- final String CMD_TEMPLATE = String .format ("%s %s" , cmdType , ipAddress );
292- if (Strings .isNullOrEmpty (optionalParams )) {
293- return CMD_TEMPLATE ;
294- } else {
295- if (hasValidChars (optionalParams )) {
296- return String .format ("%s %s" , CMD_TEMPLATE , optionalParams );
297- } else {
298- return null ;
299- }
300- }
301- }
302-
303303 // Get ssvm from the zone to use for creating entity download URL
304- private VMInstanceVO getSecondaryStorageVmInZone (Long zoneId ) {
304+ protected VMInstanceVO getSecondaryStorageVmInZone (Long zoneId ) {
305305 List <VMInstanceVO > ssvm = instanceDao .listByZoneIdAndType (zoneId , VirtualMachine .Type .SecondaryStorageVm );
306306 return (CollectionUtils .isEmpty (ssvm )) ? null : ssvm .get (0 );
307307 }
@@ -312,7 +312,7 @@ private VMInstanceVO getSecondaryStorageVmInZone(Long zoneId) {
312312 * @param zoneId
313313 * @return
314314 */
315- private DataStore getImageStore (Long zoneId ) {
315+ protected DataStore getImageStore (Long zoneId ) {
316316 List <DataStore > stores = storeMgr .getImageStoresByScope (new ZoneScope (zoneId ));
317317 if (CollectionUtils .isEmpty (stores )) {
318318 throw new CloudRuntimeException ("No Secondary storage found in Zone with Id: " + zoneId );
@@ -332,7 +332,7 @@ private DataStore getImageStore(Long zoneId) {
332332 }
333333
334334 // createEntityExtractUrl throws CloudRuntime exception in case of failure
335- private String createFileDownloadUrl (DataStore store , Hypervisor .HypervisorType hypervisorType , String filePath ) {
335+ protected String createFileDownloadUrl (DataStore store , Hypervisor .HypervisorType hypervisorType , String filePath ) {
336336 // Get image store driver
337337 ImageStoreEntity secStore = (ImageStoreEntity ) store ;
338338 //Create dummy TO with hyperType
0 commit comments