Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
1 change: 1 addition & 0 deletions build-aux/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ FLAKE8 = @flake8_path@
BLACK = @black_path@
RUNUTF8 = @runutf8@
PYTHON = @PYTHON3@
PERL = @PERL@
GREP = @GREP@
SED = @SED@
AWK = @AWK@
Expand Down
1 change: 1 addition & 0 deletions build-aux/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if git and tests_enabled[0]
'black_path': black_path,
'runutf8': ' '.join(runutf8),
'PYTHON3': python3_prog.full_path(),
'PERL': perl_prog.full_path(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Undefined perl_prog variable
The line 'PERL': perl_prog.full_path(), references perl_prog which is not declared in this scope. This will cause a build error. Please add a find_program('perl', required: false) (or true if mandatory) assignment before using perl_prog.

Example fix:

 # ...
  awk_prog = find_program('awk')

+ perl_prog = find_program('perl', required: false)
  syntax_check_conf = configuration_data({
    'top_srcdir': meson.project_source_root(),
    'top_builddir': meson.project_build_root(),
    'flake8_path': flake8_path,
    'black_path': black_path,
    'runutf8': ' '.join(runutf8),
    'PYTHON3': python3_prog.full_path(),
    'PERL': perl_prog.full_path(),
    'GREP': grep_prog.full_path(),
    'SED': sed_prog.full_path(),
    'AWK': awk_prog.full_path(),
  })
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'PERL': perl_prog.full_path(),
awk_prog = find_program('awk')
perl_prog = find_program('perl', required: false)
syntax_check_conf = configuration_data({
'top_srcdir': meson.project_source_root(),
'top_builddir': meson.project_build_root(),
'flake8_path': flake8_path,
'black_path': black_path,
'runutf8': ' '.join(runutf8),
'PYTHON3': python3_prog.full_path(),
'PERL': perl_prog.full_path(),
'GREP': grep_prog.full_path(),
'SED': sed_prog.full_path(),
'AWK': awk_prog.full_path(),
})

'GREP': grep_prog.full_path(),
'SED': sed_prog.full_path(),
'AWK': awk_prog.full_path(),
Expand Down
1 change: 0 additions & 1 deletion docs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ docs_programs_groups = [
foreach item : docs_programs_groups
prog = find_program(item.get('prog'), dirs: libvirt_sbin_path)
varname = item.get('name').underscorify()
conf.set_quoted(varname.to_upper(), prog.full_path())
set_variable('@0@_prog'.format(varname), prog)
endforeach

Expand Down
92 changes: 13 additions & 79 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -837,39 +837,22 @@ required_programs = [
'xsltproc',
]

if host_machine.system() == 'freebsd'
required_programs += 'ifconfig'
endif

foreach name : required_programs
prog = find_program(name, dirs: libvirt_sbin_path)
varname = name.underscorify()
conf.set_quoted(varname.to_upper(), prog.full_path())
set_variable('@0@_prog'.format(varname), prog)
endforeach

# optional programs

optional_test_programs = [
optional_programs = [
'augparse',
'black',
'flake8',
'pdwtags',
'pytest',
]

optional_programs = [
'dmidecode',
'ip',
'iscsiadm',
'mdevctl',
'mm-ctl',
'modprobe',
'ovs-vsctl',
'rmmod',
'tc',
] + optional_test_programs

missing_optional_programs = []
foreach name : optional_programs
prog = find_program(name, required: false, dirs: libvirt_sbin_path)
Expand All @@ -878,12 +861,9 @@ foreach name : optional_programs
prog_path = prog.full_path()
else
prog_path = name
if name in optional_test_programs
missing_optional_programs += [ name ]
endif
missing_optional_programs += [ name ]
endif

conf.set_quoted(varname.to_upper(), prog_path)
set_variable('@0@_prog'.format(varname), prog)
endforeach

Expand Down Expand Up @@ -1495,16 +1475,7 @@ if not get_option('driver_libvirtd').disabled()
endif

if not get_option('driver_bhyve').disabled() and host_machine.system() == 'freebsd'
bhyve_prog = find_program('bhyve', required: get_option('driver_bhyve'))
bhyvectl_prog = find_program('bhyvectl', required: get_option('driver_bhyve'))
bhyveload_prog = find_program('bhyveload', required: get_option('driver_bhyve'))

if bhyve_prog.found() and bhyvectl_prog.found() and bhyveload_prog.found()
conf.set('WITH_BHYVE', 1)
conf.set_quoted('BHYVE', bhyve_prog.full_path())
conf.set_quoted('BHYVECTL', bhyvectl_prog.full_path())
conf.set_quoted('BHYVELOAD', bhyveload_prog.full_path())
endif
conf.set('WITH_BHYVE', 1)
elif get_option('driver_bhyve').enabled()
error('The bhyve driver cannot be enabled')
endif
Expand Down Expand Up @@ -1827,23 +1798,10 @@ if conf.has('WITH_LIBVIRTD')
endif
endif

if fs_enable
mount_prog = find_program('mount', required: get_option('storage_fs'), dirs: libvirt_sbin_path)
umount_prog = find_program('umount', required: get_option('storage_fs'), dirs: libvirt_sbin_path)
mkfs_prog = find_program('mkfs', required: get_option('storage_fs'), dirs: libvirt_sbin_path)

if not mount_prog.found() or not umount_prog.found() or not mkfs_prog.found()
fs_enable = false
endif
endif

if fs_enable
use_storage = true

conf.set('WITH_STORAGE_FS', 1)
conf.set_quoted('MOUNT', mount_prog.full_path())
conf.set_quoted('UMOUNT', umount_prog.full_path())
conf.set_quoted('MKFS', mkfs_prog.full_path())
endif
endif

Expand All @@ -1854,11 +1812,11 @@ if conf.has('WITH_LIBVIRTD')
error('Need glusterfs (libgfapi) for gluster storage driver')
endif

if not get_option('storage_iscsi').disabled() and iscsiadm_prog.found()
if not get_option('storage_iscsi').disabled() and host_machine.system() == 'linux'
use_storage = true
conf.set('WITH_STORAGE_ISCSI', 1)
elif get_option('storage_iscsi').enabled()
error('We need iscsiadm for iSCSI storage driver')
error('Linux host needed for iSCSI storage driver using iscsiadm')
endif

if not get_option('storage_iscsi_direct').disabled() and libiscsi_dep.found()
Expand All @@ -1868,32 +1826,12 @@ if conf.has('WITH_LIBVIRTD')
error('Need libiscsi for iscsi-direct storage driver')
endif

if not get_option('storage_lvm').disabled()
if not get_option('storage_lvm').disabled() and host_machine.system() == 'linux'
lvm_enable = true
lvm_progs = [
'pvcreate', 'vgcreate', 'lvcreate',
'pvremove', 'vgremove', 'lvremove',
'lvchange', 'vgchange', 'vgscan',
'pvs', 'vgs', 'lvs',
]
foreach name : lvm_progs
set_variable(
'@0@_prog'.format(name),
find_program(name, required: get_option('storage_lvm'), dirs: libvirt_sbin_path)
)
if not get_variable('@0@_prog'.format(name)).found()
lvm_enable = false
endif
endforeach

if lvm_enable
use_storage = true
conf.set('WITH_STORAGE_LVM', 1)

foreach name : lvm_progs
conf.set_quoted(name.to_upper(), get_variable('@0@_prog'.format(name)).full_path())
endforeach
endif
use_storage = true
conf.set('WITH_STORAGE_LVM', 1)
elif get_option('storage_lvm').enabled()
error('Linux host needed for LVM storage driver')
endif

if not get_option('storage_mpath').disabled() and host_machine.system() == 'linux' and devmapper_dep.found()
Expand Down Expand Up @@ -2041,14 +1979,10 @@ if not get_option('nss').disabled()
endif
endif

if not get_option('numad').disabled() and numactl_dep.found()
numad_prog = find_program('numad', required: get_option('numad'), dirs: libvirt_sbin_path)
if numad_prog.found()
conf.set('WITH_NUMAD', 1)
conf.set_quoted('NUMAD', numad_prog.full_path())
endif
if not get_option('numad').disabled() and numactl_dep.found() and host_machine.system() == 'linux'
conf.set('WITH_NUMAD', 1)
elif get_option('numad').enabled()
error('You must have numactl enabled for numad support.')
error('You must have a Linux host with numactl enabled for numad support.')
endif

# nwfilter should only be compiled for linux, and only if the
Expand Down
6 changes: 3 additions & 3 deletions src/bhyve/bhyve_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ virBhyveProcessBuildBhyveCmd(struct _bhyveConn *driver, virDomainDef *def,
* -S 31,uart,stdio \
* vm0
*/
g_autoptr(virCommand) cmd = virCommandNew(BHYVE);
g_autoptr(virCommand) cmd = virCommandNew("bhyve");
size_t i;
unsigned nusbcontrollers = 0;
unsigned nisacontrollers = 0;
Expand Down Expand Up @@ -884,7 +884,7 @@ virCommand *
virBhyveProcessBuildDestroyCmd(struct _bhyveConn *driver G_GNUC_UNUSED,
virDomainDef *def)
{
virCommand *cmd = virCommandNew(BHYVECTL);
virCommand *cmd = virCommandNew("bhyvectl");

virCommandAddArg(cmd, "--destroy");
virCommandAddArgPair(cmd, "--vm", def->name);
Expand All @@ -907,7 +907,7 @@ virBhyveProcessBuildBhyveloadCmd(virDomainDef *def, virDomainDiskDef *disk)
{
virCommand *cmd;

cmd = virCommandNew(BHYVELOAD);
cmd = virCommandNew("bhyveload");

if (def->os.bootloaderArgs == NULL) {
VIR_DEBUG("bhyveload with default arguments");
Expand Down
4 changes: 2 additions & 2 deletions src/locking/lock_driver_lockd.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ static int virLockManagerLockDaemonNew(virLockManager *lock,
}


#ifdef LVS
#ifdef __linux__
static int
virLockManagerGetLVMKey(const char *path,
char **key)
Expand All @@ -446,7 +446,7 @@ virLockManagerGetLVMKey(const char *path,
int ret = -1;
g_autoptr(virCommand) cmd = NULL;

cmd = virCommandNewArgList(LVS, "--noheadings",
cmd = virCommandNewArgList("lvs", "--noheadings",
"--unbuffered", "--nosuffix",
"--options", "uuid", path,
NULL
Expand Down
14 changes: 7 additions & 7 deletions src/node_device/node_device_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -744,14 +744,14 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def,
case MDEVCTL_CMD_CREATE:
/* now is the time to make sure "create" is replaced with "start" on
* mdevctl cmdline */
cmd = virCommandNewArgList(MDEVCTL, "start", NULL);
cmd = virCommandNewArgList("mdevctl", "start", NULL);
break;
case MDEVCTL_CMD_STOP:
case MDEVCTL_CMD_START:
case MDEVCTL_CMD_DEFINE:
case MDEVCTL_CMD_UNDEFINE:
case MDEVCTL_CMD_MODIFY:
cmd = virCommandNewArgList(MDEVCTL, subcommand, NULL);
cmd = virCommandNewArgList("mdevctl", subcommand, NULL);
break;
case MDEVCTL_CMD_LAST:
default:
Expand Down Expand Up @@ -901,7 +901,7 @@ nodeDeviceGetMdevctlModifySupportCheck(void)
g_autoptr(virCommand) cmd = NULL;
const char *subcommand = virMdevctlCommandTypeToString(MDEVCTL_CMD_MODIFY);

cmd = virCommandNewArgList(MDEVCTL,
cmd = virCommandNewArgList("mdevctl",
subcommand,
"--defined",
"--live",
Expand Down Expand Up @@ -1130,7 +1130,7 @@ nodeDeviceGetMdevctlSetAutostartCommand(virNodeDeviceDef *def,
bool autostart,
char **errmsg)
{
virCommand *cmd = virCommandNewArgList(MDEVCTL,
virCommand *cmd = virCommandNewArgList("mdevctl",
"modify",
"--uuid",
def->caps->data.mdev.uuid,
Expand Down Expand Up @@ -1176,7 +1176,7 @@ nodeDeviceGetMdevctlListCommand(bool defined,
char **output,
char **errmsg)
{
virCommand *cmd = virCommandNewArgList(MDEVCTL,
virCommand *cmd = virCommandNewArgList("mdevctl",
"list",
"--dumpjson",
NULL);
Expand Down Expand Up @@ -1894,8 +1894,8 @@ nodeDeviceUpdateMediatedDevices(virNodeDeviceDriverState *node_driver)
virMdevctlForEachData data = { 0, };
size_t i;

if (!(mdevctl = virFindFileInPath(MDEVCTL))) {
VIR_DEBUG(MDEVCTL " not found. Skipping update of mediated devices.");
if (!(mdevctl = virFindFileInPath("mdevctl"))) {
VIR_DEBUG("'mdevctl' not found. Skipping update of mediated devices.");
return 0;
}

Expand Down
6 changes: 3 additions & 3 deletions src/openvz/openvz_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@


/* OpenVZ commands - Replace with wrapper scripts later? */
#define VZLIST "/usr/sbin/vzlist"
#define VZCTL "/usr/sbin/vzctl"
#define VZMIGRATE "/usr/sbin/vzmigrate"
#define VZLIST "vzlist"
#define VZCTL "vzctl"
#define VZMIGRATE "vzmigrate"
#define VZ_CONF_FILE "/etc/vz/vz.conf"

#define VZCTL_BRIDGE_MIN_VERSION ((3 * 1000 * 1000) + (0 * 1000) + 22 + 1)
Expand Down
17 changes: 3 additions & 14 deletions src/storage/storage_backend_fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ virStorageBackendFileSystemMount(virStoragePoolObj *pool)
if (!(src = virStorageBackendFileSystemGetPoolSource(pool)))
return -1;

cmd = virStorageBackendFileSystemMountCmd(MOUNT, def, src);
cmd = virStorageBackendFileSystemMountCmd("mount", def, src);

/* Mounting a shared FS might take a long time. Don't hold
* the pool locked meanwhile. */
Expand Down Expand Up @@ -362,7 +362,7 @@ virStorageBackendFileSystemStop(virStoragePoolObj *pool)
if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 1)
return rc;

cmd = virCommandNewArgList(UMOUNT, def->target.path, NULL);
cmd = virCommandNewArgList("umount", def->target.path, NULL);
return virCommandRun(cmd, NULL);
}
#endif /* WITH_STORAGE_FS */
Expand Down Expand Up @@ -402,18 +402,7 @@ virStorageBackendExecuteMKFS(const char *device,
g_autoptr(virCommand) cmd = NULL;
g_autofree char *mkfs = NULL;

#if WITH_STORAGE_FS
mkfs = virFindFileInPath(MKFS);
#endif /* WITH_STORAGE_FS */

if (!mkfs) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("mkfs is not available on this platform: Failed to make filesystem of type '%1$s' on device '%2$s'"),
format, device);
return -1;
}

cmd = virCommandNewArgList(mkfs, "-t", format, NULL);
cmd = virCommandNewArgList("mkfs", "-t", format, NULL);

/* use the force, otherwise mkfs.xfs won't overwrite existing fs.
* Similarly mkfs.ext2, mkfs.ext3, and mkfs.ext4 require supplying -F
Expand Down
Loading