Copilot commented on code in PR #11566:
URL: https://github.com/apache/cloudstack/pull/11566#discussion_r2318924059
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
##########
@@ -314,15 +314,15 @@ public class LibvirtComputingResource extends
ServerResourceBase implements Serv
public static final String TUNGSTEN_PATH = "scripts/vm/network/tungsten";
- public static final String INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD =
"virt-v2v --version";
+ public static final String INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD =
"\"virt-v2v --version\"";
// virt-v2v --version => sample output: virt-v2v
1.42.0rhel=8,release=22.module+el8.10.0+1590+a67ab969
- public static final String OVF_EXPORT_SUPPORTED_CHECK_CMD = "ovftool
--version";
+ public static final String OVF_EXPORT_SUPPORTED_CHECK_CMD = "\"ovftool
--version\"";
// ovftool --version => sample output: VMware ovftool 4.6.0
(build-21452615)
- public static final String OVF_EXPORT_TOOl_GET_VERSION_CMD = "ovftool
--version | awk '{print $3}'";
+ public static final String OVF_EXPORT_TOOl_GET_VERSION_CMD = "\"ovftool
--version | awk '{print $3}'\"";
- public static final String WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD =
"rpm -qa | grep -i virtio-win";
- public static final String
UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD = "dpkg -l virtio-win";
- public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "dpkg -l nbdkit";
+ public static final String WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD =
"\"rpm -qa | grep -i virtio-win\"";
+ public static final String
UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD = "\"dpkg -l virtio-win\"";
+ public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "\"dpkg -l
nbdkit\"";
Review Comment:
Adding quotes around entire commands may cause issues depending on how these
constants are used. If these strings are passed to ProcessBuilder or similar
APIs that handle arguments separately, the quotes will be interpreted literally
rather than as shell quoting. Consider reviewing how these constants are
consumed to ensure the quoting approach is appropriate for the execution method.
```suggestion
public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "dpkg -l
nbdkit";
```
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
##########
@@ -314,15 +314,15 @@ public class LibvirtComputingResource extends
ServerResourceBase implements Serv
public static final String TUNGSTEN_PATH = "scripts/vm/network/tungsten";
- public static final String INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD =
"virt-v2v --version";
+ public static final String INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD =
"\"virt-v2v --version\"";
// virt-v2v --version => sample output: virt-v2v
1.42.0rhel=8,release=22.module+el8.10.0+1590+a67ab969
- public static final String OVF_EXPORT_SUPPORTED_CHECK_CMD = "ovftool
--version";
+ public static final String OVF_EXPORT_SUPPORTED_CHECK_CMD = "\"ovftool
--version\"";
// ovftool --version => sample output: VMware ovftool 4.6.0
(build-21452615)
- public static final String OVF_EXPORT_TOOl_GET_VERSION_CMD = "ovftool
--version | awk '{print $3}'";
+ public static final String OVF_EXPORT_TOOl_GET_VERSION_CMD = "\"ovftool
--version | awk '{print $3}'\"";
- public static final String WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD =
"rpm -qa | grep -i virtio-win";
- public static final String
UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD = "dpkg -l virtio-win";
- public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "dpkg -l nbdkit";
+ public static final String WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD =
"\"rpm -qa | grep -i virtio-win\"";
+ public static final String
UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD = "\"dpkg -l virtio-win\"";
+ public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "\"dpkg -l
nbdkit\"";
Review Comment:
Adding quotes around entire commands may cause issues depending on how these
constants are used. If these strings are passed to ProcessBuilder or similar
APIs that handle arguments separately, the quotes will be interpreted literally
rather than as shell quoting. Consider reviewing how these constants are
consumed to ensure the quoting approach is appropriate for the execution method.
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
##########
@@ -314,15 +314,15 @@ public class LibvirtComputingResource extends
ServerResourceBase implements Serv
public static final String TUNGSTEN_PATH = "scripts/vm/network/tungsten";
- public static final String INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD =
"virt-v2v --version";
+ public static final String INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD =
"\"virt-v2v --version\"";
// virt-v2v --version => sample output: virt-v2v
1.42.0rhel=8,release=22.module+el8.10.0+1590+a67ab969
- public static final String OVF_EXPORT_SUPPORTED_CHECK_CMD = "ovftool
--version";
+ public static final String OVF_EXPORT_SUPPORTED_CHECK_CMD = "\"ovftool
--version\"";
// ovftool --version => sample output: VMware ovftool 4.6.0
(build-21452615)
- public static final String OVF_EXPORT_TOOl_GET_VERSION_CMD = "ovftool
--version | awk '{print $3}'";
+ public static final String OVF_EXPORT_TOOl_GET_VERSION_CMD = "\"ovftool
--version | awk '{print $3}'\"";
- public static final String WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD =
"rpm -qa | grep -i virtio-win";
- public static final String
UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD = "dpkg -l virtio-win";
- public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "dpkg -l nbdkit";
+ public static final String WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD =
"\"rpm -qa | grep -i virtio-win\"";
+ public static final String
UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD = "\"dpkg -l virtio-win\"";
+ public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "\"dpkg -l
nbdkit\"";
Review Comment:
Adding quotes around entire commands may cause issues depending on how these
constants are used. If these strings are passed to ProcessBuilder or similar
APIs that handle arguments separately, the quotes will be interpreted literally
rather than as shell quoting. Consider reviewing how these constants are
consumed to ensure the quoting approach is appropriate for the execution method.
##########
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java:
##########
@@ -314,15 +314,15 @@ public class LibvirtComputingResource extends
ServerResourceBase implements Serv
public static final String TUNGSTEN_PATH = "scripts/vm/network/tungsten";
- public static final String INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD =
"virt-v2v --version";
+ public static final String INSTANCE_CONVERSION_SUPPORTED_CHECK_CMD =
"\"virt-v2v --version\"";
// virt-v2v --version => sample output: virt-v2v
1.42.0rhel=8,release=22.module+el8.10.0+1590+a67ab969
- public static final String OVF_EXPORT_SUPPORTED_CHECK_CMD = "ovftool
--version";
+ public static final String OVF_EXPORT_SUPPORTED_CHECK_CMD = "\"ovftool
--version\"";
// ovftool --version => sample output: VMware ovftool 4.6.0
(build-21452615)
- public static final String OVF_EXPORT_TOOl_GET_VERSION_CMD = "ovftool
--version | awk '{print $3}'";
+ public static final String OVF_EXPORT_TOOl_GET_VERSION_CMD = "\"ovftool
--version | awk '{print $3}'\"";
- public static final String WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD =
"rpm -qa | grep -i virtio-win";
- public static final String
UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD = "dpkg -l virtio-win";
- public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "dpkg -l nbdkit";
+ public static final String WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD =
"\"rpm -qa | grep -i virtio-win\"";
+ public static final String
UBUNTU_WINDOWS_GUEST_CONVERSION_SUPPORTED_CHECK_CMD = "\"dpkg -l virtio-win\"";
+ public static final String UBUNTU_NBDKIT_PKG_CHECK_CMD = "\"dpkg -l
nbdkit\"";
Review Comment:
Adding quotes around entire commands may cause issues depending on how these
constants are used. If these strings are passed to ProcessBuilder or similar
APIs that handle arguments separately, the quotes will be interpreted literally
rather than as shell quoting. Consider reviewing how these constants are
consumed to ensure the quoting approach is appropriate for the execution method.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]