Skip to content

Conversation

DaanHoogland
Copy link
Member

No description provided.

Copy link
Member Author

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

nice concepts you use. I do not see the overall yet, but it looks promissing

HashMap<DiagnosticsKey.DiagnosticsType, Set<DiagnosticsKey<?>>> _diagnosticsTypeLevelsMap = new HashMap<DiagnosticsKey.DiagnosticsType, Set<DiagnosticsKey<?>>>();


\
Copy link
Member Author

Choose a reason for hiding this comment

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

what happened here? seems syntactically fine but kind of strange formatting

@@ -81,7 +77,7 @@ protected void populateConfiguration(Date date, Configurable configurable) {

s_logger.debug("Retrieving keys from " + configurable.getClass().getSimpleName());

for (DiagnosticsKey<?> key : configurable..etConfigKeys()) {
for (DiagnosticsKey<?> key : configurable. . ..get.get.getConfigKeys()) {
Copy link
Member Author

Choose a reason for hiding this comment

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

some artifact that wasn't intended?




/* public ConfigKey.Scope scope() {
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment need not be, as we use a versioning system

import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
import org.apache.cloudstack.framework.config.impl.ConfigDepotImpl;
import org.apache.cloudstack.framework.config.ScopedConfigStorage;
Copy link
Member Author

Choose a reason for hiding this comment

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

I cannot find this class. is it checked in?

Copy link
Member Author

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

I like how you use the concept of generics. I also see what you are trying to achieve with it. I hope you are not making it to complicated for yourself. We are going to need a lot of unit and integration tests for this to have a clean end result.

import org.apache.cloudstack.framework.config.ConfigDepot;
import org.apache.cloudstack.framework.config.ConfigDepotAdmin;
import org.apache.cloudstack.framework.config.ScopedConfigStorage;
import org.apache.cloudstack.framework.config.*;
Copy link
Member Author

Choose a reason for hiding this comment

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

new one?

}

@Override
public <T> void set(ConfigKey<T> key, T value) {
_configDao.update(key.key(), value.toString());
//_diagnosticsDao.update(key.key(), value.toString());
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment

}

@Override
public <T> void createOrUpdateConfigObject(String componentName, ConfigKey<T> key, String value) {
createOrupdateConfigObject(new Date(), componentName, key, value);
//createOrupdateConfigObject(new Date(), componentName, key, value);
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment

public DiagnosticsKey(String role, DiagnosticsEntryType diagnosticstype, String description) {
_role = role;
_diagnosticsType = diagnosticstype;
/* public DiagnosticsKey(Class<T> type, String name, String description) {
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment

@@ -118,4 +147,8 @@ protected String valueOf(String value) {
}
}

/* public static DiagnosticsKey<?> getDiagnosticsClassKeys() {
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment

//get list of default files from the database table for this diagnostics type
} else {
throw new InvalidParameterValueException("Invalid parameters");
// System.exit(-1);
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment

Copy link
Member Author

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

the branch still doesn't compile for me.


public RetrieveDiagnosticsVO(String roleId, String role, String className, String value) {
this.roleId = roleId;
/* public RetrieveDiagnosticsVO(String roleId, String role, String className, String value) {
Copy link
Member Author

Choose a reason for hiding this comment

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

no code in comment please

@@ -73,35 +70,26 @@ public void setRole(String role) {
this.role = role;
}

public void setClassName(String className) {
public void setDiagnosticsType(String className) {
Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@@ -35,28 +33,12 @@

public interface RetrieveDiagnosticsService extends Manager, PluggableService {

ConfigKey<Long> RetrieveDiagnosticsTimeOut = new ConfigKey<Long>("Advanced", Long.class, "retrieveDiagnostics.retrieval.timeout", "3600",
Copy link
Member Author

Choose a reason for hiding this comment

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

why move to the Impl? isn't it fine here?

"The interval between garbage collection executions in seconds", true, ConfigKey.Scope.Global);


/* DiagnosticsKey<String> IPTablesRemove = new DiagnosticsKey<String>(String.class, "IPtables.remove", "The IPtables rules to be removed", null, null);
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove code instead of commenting it out. we have a versioning system to retrieve old code.

@charles-phiri charles-phiri force-pushed the retrieve-diagnostics branch from 35eecfd to 9892e79 Compare May 29, 2018 10:06
Copy link
Member Author

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

I had a new high-level pass on the whole of it. I have two main questions:

  1. naming in general needs attention. Can we improve on that a bit.
  2. I want to see why you created the generic. What is your purpose for it?


RetrieveDiagnosticsResponse getDiagnosticsFiles(final RetrieveDiagnosticsCmd cmd) throws InvalidParameterValueException, ConfigurationException;

ConfigKey<?>[] getConfigKeys();
Copy link
Member Author

Choose a reason for hiding this comment

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

this method shouldn't be declared here. It is part of interface Configurable.

Choose a reason for hiding this comment

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

Removed ConfigKey<?> getConfigKeys() from ServiceImpl

Copy link
Member Author

Choose a reason for hiding this comment

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

It should remain in the ServiceImpl, @charles-phiri . But it shouldn't be in this interface. It is already defined in Configerable.

@@ -266,6 +267,7 @@
public static final String EVENT_SSVM_STOP = "SSVM.STOP";
public static final String EVENT_SSVM_REBOOT = "SSVM.REBOOT";
public static final String EVENT_SSVM_HA = "SSVM.HA";
public static final String EVENT_SSVM_DIAGNOSTICS = "SSVM.DIAGNOSTICS";
Copy link
Member Author

Choose a reason for hiding this comment

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

EVENT_SSVM_DIAGNOSTICS is not used outside this file. Do we really need it?

Choose a reason for hiding this comment

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

Removed EVENT_SSVM_DIAGNOSTICS

INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 4, 'moveNetworkAclItem', 'ALLOW', 260) ON DUPLICATE KEY UPDATE rule=rule;

CREATE TABLE `cloud`.`diagnosticsdata` (
Copy link
Member Author

Choose a reason for hiding this comment

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

isn't this more of a 'diagnostics_defaults' or 'diagnostics_configuration'? I don't think the name diagnosticsdata is right for this table.

Choose a reason for hiding this comment

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

I think it is a matter of preference. The name was suggested by Dag....don't know what you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

diagnostics data to me suggests that the result of any action or gathering is in this table, as opposed to it containing a means of steering how gathering is done. Hence my two suggestions. I am not religious obout those two, but I think the name diagnosticsdata is misleading.


private void createOrupdateDiagnosticsObject(String componentName, DiagnosticsKey<?> diagnosticsType) {
RetrieveDiagnosticsVO vo = _diagnosticsDao.findById(diagnosticsType.key());
//DiagnosticsKey diagnosticsKey = new DiagnosticsKey(diagnosticsType.getClass(), diagnosticsType.key(), "new diagnostics")
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment


private final static Logger s_logger = Logger.getLogger(DiagnosticsConfigDepotImpl.class);
@Inject
RetrieveDiagnosticsDao _diagnosticsDao;
Copy link
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.


} else {
throw new InvalidParameterValueException("Invalid parameters");
// System.exit(-1);
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment


public DiagnosticsKey<?>[] getDiagnosticsConfigKeys()
{
return null; //new DiagnosticsKey<?>[] { IPTablesRemove, IPTablesRetrieve, LOGFILES, PROPERTYFILES, DNSFILES, DHCPFILES, USERDATA, LB, VPN };
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment

return cmdList;
}

/* public SecondaryStorageVmVO startSecondaryStorageVm(long secStorageVmId) {
Copy link
Member Author

Choose a reason for hiding this comment

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

code in comment

if (fileDetails != null) {
filesToRetrieve = fileDetails.split(",");
} else {
filesToRetrieve = null;//retrieve default files from db
Copy link
Member Author

Choose a reason for hiding this comment

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

is this comment a TODO?

@@ -190,7 +190,8 @@
'CA': 'Certificate',
'listElastistorInterface': 'Misc',
'cloudian': 'Cloudian',
'Sioc' : 'Sioc'
'Sioc' : 'Sioc',
'retrieveDiagnostics': 'System VM'
Copy link
Member Author

Choose a reason for hiding this comment

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

is this the right tag/token? it seems to me that it deserves its own class. It will also be applicable to hosts in the future (maybe)

Choose a reason for hiding this comment

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

From the documentation, it looks to me like it is the right file.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, it is the right file. I wonder about the value of the tag, not the place it is defined

Copy link
Member Author

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

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

so far, now.
pleae push further changes asap.

@@ -0,0 +1,59 @@
/*
* // Licensed to the Apache Software Foundation (ASF) under one
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove the nested comment

Choose a reason for hiding this comment

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

Done

* // under the License.
*/

// Licensed to the Apache Software Foundation (ASF) under one
Copy link
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

@@ -0,0 +1,90 @@
/*
* // Licensed to the Apache Software Foundation (ASF) under one
Copy link
Member Author

Choose a reason for hiding this comment

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

same issue as in answer

Choose a reason for hiding this comment

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

Done


public RetrieveDiagnosticsService getRetrieveDiagnosticsService() {
return retrieveDiagnosticsService;
public static Logger getS_logger() {
Copy link
Member Author

Choose a reason for hiding this comment

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

why an accessor for the logger? it is only used locally isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

also it should be called LOGGER or LOG as it is static final. and not have the obsoleted 's_' prefix

}

public void setRetrieveDiagnosticsService(RetrieveDiagnosticsService retrieveDiagnosticsService) {
this.retrieveDiagnosticsService = retrieveDiagnosticsService;
public static String getAPINAME() {
Copy link
Member Author

Choose a reason for hiding this comment

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

this is not to be accessed outside the class is it?

INSERT INTO `cloud`.`diagnosticsdata` (`role`, `class`, `value`) values ('VR', 'VPN', '<vpn configuration file>');
INSERT INTO `cloud`.`diagnosticsdata` (`role`, `class`, `value`) values ('VR', 'LOGFILES', 'cloud.log,agent.log');
INSERT INTO `cloud`.`diagnosticsdata` (`role`, `class`, `value`) values ('CPVM', 'PROPERTYFILES', '<CPVM property file>');
INSERT INTO `cloud`.`diagnosticsdata` (`role`, `class`, `value`) values ('SecondaryStorageVm', 'LOGFILES', 'cloud.log,agent.log,[IPTABLES]');
Copy link
Member Author

Choose a reason for hiding this comment

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

👍

@@ -0,0 +1,38 @@
/*
Copy link
Member Author

Choose a reason for hiding this comment

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

can you remove the nesting in the comment, please?

Choose a reason for hiding this comment

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

Done.

Copy link
Member Author

Choose a reason for hiding this comment

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

no, it is still here

Choose a reason for hiding this comment

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

I have changed it. Will make a push soon after completing the code I am working on.

@@ -0,0 +1,62 @@
/*
* // Licensed to the Apache Software Foundation (ASF) under one
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove the nesting in the comment.

Choose a reason for hiding this comment

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

Done.

Copy link
Member Author

Choose a reason for hiding this comment

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

but you didn't commit it?

@@ -37,6 +37,11 @@
@Param(description = "the date and time of the last download of the diagnostics files")
private Date lastSent;

@SerializedName(ApiConstants.TIMEOUT)
@Param(description = "the timeout (in seconds) for requests to the retrieve diagnostics API")
Copy link
Member Author

Choose a reason for hiding this comment

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

what is the purpose of this in the response? i.e. what information does the user get from this response field?

@@ -740,6 +743,7 @@
entityEventDetails.put(EVENT_SSVM_STOP, VirtualMachine.class);
entityEventDetails.put(EVENT_SSVM_REBOOT, VirtualMachine.class);
entityEventDetails.put(EVENT_SSVM_HA, VirtualMachine.class);
entityEventDetails.put(EVENT_SSVM_DIAGNOSTICS, VirtualMachine.class);
Copy link
Member Author

Choose a reason for hiding this comment

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

when is this fired?

Choose a reason for hiding this comment

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

Removed it but I think we might need Events at a later stage.

RetrieveDiagnosticsResponse retrieveDiagnosticsResponse = new RetrieveDiagnosticsResponse();
try {
retrieveDiagnosticsService.getDiagnosticsFiles(this);
retrieveDiagnosticsResponse.setObjectName("retrievediagnostics");
Copy link
Member Author

Choose a reason for hiding this comment

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

is this the ideal object name? did you have other names considdered?

Choose a reason for hiding this comment

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

What can you suggest?

Copy link
Member Author

Choose a reason for hiding this comment

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

"diagnostics" maybe? or retrievedlogs, diagnosticsinformation. diagnosticdata.
I am really not sure it is a sincere question. It is just that retrievediagnostics (which is a spelling error btw, only one d) does not seem right.
from wiktionary: diagnostics

plural of diagnostic
The process of determining the state of or capability of a component to perform its function(s).

retrieving a process is not intuitively right.

Choose a reason for hiding this comment

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

I think diagnosticsinformation makes sense. Do you want me to change the whole class or just retrieveDiagnosticsResponse.setObjectName("retrievediagnostics");


@Override
public String getEventDescription() {
return "Retrieved diagnostics files from System VM =" + id;
Copy link
Member Author

Choose a reason for hiding this comment

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

"System VM =" may be too specific if we add hosts or hardware loadbalancers. We might go for "host: ". What do you think?

Choose a reason for hiding this comment

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

Perfectly makes sense

@@ -16,8 +16,9 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;

import org.apache.log4j.Logger;
Copy link
Member Author

Choose a reason for hiding this comment

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

there is only imports chaged in this file. consider reverting it.

Choose a reason for hiding this comment

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

Okay

Choose a reason for hiding this comment

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

Reverted it.

}

@Override
public boolean isQuery() {
Copy link
Member Author

Choose a reason for hiding this comment

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

please look at the formatting here

Choose a reason for hiding this comment

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

Okay

@Component
public class RetrieveDiagnosticsDaoImpl extends GenericDaoBase<RetrieveDiagnosticsVO, String> implements RetrieveDiagnosticsDao
{
private final SearchBuilder<RetrieveDiagnosticsVO> DiagnosticsSearchByType;
Copy link
Member Author

Choose a reason for hiding this comment

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

can you check if we need this, please. it is not used in the class or in its interface. I think you blindly copied my code from annotations and I should have removed it there myself. I am not sure, though.

import java.util.HashMap;
import java.util.List;

public class DiagnosticsConfigDepotImpl implements DiagnosticsConfigDepot {
Copy link
Member Author

Choose a reason for hiding this comment

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

The name depot is not very fortunate. Please help think of a better one. I am thinking of just DiagnosticsConfiguration or DiagnosticsConfigurator.

Choose a reason for hiding this comment

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

You are right, thanks

Choose a reason for hiding this comment

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

Done


public class DiagnosticsConfigDepotImpl implements DiagnosticsConfigDepot {

private final static Logger s_logger = Logger.getLogger(DiagnosticsConfigDepotImpl.class);
Copy link
Member Author

Choose a reason for hiding this comment

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

the naming convention of s_ is obsolete, please use the name for a static final in all uppercase; i.e. LOG or LOGGER

Choose a reason for hiding this comment

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

Done. Will have to look at other classes and change as required.

import java.util.HashMap;
import java.util.List;

public interface DiagnosticsConfigDepot {
Copy link
Member Author

Choose a reason for hiding this comment

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

naming is a bit off. please see the -Impl for discussion

Choose a reason for hiding this comment

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

We have to discuss this so that I can learn the naming conversion. Meanwhile, I will leave it as it is.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think you mean convention, right? I am not sure there is a convention for what you are trying to do here yet. That would mean we are free to choose. Of course with that freedom comes great responsibility ;) I must be intuitively right.

@Parameter(name = ApiConstants.ID,
type = CommandType.UUID,
entityType = RetrieveDiagnosticsResponse.class,
entityType = DomainRouterResponse.class,
Copy link
Member Author

Choose a reason for hiding this comment

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

So this call is now only valid for DomainRouters? using the DomainRouterResponse.class...? I think something went wrong here

@@ -31,14 +31,14 @@
@Component
public class RetrieveDiagnosticsDaoImpl extends GenericDaoBase<RetrieveDiagnosticsVO, String> implements RetrieveDiagnosticsDao
{
private final SearchBuilder<RetrieveDiagnosticsVO> DiagnosticsSearchByType;
// private final SearchBuilder<RetrieveDiagnosticsVO> DiagnosticsSearchByType;
Copy link
Member Author

Choose a reason for hiding this comment

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

did it work, without? (just remove, git will find it back if you need it;)

Choose a reason for hiding this comment

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

Yes, it did work thanks

@@ -0,0 +1,24 @@

/*
* // Licensed to the Apache Software Foundation (ASF) under one
Copy link
Member Author

Choose a reason for hiding this comment

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

this is still nested comment

Choose a reason for hiding this comment

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

Done

Copy link
Member

@borisstoyanov borisstoyanov left a comment

Choose a reason for hiding this comment

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

Can we also add a marvin test?





Copy link
Member

Choose a reason for hiding this comment

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

is there any reason we need that many empty lines?

}

protected Answer copyFileFromSystemVm(final NetworkElementCommand cmd, String script) throws Exception {
final File keyFile = getSystemVMKeyFile();
private CreateEntityDownloadURLAnswer downloadCompressedFileToSSVM(CreateEntityDownloadURLCommand cmd, final String diagnosticsZipFileName) {
Copy link
Member Author

Choose a reason for hiding this comment

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

can you break this up in smaller methods?
i.e. checkApache(), mkdirCommand(), linkCommand() etc...

private String secUrl;

@Inject
NetworkModel _networkModel;
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove the underscore from the name

NetworkModel _networkModel;

@Inject
NetworkDao _networksDao = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove the underscore from the name

NetworkDao _networksDao = null;

@Inject
NicDao _nicDao = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove the underscore from the name

NetworkDao _networksDao = null;

@Inject
NicDao _nicDao = null;

@Inject
private HostDao _hostDao;
Copy link
Member Author

@DaanHoogland DaanHoogland Jul 26, 2018

Choose a reason for hiding this comment

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

please remove the underscore from the names, here and below

@@ -220,6 +239,11 @@
@Inject
private VirtualMachineManager vmManager;

@Inject
protected DataCenterDao _dcDao = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove the underscore from the name

protected DataCenterDao _dcDao = null;

@Inject
protected PrimaryDataStoreDao _storagePoolDao = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove the underscore from the name

@@ -341,6 +364,8 @@ protected void loadDiagnosticsDataConfiguration() {
}
final Long vmId = cmd.getId();
vmInstance = _vmDao.findByIdTypes(vmId, VirtualMachine.Type.ConsoleProxy, VirtualMachine.Type.DomainRouter, VirtualMachine.Type.SecondaryStorageVm);
//vmInstance.getDetails()
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove code in comment

@@ -0,0 +1,52 @@
/*
* // Licensed to the Apache Software Foundation (ASF) under one
Copy link
Member Author

Choose a reason for hiding this comment

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

this is a nested comment, please use either /* */ or //

@@ -0,0 +1,29 @@
/*
* // Licensed to the Apache Software Foundation (ASF) under one
Copy link
Member Author

Choose a reason for hiding this comment

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

please remove nested comment

NicDao _nicDao = null;

@Inject
private HostDao _hostDao;
Copy link
Member Author

@DaanHoogland DaanHoogland Jul 26, 2018

Choose a reason for hiding this comment

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

please remove the _ from this field and all those below

filesToRetrieve.add(files[i]);
}
}
// ManagementServerHostVO managementServerHostVO = managementServerHostDao.findById(systemVmId..getHostId());
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code

}
}
// ManagementServerHostVO managementServerHostVO = managementServerHostDao.findById(systemVmId..getHostId());
//String ipHostAddress = managementServerHostVO.getServiceIP();
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code

RetrieveFilesCommand retrieveFilesCommand = null;
Map<String, String> resultsMap;
final Long hostId = systemVmId.getHostId();
//Answer answer = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code

if (store == null) {
throw new CloudRuntimeException("cannot find an image store for zone " + zoneId);
}
//DataStoreTO destStoreTO = store.getTO();
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code

@@ -0,0 +1,228 @@
/*
* // Licensed to the Apache Software Foundation (ASF) under one
Copy link
Member Author

Choose a reason for hiding this comment

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

remove nested comments


}

Map<String, String> resultsMap = new HashMap<>();//retrieveDiagnosticsService.getDiagnosticsFiles(retrieveDiagnosticsCmd);
Copy link
Member Author

Choose a reason for hiding this comment

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

remove the commented code at the end of this line

except OSError as e:
print("Failed to create directory temp")

#manifest_file = open("temp/" + "manifest.txt", "w+")
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code

print filename + " not found"
#manifest_file.write(filename + " not found.")

#zip_archive.write(manifest_file)
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code

#manifest_file.write(filename + " not found.")

#zip_archive.write(manifest_file)
#manifest_file.close()
Copy link
Member Author

Choose a reason for hiding this comment

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

remove commented code

save_files = SaveIptablesToLogFile(arguments)
save_files.ensure_dir(file_path)
save_files.saveIpTableEntries(file_path)

Copy link
Member Author

Choose a reason for hiding this comment

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

too many extra lines

@DaanHoogland
Copy link
Member Author

@charles-phiri please rebase to resolve conflicts and make sure the build passes

@dhlaluku dhlaluku closed this Nov 29, 2018
shwstppr pushed a commit that referenced this pull request Aug 24, 2020
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
shwstppr pushed a commit that referenced this pull request Mar 8, 2024
* NSX integration - skeletal code

* Fix module not loading on startup

* add upgrade path and daos
\n add nsx controller command

* add support for adding and listing nsx provider to a zone

* add license

* add default VPC offering and update upgrade path

* add global setting to enable nsx plugin

* add delete nsx controller operation

* add nsxresource

* add NSX resource , api client, create tier1 gw

* update db

* update response and add license

* Add support to create and delete nsx tier-1 gateway

* add license

* cleanup and add skeletal code for network creation

* add create/delete segment and UI integration

* add license

* address code smells - part 1

* fix test / build failure

* NSX integration - skeletal code

* Fix module not loading on startup

* add upgrade path and daos
\n add nsx controller command

* add support for adding and listing nsx provider to a zone

* add license

* add default VPC offering and update upgrade path

* add global setting to enable nsx plugin

* add delete nsx controller operation

* add nsxresource

* add NSX resource , api client, create tier1 gw

* update db

* update response and add license

* Add support to create and delete nsx tier-1 gateway

* add license

* cleanup and add skeletal code for network creation

* add create/delete segment and UI integration

* add license

* address code smells - part 1

* fix test / build failure

* add ui changes + update nsx_provider table transport zones + use NSX broadcast domain for add nics to router

* ui: fix password field, and backend changes

* add route advertisement

* update offering

* update offering

* add sleep before deletion of vpc / tier g/w for ports to be removed

* move creation of segments to design phase

* change provider to VPC router for Dhcp & dns service in an nsx offering

* Add public nic for NSX

* reserve first IP (after g/w) of subnet for router nic - NSX

* revert reserving 1st IP in vpc segments

* [NSX] Create a DHCP relay and add it to a VPC tier segment (#107)

* Create DHCP relay command and execute request

* In progress integrate with networking

* Create DHCP relay config on the network VR allocation

* Revert domain router dao changes

* Create DHCP relay con VR nic plug to NSX network

* Link DHCP relay config to segment after creation

* [NSX] Cleanup DHCP Relay config on segment deletion (#108)

* Cleanup DHCP Relay config on segment deletion

* update segment & relay name generators and call delete dhcprelay after deletion of segment

* address comment

* [NSX] Fix DHCP relay config deletion was missing zone name (apache#8068)

* [NSX] Refactor API wrapper operations (apache#8059)

* [NSX] Refactor API wrapper operations

* Big refactor

* Address review comment

* change network cidr to cidr to prevent NPE

* add domain and zone names to the various networks - vpc & tier

---------

Co-authored-by: Pearl Dsilva <pearl1594@gmail.com>

* Nsx unit tests (apache#8090)

* Add tests

* add test for NsxGuestNetworkGuru

* add unit tests for NsxResource

* add unti tests for NsxElement

* cleanup

* [NSX] Refactor API wrapper operations

* update tests

* update tests - add nsxProviderServiceImpl test

* add unit test - NsxServiceImpl

* add license

* Big refactor

* Address review comment

* change network cidr to cidr to prevent NPE

* add domain and zone names to the various networks - vpc & tier

* fix tests

---------

Co-authored-by: nvazquez <nicovazquez90@gmail.com>

* modify NSX resource naming convention (apache#8095)

* modify NSX resource naming convention

* remove unused imports

* add a setup phase between desgin and implementation of a network for intermediary steps

* add method to all classes

* NSX: Refactor Network & VPC offering (apache#8110)

* [NSX] Refactor API wrapper operations

* Network offering changes for NSX

* fix services and provider combination

* address comments: rename param

* update nsx_mode parameter

---------

Co-authored-by: nvazquez <nicovazquez90@gmail.com>

* fix test

* [NSX] Allow NSX isolated networks (apache#8132)

* Add network offerings for NSX on isolated networks

* Fix offerings creation

* In progress NSX isolated network

* Fixes

* Fix NIC allocation to router

* NSX: Add Step for Adding Public traffic network for NSX During zone creation (apache#8126)

* NSX: Add Step for Adding Public traffic network for NSX

* address comments and cleanup

* address comment

* remove indent

* NSX: Create and Delete static NAT & Port forward  rules (apache#8131)

* NSX: Create and delete NSX Static Nat rules

* fix issues with static nat

* add static nat

* Support to add and delete Port forward rules

* add license

* fix adding multiple pf rules

* cleanup

* fix lint check

* fix smoke tests

* fix smoke tests

* Nsx add lb rule (apache#8161)

* NSX: Create and delete NSX Static Nat rules

* fix issues with static nat

* add static nat

* Support to add and delete Port forward rules

* add license

* fix adding multiple pf rules

* cleanup

* NSX: Add support to create and delete Load balancer rules

* fix deletion of lb rules

* add header file and update protocol detail

* build failure fix

* [NSX] Add SNAT support (apache#8100)

* In progress add source NAT

* Fix after merge

* Fix tests

* Fix NPE on isolated network deletion

* Reserve source NAT IP when its not passed for NSX VPC

* Create source NAT rule on VR NIC allocation

* Fix update VPC and remove VPC to update and remove SNAT rule

* Fix packaging

* Address review comment

* Fix build

* fix build - unused import

* Add defensive checks

* Add missing design to NSX public guru

---------

Co-authored-by: Pearl Dsilva <pearl1594@gmail.com>

* NSX: Fix VR public NIC allocation (apache#8166)

* NSX: fix LB member addition and deletion and add defensive checks (apache#8167)

* Fix public NIC NPE on broadcast URI

* NSX: Router Public nic to get IP from systemVM Ip range (apache#8172)

* NSX: Router Public nic to get IP from systemVM Ip range

* Fix VR IP address and setSourceNatIp command

* NSX: hide systemVM reserved IP range SourceNAT

* fix test

---------

Co-authored-by: nvazquez <nicovazquez90@gmail.com>

* fix test failure

* test failure fix

* [NSX] Fix update source NAT IP (apache#8176)

* [NSX] Fix update source NAT IP

* Fix startup

* Fix API result

* NSX - add LB route Advertizement (apache#8192)

* [NSX] Add ACL types support (apache#8224)

* NSX: Create segment group on segment creation

* Add unit tests

* Remove group for segment before removing segment

* Create Distributed Firewall rules

* Remove distributed firewall policy on segment deletion

* Fix policy rule ID and add more unit tests

* Fix DROP action rules and transform tests

* Add new ACL rules

* Fixes

* associate security policies with groups and not to DFW and add deletion of rules

* Fix name convention

---------

Co-authored-by: Pearl Dsilva <pearl1594@gmail.com>

* NSX: Fix creation of VPCs (apache#8320)

* Fix ACL rules creation (apache#8323)

* [NSX] Fix database views (apache#8325)

* NSX: Add CKS Support & Firewall rules for Isolated Networks (apache#8189)

* NSX: Add ALL LB IP to the list of route advertisements in tier1

* NSX: Support Source NAT on NSX Isolated networks

* NSX: Cks Support

* NSX: Create segment group on segment creation

* Add unit tests

* Remove group for segment before removing segment

* Create Distributed Firewall rules

* Remove distributed firewall policy on segment deletion

* Fix policy rule ID and add more unit tests

* Add support for routed NSX Isolated networks \n and non RFC 1918 compliant IPs

* Add support for routed NSX Isolated networks \n and non RFC 1918 compliant IPs

* Add Firewall rules

* build failure - fix unit test

* fix npes

* Add support to delete firewall rules

* update nsx cks offering

* add license

* update order of ports in PF & FW rules

* fix filter for getting transport zones

* CKS support changed - MTU updated, etc

* add LB for CKS on VPC

* address comments

* adapt upstream cks logic for vpc

* rever mtu hack

* update UI changes as per upstream fix

* change display test for CKS n/w offerings for isolated and VPC tiers

* add extra line for linter

* address comment

* revert list change

---------

Co-authored-by: nvazquez <nicovazquez90@gmail.com>

* fix ui build failure

* [NSX] Address SonarCloud Bugs (apache#8341)

* [NSX] Address SonarCloud Bugs

* Fix NSX API connection issues

* NSX: Add unit tests to increase coverage (apache#8355)

* NSX: Add unit tests

* cleanup unused imports

* add more unit tests

* add tests for publicnsxnetworkguru

* add license

* fix build failures

* address sonar comment

* fix security hotspots

* NSX: Add more unit tests (apache#8381)

* NSX : Unit tests

* remove unused imports

* remove unused import causing build failure

* fix build failures due to unused imports

* fix build failure

* fix test assertion

* remove unused imports

* remove unused import

* Nsx UI zone bug (apache#8398)

* NSX: Attempt to fix NSX Zone creation bug for public networks

* fix zone wizard public traffic issue

* add proper filtering of offerings based on VPC nsx mode

* clean up console logs

* NSX: Fix code smells and reported bugs (apache#8409)

* NSX: Fix code smells and reported bugs

* fox override issue

* remove unused imports

* fix test

* refactor code to reduce complexity

* add lisence

* cleanup

* fix build failure

* fix build failure

* address comments

* test - add config to ignore certain files from test coverage

* test exclusion of classes from test cov

* rever pom changes

* [NSX] Add more unit tests (apache#8431)

* [NSX] Add more unit tests

* More tests

* Fix build errors

* NSX: Prevent creation of L2 and Shared networks for NSX (apache#8463)

* NSX: Prevent creation of L2 and Shared networks for NSX

* add checks to backend to prevent creation of l2 and shared networks in nsx zones and filter only nsx offerings when creating isolated networks

* cleanup

* NSX: Fix code smells (apache#8436)

* NSX: Fix code smells

* Add changes to service creation logic

* CKS: Add action to during firewall rule creation (apache#8498)

* NSX,UI: Deduplicate network list when creating kubernetes clusters (apache#8513)

* NSX: Make LB service selectable in network offering (apache#8512)

* NSX: Make LB service selectable in network offering

* fix label

* address comments

* address comments

* NSX: Add appropriate error message when icmp type is set to -1 for NSX (apache#8504)

* NSX: Add appropriate error message when icmp type is set to -1 for NSX

* address comments

* update text

* fix test

* fix test - build failure

* fix test - build failure

* NSX: Cleanup NSX resources during k8s cluster cleanup (apache#8528)

* fix test failure

* NSX: Improve segment deletion process (apache#8538)

* NSX: Add passive monitor for NSX LB to test whether a server is available (apache#8533)

* NSX: Add passive monitor for NSX LB to test whether a server is available

* Add active monitors too

* fix build failure

* NSX: Add check for ICMP code / type for NSX zones (apache#8542)

* NSX: Fix Routed Mode for Isolated and VPC networks (apache#8534)

* NSX: Fix Routed Mode for Isolated and VPC networks

* NSX: Fix Routed mode - add checks for ports added for FW rules

* clean up code

* fix build failure

* NSX: Add retry logic with sleep to delete segments (apache#8554)

* NSX: Add retry logic with sleep to delete segments

* add logs

* NSX: Fix custom ACL check (#2)

* NSX: Fix custom ACL check

* NSX: Fix custom ACL check

* Nsx vpc routed mode (#5)

* NSX: Fix VPC routed mode

* NSX: VPC route mode

* remove unnecessary changes

* Nsx: Support internal LB (#4)

* NSX: Support internal LB service in NSX

* add lb removal logic

* Fix UI issue hiding internal LB tab

* Refactor method name

---------

Co-authored-by: nvazquez <nicovazquez90@gmail.com>

* NSX: Improve NSX resource cleanup process (#3)

* Fix unit test

* NSX: Add SourceNAT service to the default Routed offering for VPC (#13)

* Fix VPC restart with cleanup (#12)

* NSX: Fix ACL rule removal on replacement and fix rule order (#11)

* NSX: fix smoke test failure for ACLs (#9)

* Fix unit tests

* Fix NSX plugin pom XML

* NSX: Add support to re-order ACL rules (NSX FW rules) (#14)

* [WIP] NSX: Add support to re-order ACL rules (NSX FW rules)

* fix reordering of acl rules on all networks that it is associated to

* clean up and attempt test fix

* Fix tests

* Remove unused import

* tweak reorder logic

---------

Co-authored-by: nvazquez <nicovazquez90@gmail.com>

* Fix zone creation issue for internal load balancer

* Fix

* Fix unit test

* fix logger

* fix logger

* fix logger

* NSX: Fix VPC form to ignore source NAT IP when creating VPCs and fix label

* Move SQL changes to the newest schema file

* NSX: Last Fixes

* Fix build

---------

Co-authored-by: nvazquez <nicovazquez90@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants