Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
1ee9980
Initial commit
charles-phiri May 17, 2018
9f7eff1
some code to enhance the configure method in the Service Layer
charles-phiri May 17, 2018
987534e
refactored Service interface
charles-phiri May 17, 2018
4ef4c2f
refactored Service interface
charles-phiri May 23, 2018
6256e91
refactored Service interface
charles-phiri May 23, 2018
c7e5572
refactored Service interface
charles-phiri May 23, 2018
74822ce
refactored Service interface
charles-phiri May 24, 2018
e017c1c
refactored Service interface
charles-phiri May 24, 2018
9438236
refactored Service interface
charles-phiri May 28, 2018
99bb448
refactored Service interface
charles-phiri May 28, 2018
3cdb059
refactored Service interface
charles-phiri May 28, 2018
be2d1b3
refactored Service interface
charles-phiri May 29, 2018
6c76aa9
refactored Service interface
charles-phiri May 29, 2018
1e24faa
refactored Service interface
charles-phiri May 29, 2018
ee7907c
refactored Service interface
charles-phiri May 29, 2018
65b7d38
refactored Service interface
charles-phiri May 29, 2018
182dea9
Removed unused imports
charles-phiri May 29, 2018
395b246
refactored Service interface
charles-phiri May 29, 2018
aae408c
refactored Service interface
charles-phiri May 29, 2018
a4c6d5d
This is a compiled version of the work I have been doing so far. I am…
charles-phiri May 29, 2018
e8aa68b
Changed the schema script which was having errors when deploying the DB.
charles-phiri May 29, 2018
a10c798
Minor fixes on SQL schema file
charles-phiri May 30, 2018
e0292b5
Changed the schema script which was having errors when deploying the DB.
charles-phiri May 30, 2018
64a6185
Refactored some code in the API (Cmd) class.
charles-phiri May 30, 2018
135383d
Added some more functionality in the Service Layer class.
charles-phiri May 30, 2018
2be2e9d
Removed the code that was using generics in the class DiagnosticsKey.
charles-phiri May 30, 2018
943626e
Corrected code in my DiagnosticsConfigDepotImpl class that was using …
charles-phiri May 30, 2018
e187bc1
Corrected code in my RetrieveDiagnosticsVO class that was using the g…
charles-phiri May 30, 2018
98e2aa5
Yet still, removed some code using generics code.
charles-phiri May 30, 2018
3b97954
Added more code in the Service Layer class and refactored code in the…
charles-phiri May 31, 2018
987b6f7
Refactored code in Service Impl class.
charles-phiri May 31, 2018
2ff8287
Added code in spring xml file.
charles-phiri May 31, 2018
351f721
Created my own interface class for DiagnosticsConfigDepotImpl as I co…
charles-phiri May 31, 2018
94a2fb5
Changed most of the code in the DaO and VO classes including its usag…
charles-phiri Jun 4, 2018
8b57ee6
Refactored code in the Dao and VO, and also added one more method to …
charles-phiri Jun 5, 2018
8995e4f
Cleaned up the code and refactored code so that it has some of the ch…
charles-phiri Jun 6, 2018
e6c1029
Refactored code in the Service Layer impl.
charles-phiri Jun 6, 2018
974de4a
Made some code logic changes to the Service Layer when populating the…
charles-phiri Jun 7, 2018
fc5ef6f
Addressed comments on the code.
charles-phiri Jun 7, 2018
ca4dd82
Refactored code in the Service Layer for retrieving recodes from the …
charles-phiri Jun 7, 2018
ca5c308
Added unit test file to test the functionality in the Service Layer i…
charles-phiri Jun 12, 2018
fa129fa
Added unit test file to test the functionality in the Service Layer i…
charles-phiri Jun 12, 2018
e97895f
Removed the duplicated licence information.
charles-phiri Jun 12, 2018
f525aa9
1. Cleaned up code as per Daan's comments.
charles-phiri Jun 13, 2018
3e62161
Mgt-server could be running in a vm that does not have diskOffering. …
charles-phiri Jun 14, 2018
cc880d4
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 14, 2018
91514d4
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 14, 2018
141ab51
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 14, 2018
2e55ec2
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 19, 2018
d2b2d62
Added code to check capacity of the disk space and compare it to the …
charles-phiri Jun 20, 2018
45bd812
Added code to parse for a default value which is in square brackets, …
charles-phiri Jun 21, 2018
c9d7ad2
Inserted getters/setters for the script filename variables
charles-phiri Jun 21, 2018
dd5579d
Added skeleton scripts (still adding code) to retrieve files and run …
charles-phiri Jun 26, 2018
46098bc
Added code for the two command classes (ExecuteScriptCommand and Retr…
charles-phiri Jun 27, 2018
5d22c03
Added code for the two command classes (ExecuteScriptCommand and Retr…
charles-phiri Jun 27, 2018
5086e34
Added code for the two command classes (ExecuteScriptCommand and Retr…
charles-phiri Jun 27, 2018
555cc86
Add method to check disk space
charles-phiri Jun 27, 2018
94b414d
Minor changes in unit test
charles-phiri Jun 27, 2018
0f19d46
Still working on unit test
charles-phiri Jun 28, 2018
956a434
Added more unit tests.
charles-phiri Jun 28, 2018
76e5545
Skeleton implementation of the Garbage Collector.
charles-phiri Jun 28, 2018
c458261
Refactored code while testing, mostly in the Service Layer. Added a c…
charles-phiri Jul 8, 2018
9a6c5cf
Got rid of the cyclic dependencies that I was encountering when compi…
charles-phiri Jul 10, 2018
24f123a
Merge branch 'master' of https://github.com/apache/cloudstack into re…
charles-phiri Jul 10, 2018
f66c840
Refactored code in the Service Layer and the python scripts for retri…
charles-phiri Jul 17, 2018
1e4a426
Marvin tests for the RetrieveDiagnostics API
charles-phiri Jul 19, 2018
63f6b9b
Full complete code after refactoring. Addition of copyFileFromSystemV…
charles-phiri Jul 25, 2018
3acbfe4
Code cleanup and refactoring
charles-phiri Jul 26, 2018
d08cc7b
Complete RerieveDiagnostics API implementation for testing.
charles-phiri Jul 27, 2018
3c12e07
Complete RerieveDiagnostics API .
charles-phiri Jul 27, 2018
f88bde0
Minor bug fixes.
charles-phiri Jul 29, 2018
720da4c
Code for the RetrieveDiagnostics API.
charles-phiri Aug 8, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added code to check capacity of the disk space and compare it to the …
…threshold.Also added a skeleton script.
  • Loading branch information
charles-phiri committed Jul 8, 2018
commit 2e55ec277d318b9186301d5c492aa9df9362682e
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
// Licensed to the Apache Software Foundation (ASF) under one
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

three licenses is a bit overdone

// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

/*
* // Licensed to the Apache Software Foundation (ASF) under one
* // or more contributor license agreements. See the NOTICE file
* // distributed with this work for additional information
* // regarding copyright ownership. The ASF licenses this file
* // to you under the Apache License, Version 2.0 (the
* // "License"); you may not use this file except in compliance
* // with the License. You may obtain a copy of the License at
* //
* // http://www.apache.org/licenses/LICENSE-2.0
* //
* // Unless required by applicable law or agreed to in writing,
* // software distributed under the License is distributed on an
* // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* // KIND, either express or implied. See the License for the
* // specific language governing permissions and limitations
* // under the License.
*/

package com.cloud.agent.api;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.HashMap;
import java.util.List;

public interface DiagnosticsConfigDepot {
public interface DiagnosticsConfigurator {

void set(DiagnosticsKey key, String value);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@
package org.apache.cloudstack.framework.config.impl;

import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.cloudstack.framework.config.DiagnosticsConfigDepot;
import org.apache.cloudstack.framework.config.DiagnosticsConfigurator;
import org.apache.commons.lang.ObjectUtils;
import org.apache.log4j.Logger;

import javax.inject.Inject;
import java.util.HashMap;
import java.util.List;

public class DiagnosticsConfigDepotImpl implements DiagnosticsConfigDepot {
public class DiagnosticsConfiguratorImpl implements DiagnosticsConfigurator {

private final static Logger LOGGER = Logger.getLogger(DiagnosticsConfigDepotImpl.class);
private final static Logger LOGGER = Logger.getLogger(DiagnosticsConfiguratorImpl.class);
@Inject
RetrieveDiagnosticsDao _diagnosticsDao;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need the antiquated convention of prefix '_' on member names.



HashMap<String, List<DiagnosticsKey>> diagnosticsKeyHashMap = null;

public DiagnosticsConfigDepotImpl() {
public DiagnosticsConfiguratorImpl() {
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public String toString()
return diagnosticsClassType;
}

static DiagnosticsConfigDepotImpl s_depot = new DiagnosticsConfigDepotImpl();
static DiagnosticsConfiguratorImpl s_depot = new DiagnosticsConfiguratorImpl();


public DiagnosticsKey() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
class="org.apache.cloudstack.spring.lifecycle.registry.ExtensionRegistry" />

<bean id="diagnosticsConfigDepotImpl"
class="org.apache.cloudstack.framework.config.impl.DiagnosticsConfigDepotImpl" />
class="org.apache.cloudstack.framework.config.impl.DiagnosticsConfiguratorImpl" />

<bean id="RetrieveDiagnosticsDao"
class="org.apache.cloudstack.framework.config.RetrieveDiagnosticsDaoImpl" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.DiagnosticsConfigDepot;
import org.apache.cloudstack.framework.config.DiagnosticsConfigurator;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.framework.config.impl.ConfigurationVO;
import org.apache.cloudstack.framework.config.impl.DiagnosticsKey;
Expand All @@ -75,10 +75,12 @@

import javax.inject.Inject;
import javax.naming.ConfigurationException;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipOutputStream;

public class RetrieveDiagnosticsServiceImpl extends ManagerBase implements RetrieveDiagnosticsService, Configurable {

Expand Down Expand Up @@ -123,7 +125,7 @@ public class RetrieveDiagnosticsServiceImpl extends ManagerBase implements Retri
ConfigDepot _configDepot;

@Inject
DiagnosticsConfigDepot _diagnosticsDepot;
DiagnosticsConfigurator _diagnosticsDepot;

@Inject
ConfigDepot configDepot;
Expand Down Expand Up @@ -415,6 +417,7 @@ protected void retrieveDiagnosticsFiles(Long ssHostId, List<String> diagnosticsF
}
}
}
//get the downloaded files from the /tmp directory and create a zip file to add the files
if (assignSecStorageFromRunningPool(ssHostId) != null) {


Expand All @@ -423,6 +426,13 @@ protected void retrieveDiagnosticsFiles(Long ssHostId, List<String> diagnosticsF

}

private void checkDiagnosticsFilesAndZip(String diagnosticsFileName, ZipOutputStream zipFile) {
File f = new File(diagnosticsFileName);
if (f.exists() && !f.isDirectory()) {

}
}

private List<Short> getCapacityTypesAtClusterLevel() {
List<Short> clusterCapacityTypes = new ArrayList<Short>();
clusterCapacityTypes.add(Capacity.CAPACITY_TYPE_CPU);
Expand Down
58 changes: 58 additions & 0 deletions systemvm/debian/opt/cloud/bin/copy_zip_diagnostics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#Licensed to the Apache Software Foundation (ASF) under one
#or more contributor license agreements. See the NOTICE file
#distributed with this work for additional information
#regarding copyright ownership. The ASF licenses this file
#to you under the Apache License, Version 2.0 (the
#"License"); you may not use this file except in compliance
#with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing,
#software distributed under the License is distributed on an
#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#KIND, either express or implied. See the License for the
#specific language governing permissions and limitations
#under the License.

# importing required modules

from zipfile import ZipFile
import os

def get_all_file_paths(directory):

# initializing empty file paths list
file_paths = []
# crawling through directory and subdirectories
for root, directories, files in os.walk(directory):
for filename in files:
# join the two strings in order to form the full filepath.
filepath = os.path.join(root, filename)
file_paths.append(filepath)

# returning all filepaths
return file_paths

def main():
# path to folder which needs to be zipped
directory = './python_files'

# calling function to get all file paths in the directory
file_paths = get_all_file_paths(directory)

# printing the list of all files to be zipped
print('Following files will be zipped:')
for file_name in file_paths:
print(file_name)

# writing files to a zipfile
with ZipFile('my_python_files.zip', 'w') as zip:
# writing each file one by one
for file in file_paths:
zip.write(file)

print('All files zipped successfully!')

if __name__ == "__main__":
main()