Conversation
server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java
Outdated
Show resolved
Hide resolved
| if (s == null) { | ||
| throw new InvalidParameterValueException("A key pair with name '" + cmd.getName() + "' does not exist for account " + owner.getAccountName() | ||
| + " in specified domain id"); | ||
| if (cmd.getName() == null && cmd.getNames() == null) { |
There was a problem hiding this comment.
org.apache.commons.lang3.ObjectUtils has a method to verify nulls anyNull(...).
| keypairnames = keypairnames + keypairname; | ||
| } | ||
| } | ||
| if (s_list == null && s == null) { |
There was a problem hiding this comment.
org.apache.commons.lang3.ObjectUtils has a method to verify nulls anyNull(...).
api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
Outdated
Show resolved
Hide resolved
|
|
||
| @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING, required = true, description = "name of the ssh key pair used to login to the virtual machine") | ||
| private String name; | ||
| @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.LIST, collectionType = CommandType.STRING ,description = "name of the ssh key pair to bt used to login to the virtual machine") |
| public String getSSHKeyPairName() { | ||
| return sshKeyPairName; | ||
| public List<String> getSSHKeyPairNames() { | ||
| if(sshKeyPairName != null) sshKeyPairNames.add(sshKeyPairName); |
There was a problem hiding this comment.
Can this cause a null pointer exception if keypairs is not passed ?
| if (!Strings.isNullOrEmpty(sshKeyPair)) { | ||
| SSHKeyPairVO sshkp = sshKeyPairDao.findByName(owner.getAccountId(), owner.getDomainId(), sshKeyPair); | ||
| List<String> sshKeyPairs = null; | ||
| sshKeyPairs.add(kubernetesCluster.getKeyPair()); |
There was a problem hiding this comment.
Won't this cause a null pointer exception ?
| List<SSHKeyPairVO> s_list = null; | ||
| if (cmd.getNames() != null) { | ||
| s_list = _sshKeyPairDao.findByNames(owner.getAccountId(), owner.getDomainId(), cmd.getNames()); | ||
| for (String keypairname : cmd.getNames()) { | ||
| if (keypairnames != "") { | ||
| keypairnames = keypairnames + ", "; | ||
| } | ||
| keypairnames = keypairnames + keypairname; | ||
| } |
There was a problem hiding this comment.
Is there a better way to join a list of names ?
|
|
||
| UserVmVO vm = _vmDao.findById(vmId); | ||
| _vmDao.loadDetails(vm); | ||
| _vmDao.saveDetails(vm); |
There was a problem hiding this comment.
Why is it being loaded and then immediately saved ?
| s_logger.debug("Vm " + vmInstance + " is stopped, not rebooting it as a part of SSH Key reset"); | ||
| return true; | ||
| } | ||
| s_logger.info("bb " + userVm.getDetail(VmDetailConstants.KEY_PAIR_NAMES)); |
| if (sshKeyPairs != null) { | ||
| for (String sshkeypair : sshKeyPairs) { | ||
| if (keypairnames != "") { | ||
| keypairnames = keypairnames + ", "; | ||
| } | ||
| keypairnames = keypairnames + sshkeypair; | ||
| } | ||
| List<SSHKeyPairVO> pairs = _sshKeyPairDao.findByNames(owner.getAccountId(), owner.getDomainId(), sshKeyPairs); | ||
| for (SSHKeyPairVO pair : pairs) { | ||
| if (pair == null) { | ||
| throw new InvalidParameterValueException("A key pair with name '" + pair.getName() + "' was not found."); | ||
| } | ||
| else { | ||
| s_logger.info("publickey is " + pair.getPublicKey()); | ||
| sshPublicKey = sshPublicKey + pair.getPublicKey(); | ||
| sshPublicKey = sshPublicKey + "\n"; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Can this duplicate code be extracted out ?
ui/src/views/compute/ResetSSH.vue
Outdated
| }).finally(() => { | ||
| this.loading = false | ||
| }) | ||
| window.location.reload() |
There was a problem hiding this comment.
Try to refresh the data without reloading the entire page
|
@blueorangutan package |
|
@davidjumani a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✖️ el7 ✖️ el8 ✖️ debian. SL-JID 823 |
|
@bicrxm Please check the build failure |
|
|
Can you show me the error message? |
You can build / test it locally by running |
|
@blueorangutan package |
|
@davidjumani a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 837 |
|
@blueorangutan test |
|
@davidjumani a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian Build Failed (tid-1589) |
|
@blueorangutan test |
|
@davidjumani a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
@blueorangutan test keepEnv |
|
@davidjumani a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-1652)
|
|
@blueorangutan test keepEnv |
| } | ||
|
|
||
| if (sshPublicKey != null) { | ||
| if (sshPublicKey != "") { |
There was a problem hiding this comment.
isEmpty() or isBlank() kind of condition, maybe?
|
@blueorangutan test |
|
@blueorangutan test keepEnv |
|
@blueorangutan package |
|
@davidjumani a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian. SL-JID 914 |
|
@blueorangutan test keepEnv |
|
@davidjumani a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests |
|
Trillian test result (tid-1704)
|
api/src/main/java/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java
Outdated
Show resolved
Hide resolved
|
@blueorangutan package |
|
@davidjumani a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress. |
|
Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 976 |
api/src/main/java/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java
Outdated
Show resolved
Hide resolved
|
@bicrxm can you fix the conflicts? It is marked for 4.17, now. Is this otherwise ready for review/merge? |
|
Hi @bicrxm can you please fix the conflicts? Is this PR ready for review and testing? |
|
Will be tracked as part of #5965 |
This PR is a part of GSoC 2021 Idea: Support Multiple SSH Keys for VMs.