Skip to content

Commit 4d9c382

Browse files
committed
Merge remote-tracking branch 'apache/4.20' into 4.20-fix-vnf-deploy-as-is
2 parents 469df6b + cd5bb09 commit 4d9c382

File tree

5 files changed

+29
-4
lines changed

5 files changed

+29
-4
lines changed

ui/public/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2527,7 +2527,7 @@
25272527
"label.vnf.app.action.reinstall": "Reinstall VNF Appliance",
25282528
"label.vnf.cidr.list": "CIDR from which access to the VNF appliance's Management interface should be allowed from",
25292529
"label.vnf.cidr.list.tooltip": "the CIDR list to forward traffic from to the VNF management interface. Multiple entries must be separated by a single comma character (,). The default value is 0.0.0.0/0.",
2530-
"label.vnf.configure.management": "Configure Firewall and Port Forwarding rules for VNF's management interfaces",
2530+
"label.vnf.configure.management": "Configure network rules for VNF's management interfaces",
25312531
"label.vnf.configure.management.tooltip": "False by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. True otherwise. Learn what rules are configured at http://docs.cloudstack.apache.org/en/latest/adminguide/networking/vnf_templates_appliances.html#deploying-vnf-appliances",
25322532
"label.vnf.detail.add": "Add VNF detail",
25332533
"label.vnf.detail.remove": "Remove VNF detail",

ui/src/config/section/network.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,10 @@ export default {
356356
permission: ['listVnfAppliances'],
357357
resourceType: 'UserVm',
358358
params: () => {
359-
return { details: 'servoff,tmpl,nics', isvnf: true }
359+
return {
360+
details: 'group,nics,secgrp,tmpl,servoff,diskoff,iso,volume,affgrp,backoff,vnfnics',
361+
isvnf: true
362+
}
360363
},
361364
columns: () => {
362365
const fields = ['name', 'state', 'ipaddress']

ui/src/views/compute/DeployVnfAppliance.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ export default {
13121312
}
13131313
if (this.vnfNicNetworks && this.vnfNicNetworks[deviceId] &&
13141314
((this.vnfNicNetworks[deviceId].type === 'Isolated' && this.vnfNicNetworks[deviceId].vpcid === undefined) ||
1315-
(this.vnfNicNetworks[deviceId].type === 'Shared' && this.zone.securitygroupsenabled))) {
1315+
(this.vnfNicNetworks[deviceId].type === 'Shared' && this.vnfNicNetworks[deviceId].service.filter(svc => svc.name === 'SecurityGroupProvider')))) {
13161316
return true
13171317
}
13181318
}

ui/src/views/network/VnfAppliancesTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export default {
120120
methods: {
121121
fetchData () {
122122
var params = {
123-
details: 'servoff,tmpl,nics',
123+
details: 'group,nics,secgrp,tmpl,servoff,diskoff,iso,volume,affgrp,backoff,vnfnics',
124124
isVnf: true,
125125
listAll: true
126126
}

utils/src/main/java/com/cloud/utils/script/Script.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@
4040
import java.util.concurrent.ScheduledFuture;
4141
import java.util.concurrent.TimeUnit;
4242
import java.util.concurrent.TimeoutException;
43+
import java.util.concurrent.atomic.AtomicReference;
4344
import java.util.stream.Collectors;
4445

4546
import org.apache.cloudstack.utils.security.KeyStoreUtils;
47+
import org.apache.commons.collections.CollectionUtils;
4648
import org.apache.commons.io.IOUtils;
4749
import org.apache.logging.log4j.LogManager;
4850
import org.apache.logging.log4j.Logger;
@@ -708,13 +710,31 @@ public static int executeCommandForExitValue(String... command) {
708710
return executeCommandForExitValue(0, command);
709711
}
710712

713+
private static void cleanupProcesses(AtomicReference<List<Process>> processesRef) {
714+
List<Process> processes = processesRef.get();
715+
if (CollectionUtils.isNotEmpty(processes)) {
716+
for (Process process : processes) {
717+
if (process == null) {
718+
continue;
719+
}
720+
LOGGER.trace(String.format("Cleaning up process [%s] from piped commands.", process.pid()));
721+
IOUtils.closeQuietly(process.getErrorStream());
722+
IOUtils.closeQuietly(process.getOutputStream());
723+
IOUtils.closeQuietly(process.getInputStream());
724+
process.destroyForcibly();
725+
}
726+
}
727+
}
728+
711729
public static Pair<Integer, String> executePipedCommands(List<String[]> commands, long timeout) {
712730
if (timeout <= 0) {
713731
timeout = DEFAULT_TIMEOUT;
714732
}
733+
final AtomicReference<List<Process>> processesRef = new AtomicReference<>();
715734
Callable<Pair<Integer, String>> commandRunner = () -> {
716735
List<ProcessBuilder> builders = commands.stream().map(ProcessBuilder::new).collect(Collectors.toList());
717736
List<Process> processes = ProcessBuilder.startPipeline(builders);
737+
processesRef.set(processes);
718738
Process last = processes.get(processes.size()-1);
719739
try (BufferedReader reader = new BufferedReader(new InputStreamReader(last.getInputStream()))) {
720740
String line;
@@ -741,6 +761,8 @@ public static Pair<Integer, String> executePipedCommands(List<String[]> commands
741761
result.second(ERR_TIMEOUT);
742762
} catch (InterruptedException | ExecutionException e) {
743763
LOGGER.error("Error executing piped commands", e);
764+
} finally {
765+
cleanupProcesses(processesRef);
744766
}
745767
return result;
746768
}

0 commit comments

Comments
 (0)