Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcmu_config: allow user to define custom config path #640

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ctin
Copy link

@ctin ctin commented Sep 30, 2020

Hey!
I am using tcmu-runner in my project and I noticed that default config path is not editable.

In C we can use defines mechanism to specify custom config path and I implemented it.

I will add definition in my CMakeLists.txt file to modify config path.

Thank you!

@lxbsz
Copy link
Collaborator

lxbsz commented Oct 1, 2020

Please do this in the CMakeList.txt, then we can speicify the custom path when building.
for example cmake -DTCMU_CONFIG_DIR=/mydir

@lxbsz
Copy link
Collaborator

lxbsz commented Oct 1, 2020

And also please add the signed-off-by XXX in the commit comment when you push new commits later, thanks.

@ctin ctin force-pushed the fix_tcmu_config branch 2 times, most recently from cdb7a78 to 60a48c8 Compare October 2, 2020 22:19
now user can define it own path to the tcmu.conf name and location
default name and location moved from libtcmu_config.c to CMakeLists.txt
Signed-off-by: Konstantin Liashkevich <[email protected]>
@ctin
Copy link
Author

ctin commented Oct 2, 2020

Please do this in the CMakeList.txt, then we can speicify the custom path when building.
for example cmake -DTCMU_CONFIG_DIR=/mydir

done!
Definitions moved to the CMakeLists.txt.
Also they were renamed (_DEFAULT word was removed).

Now you can run cmake -DTCMU_CONFIG_FILE="ctin.conf and expect config file location at '/etc/tcmu/ctin.conf

p.s. signed-off-by XXX added

@lxbsz
Copy link
Collaborator

lxbsz commented Oct 9, 2020

Sorry for late. Just came back from holidays.

This still doesn't work:

# cmake -DSUPPORT_SYSTEMD=ON -DCMAKE_INSTALL_PREFIX=/usr -Dwith-glfs=false -DTCMU_CONFIG_DIR=/etc/ .
# make && make install
# systemctl restart tcmu-runner
# systemctl status tcmu-runner
● tcmu-runner.service - LIO Userspace-passthrough daemon
   Loaded: loaded (/usr/lib/systemd/system/tcmu-runner.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2020-10-09 00:11:17 EDT; 3s ago
     Docs: man:tcmu-runner(8)
  Process: 4803 ExecStart=/usr/bin/tcmu-runner (code=exited, status=1/FAILURE)
 Main PID: 4803 (code=exited, status=1/FAILURE)

Oct 09 00:11:12 host systemd[1]: Stopped LIO Userspace-passthrough daemon.
Oct 09 00:11:12 host systemd[1]: Starting LIO Userspace-passthrough daemon...
Oct 09 00:11:17 host tcmu-runner[4803]: Failed to open file '/etc//tcmu.conf', No such file or directory
Oct 09 00:11:17 host tcmu-runner[4803]: Loading TCMU config failed!
Oct 09 00:11:17 host systemd[1]: tcmu-runner.service: Main process exited, code=exited, status=1/FAILURE
Oct 09 00:11:17 host systemd[1]: tcmu-runner.service: Failed with result 'exit-code'.
Oct 09 00:11:17 host systemd[1]: Failed to start LIO Userspace-passthrough daemon.

@ctin
Copy link
Author

ctin commented Oct 9, 2020

@lxbsz thank you for checking. Lets suggest better solution.
In my system:

# cmake -Bbuild -Dwith-glfs=OFF -Dwith-rbd=OFF -Dwith-tcmalloc=OFF -DTCMU_CONFIG_DIR=/etc/
# make -C build -j8      
# ./build/tcmu-runner                                                                     
Failed to open file '/etc//tcmu.conf', No such file or directory

but after I am copying tcmu.conf to target directory it works:

# sudo cp ./tcmu.conf /etc/tcmu.conf
# sudo ./build/tcmu-runner 
log file path now is '/var/log/tcmu-runner.log'

Is there a chance that /etc/tcmu.conf is missing in your system?

@lxbsz
Copy link
Collaborator

lxbsz commented Oct 9, 2020

@lxbsz thank you for checking. Lets suggest better solution.
In my system:

# cmake -Bbuild -Dwith-glfs=OFF -Dwith-rbd=OFF -Dwith-tcmalloc=OFF -DTCMU_CONFIG_DIR=/etc/
# make -C build -j8      
# ./build/tcmu-runner                                                                     
Failed to open file '/etc//tcmu.conf', No such file or directory

but after I am copying tcmu.conf to target directory it works:

# sudo cp ./tcmu.conf /etc/tcmu.conf
# sudo ./build/tcmu-runner 
log file path now is '/var/log/tcmu-runner.log'

Is there a chance that /etc/tcmu.conf is missing in your system?

You should also fix the tcmu.conf_install.cmake, this makes it install the tcmu.conf to /etc/tcmu/.

@lxbsz
Copy link
Collaborator

lxbsz commented Oct 9, 2020

@lxbsz thank you for checking. Lets suggest better solution.
In my system:

# cmake -Bbuild -Dwith-glfs=OFF -Dwith-rbd=OFF -Dwith-tcmalloc=OFF -DTCMU_CONFIG_DIR=/etc/
# make -C build -j8      
# ./build/tcmu-runner                                                                     
Failed to open file '/etc//tcmu.conf', No such file or directory

but after I am copying tcmu.conf to target directory it works:

# sudo cp ./tcmu.conf /etc/tcmu.conf
# sudo ./build/tcmu-runner 
log file path now is '/var/log/tcmu-runner.log'

Is there a chance that /etc/tcmu.conf is missing in your system?

You should also fix the tcmu.conf_install.cmake, this makes it install the tcmu.conf to /etc/tcmu/.

And also the spec file.

@lxbsz lxbsz changed the base branch from master to main August 10, 2022 00:21
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.

2 participants