lxcfacility-allmail1 Mailing List for LXCF - LXC Facility
LXCF (LXC Facility) generates LXC container of full OS environment.
Status: Beta
Brought to you by:
niwa-hideyuki
You can subscribe to this list here.
| 2014 |
Jan
|
Feb
(3) |
Mar
(129) |
Apr
(88) |
May
(44) |
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: niwa <niw...@jp...> - 2014-06-16 05:12:16
|
Hi, TAMUKI-san Thank you. I adopt this patch. Thanks, niwa-hideyuki |
|
From: TAMUKI S. <ta...@li...> - 2014-06-13 07:51:27
|
Previously, there were some nasty problems due to removing ChangeLog
from .gitignore:
- There exists ChangeLog not being up-to-date in the git repository.
- ChangeLog will be accidentally updated in the git repository, which
is not up-to-date like commit 46480ef. We have to always take care
of the condition of ChangeLog that is updated or not.
- ChangeLog will be sometimes kept up-to-date like commit 0cd90ac, but
the operation itself will not be logged into ChangeLog at the time.
- When ChangeLog are updated in the git repository, a merge conflict
easily occurs on another developer's local machine.
To solve the above problems, ChangeLog should be add to .gitignore
eventually.
Also, add ChangeLog rule in Makefile to avoid make install failure
in spite of non-existence of ChangeLog.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
.gitignore | 1 +
lxcf/ChangeLog | 1465 --------------------------------------------------------
lxcf/Makefile | 6 +-
3 files changed, 6 insertions(+), 1466 deletions(-)
delete mode 100644 lxcf/ChangeLog
diff --git a/.gitignore b/.gitignore
index bc88a7f..94f8c75 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
/lxcf-*.tar.gz
/lxcf/.prepare
+/lxcf/ChangeLog
/lxcf/doc/lxcf.1.gz
/lxcf/src/lxcf-resource1
/lxcf/src/lxcf-sched
diff --git a/lxcf/ChangeLog b/lxcf/ChangeLog
deleted file mode 100644
index 87bdd7a..0000000
--- a/lxcf/ChangeLog
+++ /dev/null
@@ -1,1465 +0,0 @@
-2014-06-13 niwa-hideyuki <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/lib/lxcf-list: compatibility with old release.
- It corresponds to the movement of container_name.
- * lxcf/ChangeLog, lxcf/INSTALL, lxcf/NEWS, lxcf/README,
- lxcf/lib/lxcf-list, lxcf/lxcf.spec: RHEL7 is supported.
- * lxcf/NEWS, lxcf/lxcf.spec: Preparation for release 0.7
-
-2014-06-12 niwa-hideyuki <niw...@jp...>
-
- * lxcf/conf/helpfile.txt, lxcf/lib/lxcf-list: Correspondence to
- interchangeability with old release.
- * lxcf/ChangeLog, lxcf/lib/lxcf-erase: The bug that misidentifies
- ".work" to the container is corrected by the erase processing.
- * lxcf/ChangeLog, lxcf/lib/lxcf-restore: The bug that misidentifies
- ".work" to the container is corrected by the restore processing.
-
-2014-06-11 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/lib/lxcf-clone, lxcf/lib/lxcf-restore,
- lxcf/lib/lxcf-sysgen: Container_name is generated to HOST.
- * lxcf/ChangeLog, lxcf/lib/lxcf-clone, lxcf/lib/lxcf-list,
- lxcf/lib/lxcf-restore, lxcf/lib/lxcf-update1: Container_name of HOST
- is used and it processes it.
-
-2014-06-11 niwa-hideyuki <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/lib/lxcf-collection-broken-container,
- lxcf/lib/lxcf-restore: The bug with a not generable container is
- corrected in optional -n and -p of restore.
- * lxcf/ChangeLog, lxcf/lib/lxcf-restore: The bug to which the mode of
- the container is not set in optional np of restore is corrected.
- * lxcf/cmd/show: The bug of the error indication is corrected by the
- show command.
- * lxcf/cmd/show: UUID can be specified by the show command.
- * lxcf/cmd/set: UUID can be specified by the set command.
- * lxcf/conf/helpfile.txt, lxcf/doc/lxcf.1: Renewal of manual
- concerning argument
- * lxcf/ChangeLog, lxcf/lxcf.spec: Renewal of changelog
-
-2014-06-10 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/lib/lxcf-collection-broken-container: The bug
- that mistakes the container in restore and erases it is corrected.
-
-2014-06-10 niwa-hideyuki <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/lib/lxcf-collection-broken-container: The bug
- from which the restore image is erased is corrected.
-
-2014-06-09 niwa-hideyuki <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/lib/lxcf-restore, lxcf/lib/lxcf-snapshot: The
- version is removed from package information on snapshot.
- * lxcf/lib/lxcf-restore: The bug of the package installation
- processing at restore is corrected.
- * lxcf/ChangeLog, lxcf/lib/lxcf-collection-broken-container,
- lxcf/lib/lxcf-restore, lxcf/lib/lxcf-snapshot, lxcf/lib/lxcf-update:
- The bug of the package installation processing at restore is
- corrected.
- * lxcf/ChangeLog, lxcf/Makefile,
- lxcf/lib/lxcf-collection-broken-container, lxcf/lib/lxcf-rc,
- lxcf/lib/lxcf-syncusr: Change of lxcf-collection-broken-container
- processing.
- Call of lxcf-syncusr Deletion of debug message Change in the
- processing order
- * lxcf/ChangeLog, lxcf/Makefile, lxcf/cmd/log, lxcf/cmd/queue,
- lxcf/conf/helpfile.txt, lxcf/doc/lxcf.1,
- lxcf/lib/lxcf-collection-broken-container, lxcf/lib/lxcf-log,
- lxcf/lib/lxcf-queue-log: Lxcf queue log is changed to lxcf log.
-
-2014-06-08 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/Makefile, lxcf/lib/lxcf-uuid: The name is
- requested from uuid.
- * lxcf/ChangeLog, lxcf/Makefile, lxcf/cmd/queue,
- lxcf/lib/lxcf-queue-reboot, lxcf/lib/lxcf-queue-resume,
- lxcf/lib/lxcf-queue-start, lxcf/lib/lxcf-queue-stop,
- lxcf/lib/lxcf-queue-suspend: queue start, stop, suspend, resume,
- reboot are removed.
- Because the function overlaps.
- * lxcf/lib/lxcf-restore: The bug to which the autostart attribute was
- not able to be restored by the restore command is corrected.
- * lxcf/ChangeLog, lxcf/INSTALL, lxcf/Makefile, lxcf/README,
- lxcf/cmd/lxcf, lxcf/cmd/version, lxcf/lxcf.spec: start release 0.7
-
-2014-06-07 Hdeyuki Niwa <niw...@jp...>
-
- * .gitignore, lxcf/ChangeLog: ChangeLog is added to the git
- repository.
- Because it fails in make install if there is no ChangeLog when clone
- is done from git.
- * lxcf/lib/lxcf-autostart, lxcf/lib/lxcf-restore: When restore is
- done, the autostart attribute is restored.
- * lxcf/ChangeLog, lxcf/lib/lxcf-list: The attribute of autostart is
- added to the display of list.
-
-2014-06-06 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lib/lxcf-snapshot: Optional -f is added to snapshot.
- Optional -f overwrites the snapshot image that already exists. If
- there is no option but the image already exists, it becomes an
- error.
- * lxcf/lib/lxcf-snapshot: The error processing when the image exists
- is added.
- * lxcf/conf/helpfile.txt, lxcf/doc/lxcf.1: The document of the
- snapshot command is corrected.
- * lxcf/lib/lxcf-restore, lxcf/lib/lxcf-snapshot: Check on "UUID and
- container name" of snapshot image
- * lxcf/cmd/show, lxcf/lib/lxcf-autostart, lxcf/lib/lxcf-clone,
- lxcf/lib/lxcf-collection-broken-container, lxcf/lib/lxcf-erase,
- lxcf/lib/lxcf-list, lxcf/lib/lxcf-reboot, lxcf/lib/lxcf-resource,
- lxcf/lib/lxcf-resume, lxcf/lib/lxcf-run, lxcf/lib/lxcf-start,
- lxcf/lib/lxcf-stop, lxcf/lib/lxcf-suspend, lxcf/lib/lxcf-sysgen:
- UUID can be specified instead of the container name.
- * lxcf/conf/helpfile.txt, lxcf/doc/lxcf.1, lxcf/lib/lxcf-list,
- lxcf/lib/lxcf-snapshot: Optional -q is applied to the list command.
- In optional -q, the list of queue is displayed.
-
-2014-06-05 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lib/lxcf-restore: Optional -s is added to the restore command.
- Optional -s that automatically adds the lack package for the
- restored container is added to the restore command.
- * lxcf/lib/lxcf-snapshot: The relative path can be used to pass the
- snapshot command.
- * lxcf/lib/lxcf-restore: The relative path can be used to pass the
- restore command.
- * lxcf/lib/lxcf-restore: Optional "-r" of the restore command is
- changed to optional "-f".
- * lxcf/conf/helpfile.txt, lxcf/doc/lxcf.1: Making of document of
- snapshot and restore
- * lxcf/lib/lxcf-clone: When clone is done, log is cleared.
-
-2014-06-04 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/restore, lxcf/lib/lxcf-restore,
- lxcf/lib/lxcf-snapshot, lxcf/lib/lxcf-sysgen: The restore function
- of snapshot is added.
- * lxcf/lib/lxcf-submit: Snapshot and restore can be submitted.
-
-2014-06-03 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/snapshot, lxcf/lib/lxcf-restore,
- lxcf/lib/lxcf-snapshot: Subcommand snapshot is added.
- * lxcf/lib/lxcf-snapshot: The form of snapshot is changed.
-
-2014-06-02 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/lib/lxcf-restore, lxcf/lib/lxcf-snapshot:
- addition of lxcf-snapshot
-
-2014-05-29 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lib/lxcf-collection-broken-container: Prevention of double
- start of lxcf-collection-broken-container
-
-2014-05-29 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile, lxcf/lib/lxcf-collection-broken-container: Improve
- lxcf-collection-broken-container
- Add sanity check for libvirtd service and fix for finding broken
- containers. Previously, for example, if there are a broken
- container "ct01" and a normal container "ct0123" at the same time,
- the broken container will not be processed.
-
-2014-05-28 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/src/lxcf-sched.c: Clean up lxcf-sched.c
- There are no logical changes, clean up only.
-
-2014-05-25 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-sysgen: Improve lxcf-sysgen
- Brush up around UUID.
- * lxcf/Makefile: Adjust the install rule in Makefile
- If "DESTDIR" is something defined (i.e. making the package,) prevent
- displaying "Please reboot this system."
-
-2014-05-26 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/lib/lxcf-collection-broken-container,
- lxcf/src/lxcf-sched.c: A broken container is found, and it erases
- it.
- * lxcf/lib/lxcf-setup: Lxcf.service and lxcf-sched.service in the
- container are invalidated.
-
-2014-05-24 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/INSTALL, lxcf/Makefile, lxcf/README, lxcf/cmd/lxcf,
- lxcf/cmd/version, lxcf/lxcf.spec: Release 0.6 is begun
-
-2014-05-23 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/src/lxcf-sched.c: The bug in which the start of
- lxcf-sched fails is corrected.
- * lxcf/Makefile, lxcf/cmd/lxcf, lxcf/lxcf.spec: The bug of the error
- when the package is made excluding root is corrected.
- * lxcf/cmd/queue, lxcf/cmd/submit, lxcf/lib/lxcf-clone,
- lxcf/lib/lxcf-queue-cancel, lxcf/lib/lxcf-queue-clear,
- lxcf/lib/lxcf-queue-list, lxcf/lib/lxcf-queue-move,
- lxcf/lib/lxcf-queue-reboot, lxcf/lib/lxcf-queue-resume,
- lxcf/lib/lxcf-queue-start, lxcf/lib/lxcf-queue-stop,
- lxcf/lib/lxcf-queue-suspend, lxcf/lib/lxcf-rc, lxcf/lib/lxcf-submit,
- lxcf/lib/lxcf-sysgen, lxcf/src/lxcf-sched.c: The bug that lxcf-sched
- terminates abnormally without finding the use file is corrected.
- The queue file used is moved from "/var/tmp" to "/var/lib".
-
-2014-05-22 niwa-hideyuki <niw...@jp...>
-
- * lxcf/conf/helpfile.txt, lxcf/doc/lxcf.1: Collection of manual for
- queue commands.
- * lxcf/conf/helpfile.txt, lxcf/doc/lxcf.1, lxcf/lib/lxcf-queue-multi:
- The function to display the multiplicity is added to "Queue multi".
-
-2014-05-21 niwa-hideyuki <niw...@jp...>
-
- * lxcf/rest-api/.gitkeep, lxcf/rest-api/compute/.gitkeep,
- lxcf/rest-api/identify/.gitkeep: The source directory for REST API
- is made.
- * lxcf/Makefile, lxcf/cmd/skipjob, lxcf/conf/helpfile.txt,
- lxcf/doc/lxcf.1, lxcf/lib/lxcf-skipjob: Deletion of skipjob command
-
-2014-05-19 niwa-hideyuki <niw...@jp...>
-
- * lxcf/src/lxcf-sched.c: The mistake of the operation of the character
- buffer that lxcf-sched uses is corrected.
-
-2014-05-18 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-clone, lxcf/lib/lxcf-sysgen: The bug from which the
- error message comes out by sysgen and clone is corrected.
-
-2014-05-17 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-sysgen, lxcf/src/lxcf-sched.c: UUID of queue is passed
- to the container generated with sysgen.
- When two or more containers are generated, UUID is passed to the
- first container. Sysgen-n is off the subject.
- * lxcf/lib/lxcf-clone, lxcf/lib/lxcf-sysgen: UUID of queue is passed
- to the container generated with clone.
- When two or more containers are generated, UUID is passed to the
- first container. clone-n is off the subject.
- * lxcf/Makefile, lxcf/cmd/q: q command is added as an alias of queue.
-
-2014-05-16 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lxcf.spec, package/makepkg.sh: Improve lxcf.spec
- Thanks to many suggestive comments by Fedora package reviewers, the
- lxcf spec file has been brushed up to be simpler and
- arch-independent. To proceed a step further, the lxcf package can
- now build into proper rpms and work on architectures other than
- x86_64.
-
-2014-05-15 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lib/lxcf-submit: Limitation of number of jobs on queue
- * lxcf/src/lxcf-sched.c: The comment on functions are added.
-
-2014-05-14 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/queue, lxcf/lib/lxcf-queue-multi,
- lxcf/src/lxcf-sched.c: The multiplicity of job was made changeable.
- The multiplicity of job is dynamically changeable in "queue multi".
- usage : lxcf queue multi NUMBER
- * lxcf/lib/lxcf-queue-multi, lxcf/src/lxcf-sched.c: Improvement of
- change processing of multiplicity of lxcf-sched
- * lxcf/cmd/queue, lxcf/cmd/submit, lxcf/src/lxcf-sched.c: Improvement
- of salvage procedure of lxcf-sched
-
-2014-05-13 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/queue, lxcf/lib/lxcf-queue-log: Command
- queue log that displays the log is added.
- lxcf queue log [-f] The log is displayed with less. The log is in
- real time displayed if there is optional -f.
- * lxcf/lib/lxcf-queue-cancel, lxcf/lib/lxcf-queue-list,
- lxcf/lib/lxcf-queue-reboot, lxcf/lib/lxcf-queue-resume,
- lxcf/lib/lxcf-queue-start, lxcf/lib/lxcf-queue-stop,
- lxcf/lib/lxcf-queue-suspend, lxcf/src/lxcf-sched.c: Multiplexing the
- job execution is enabled.
-
-2014-05-13 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-skipjob, lxcf/lib/lxcf-sysgen: Fix the command path
- for systemctl
- Fix the command path to /usr/bin for systemctl. Also, remove
- trailing whitespace.
-
-2014-05-12 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lxcf.spec: Restart of unnecessary libvirtd.service when the
- package is installed is deleted.
- * lxcf/example/ops-script: Correction of example
- The method of starting the container was corrected in ops-script.
-
-2014-05-10 TAMUKI Shoichi <ta...@li...>
-
- * .gitignore, lxcf/ChangeLog, lxcf/package/BUILD/.gitkeep,
- lxcf/package/RPMS/.gitkeep, lxcf/package/SOURCES/.gitkeep,
- lxcf/package/SPECS/.gitkeep, lxcf/package/SRPMS/.gitkeep,
- lxcf/package/makepkg.sh, package/BUILD/.gitkeep,
- package/RPMS/.gitkeep, package/SOURCES/.gitkeep,
- package/SPECS/.gitkeep, package/SRPMS/.gitkeep, package/makepkg.sh:
- Improve the script for making package
- To solve nasty problems dealing with ChangeLog, move the
- lxcf/package directory to the top level directory of the git working
- tree. This change still prevents the script for making ChangeLog
- from mixing into the distributed materials.
-
-2014-05-10 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/lib/lxcf-queue-start, lxcf/lib/lxcf-queue-stop:
- Added queue start and stop commands.
- lxcf queue start UUID lxcf queue stop UUID Argument is the uuid.
- * lxcf/Makefile, lxcf/cmd/queue, lxcf/lib/lxcf-queue-reboot,
- lxcf/lib/lxcf-queue-resume, lxcf/lib/lxcf-queue-suspend: added queue
- reboot, resume, and suspend
- lxcf queue reboot UUID lxcf queue resume UUID lxcf queue suspend
- UUID
-
-2014-05-09 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lib/lxcf-queue-cancel: The container can be deleted by the
- queue cancel command.
- * lxcf/ChangeLog, lxcf/lib/lxcf-setup: stop libvirtd.service in
- container
-
-2014-05-08 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lib/lxcf-queue-cancel: The function to cancel the job under
- execution is added.
- Even if the job specified with queue cancel is executing it, it is
- possible to cancel.
- * lxcf/ChangeLog: Correction of ChangeLog
- * lxcf/lib/lxcf-clone, lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-define,
- lxcf/lib/lxcf-queue-list, lxcf/lib/lxcf-reboot, lxcf/lib/lxcf-setup,
- lxcf/lib/lxcf-start, lxcf/lib/lxcf-sysgen: uuid is applied to the
- container made from sysgen and clone.
-
-2014-05-05 TAMUKI Shoichi <ta...@li...>
-
- * script/makechlog.sh: Modify makechlog.sh
- Clean up and modify makechlog.sh a bit.
-
-2014-05-07 niwa-hideyuki <niw...@jp...>
-
- * lxcf/cmd/queue, lxcf/cmd/submit, lxcf/lib/lxcf-queue-list,
- lxcf/src/lxcf-sched.c: The job under execution is displayed with
- queue list.
- uuid and the command of the job under execution are displayed.
- * lxcf/src/lxcf-sched.c: An unused variable is deleted from
- lxcf-sched.c.
-
-2014-05-05 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/cmd/lxcf: Fix checking systemd for lxcf and lxcf-sched service
- Add sanity check and clean up checking systemd for lxcf and
- lxcf-sched service.
-
-2014-05-05 NIWA Hideyuki <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/src/lxcf-sched.c: The system() function is
- changed into the processing of fork/exec.
- The system() function is not used because the job under execution
- can be interrupted, and the job is managed with waitpid.
- * lxcf/lib/lxcf-queue-clear: The default of the object queue clear is
- changed to Q-QUEUE.
- All queues were cleared so far. Q-QUEUE is cleared when not is
- being specified the queue by the argument.
-
-2014-05-04 NIWA Hideyuki <niw...@jp...>
-
- * .gitignore, lxcf/ChangeLog, lxcf/package/makepkg.sh,
- lxcf/script/git-set-file-times, lxcf/script/gitlog2changelog.py,
- script/git-set-file-times, script/gitlog2changelog.py,
- script/makechlog.sh: The place of script that generates ChangeLog is
- changed.
- script is moved to the directory above two. To make ChangeLog,
- makechlog.sh is executed.
-
-2014-05-03 niwa-hideyuki <niw...@jp...>
-
- * lxcf/cmd/lxcf: When the service of lxcf is disabled, the execution
- of the lxcf command is made enable. And, it is started.
- The service of the object is the following.
- - lxcf.service
- - lxcf-sched.service
-
-2014-05-02 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/script/gitlog2changelog.py: Improve gitlog2changelog.py (line
- boundary check)
- Improve line boundary check. Also, add year to the author line.
- * lxcf/script/gitlog2changelog.py: Improve gitlog2changelog.py
- (printing itemizations)
- When printing itemizations, the indents are now performed properly.
-
-2014-05-02 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lxcf.spec: The doc directory is added to specfile.
- * lxcf/lxcf.spec: The description of version 0.5-3 is added to
- specfile.
-
-2014-04-27 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/package/makepkg.sh: Improve makepkg.sh
- Use "make clean" instead of "rm" manually.
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: Clean up lxcf.spec
- Remove trailing whitespace.
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: Fix lxcf.spec
- Fix build.log "warning: File listed twice:" at the %doc directives.
- * lxcf/package/SPECS/.gitkeep, lxcf/package/SPECS/lxcf.spec: Remove
- duplicated lxcf.spec in package/SPECS
- To keep maintainability, remove duplicated lxcf.spec in
- package/SPECS. This is explicitly copied by makepkg.sh before doing
- rpmbuild.
- * lxcf/ChangeLog, lxcf/NEWS: Clean up ChangeLog and NEWS
- Remove trailing whitespace.
- * lxcf/ChangeLog, lxcf/NEWS, lxcf/package/makepkg.sh,
- lxcf/script/git-set-file-times, lxcf/script/gitlog2changelog.py:
- Improve generating ChangeLog
- ChangeLog is now auto-generated. The old ChangeLog is moved to
- NEWS.
- * .gitignore: Update .gitignore
- Add ChangeLog to .gitignore due to auto-generated.
- * lxcf/script/gitlog2changelog.py: Fix gitlog2changelog.py
- Fix getlog2changelog.py to fit with the print format of recent git.
- "git diff --stat" had learnt to print the status line in singular
- form whenever applicable since git-1.7.10 (Correct singular form in
- diff summary line for human interaction.)
- * lxcf/script/gitlog2changelog.py: Improve gitlog2changelog.py
- Add a special workaround for the git log of LXC Facility.
-
-2014-04-25 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-createfile: Improve copying directories in
- lxcf-createfile
- When copying directory tree for container creation, deal with the
- environment that /sbin, /bin, /lib and /lib64 directories are not
- only symbolic links but also regular directories. If the
- directories are regular directories, it will copy them recursively
- into the container. On the other hand, if they are symbolic links,
- it will just copy the symbolic links themselves into the container.
- Note, the directory /lib/modules will be skipped.
-
-2014-04-25 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/conf/lxcf-sched.service, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec: Correction of specfile concerning
- systemd
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: Correction of specfile
- concerning lxcf-sched.service
- * lxcf/conf/lxcf.service, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec: Deletion of wrong comment in specfile
-
-2014-04-23 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-createfile: Improve copying /var directory in
- lxcf-createfile
- When copying /var directory for container creation, the directories
- /var/cache/lxc, /var/lib/lxc and /var/lib/docker are now skipped,
- and then remove the contents in /var/log/lxc in case that lxc is
- installed in the system.
- * lxcf/lib/lxcf-createfile: Improve making directories in
- lxcf-createfile
- When /home and/or /usr are not copied, just make the top directories
- in the container to match with other directories.
-
-2014-04-24 niwa-hideyuki <niw...@jp...>
-
- * lxcf/src/lxcf-resource1.c, lxcf/src/lxcf-sched.c: Deletion of unused
- variable of C source.
- * lxcf/Makefile, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec:
- Arrangement of Makefile and specfile
-
-2014-04-21 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-createfile: Improve removing unnecessary contents in
- lxcf-createfile
- When removing unnecessary contents in the created container, keep
- the top directories that are no need to remove. Incidentally, clean
- up around creating /var.
-
-2014-04-17 niwa-hideyuki <niw...@jp...>
-
- * lxcf/package/makepkg.sh: Deletion of unnecessary binary
-
-2014-04-17 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec,
- lxcf/package/makepkg.sh: changelog of specfile is renewed.
- The update history of the package is filled in on changelog.
-
-2014-04-15 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: correction of
- lxcf.spec
-
-2014-04-15 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: Deletion of
- unnecessary message when package is installed
- * lxcf/Makefile, lxcf/cmd/skipjob, lxcf/conf/helpfile.txt,
- lxcf/doc/lxcf.1, lxcf/lib/lxcf-jobskip, lxcf/lib/lxcf-skipjob,
- lxcf/lxcf.spec: Addition of skipjob command.
- Addition of skipjob command. Correction of document related to
- skipjob
- * lxcf/ChangeLog, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec:
- Correction of Changelog
-
-2014-04-15 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-createfile: Improve copying bash initialization files
- in lxcf-createfile
- When bash is invoked as an interactive login shell, after reading
- and executing commands from the file /etc/profile first, it then
- looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that
- order, and reads and executes commands from the first one that
- exists and is readable. Similarly, when a login shell exits, bash
- reads and executes commands from the file ~/.bash_logout, if it
- exists. Therefore, those files also should be copied into the
- container as long as they exist. Incidentally, clean up around
- creating /var.
-
-2014-04-14 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-update, lxcf/lib/lxcf-update1: Warning messages are
- deleted at update.
- * lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-update2: The generation of
- /proc directory is added.
- /proc directory is needed at update.
- * lxcf/lib/lxcf-update: The command that can be used with update is
- limited.
- Only rpm, yum, and apt-get can be used.
- * lxcf/lib/lxcf-submit: Update and deploy are added to the command
- that submit can do.
- * lxcf/cmd/submit, lxcf/conf/helpfile.txt, lxcf/lib/lxcf-jobskip,
- lxcf/lib/lxcf-queue-cancel, lxcf/lib/lxcf-submit: The processing of
- a new jobskip command is added.
-
-2014-04-13 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-createfile: Introduce "lsdir" bash function in
- lxcf-createfile
- Previously, when copying directory tree for container creation, a
- part of files and directories, whose name begins with dot, will be
- skipped. Furthermore, some system administrators prefer to
- customize the shell environment like this: <<< export
- LS_OPTIONS="--color=auto -F -N -T0" function ls { command ls
- $LS_OPTIONS "$@" ; } ; export -f ls >>> into ~/.bashrc, so as to
- live a pleasant life. (In general, the individual files such as
- ~/.bashrc allow you to make changes as you would like.) In that
- situation, copying directory tree for container creation does not
- work properly. To avoid their problems, introduce "lsdir" bash
- function.
-
-2014-04-13 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-update, lxcf/lib/lxcf-update1: Improvement of update
- Update of joint container two or more models is prevented from
- failing.
-
-2014-04-12 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-load: The bug to which the json file cannot be read
- with sysgen -c is corrected.
-
-2014-04-10 niwa-hideyuki <niw...@jp...>
-
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: Trivial correction of
- lxcf.spec
-
-2014-04-10 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile: Adjust the clean rule in Makefile
- Fix the problem when "make clean libdir=/usr/lib" is specified.
-
-2014-04-10 Ken ICHIKAWA <ich...@jp...>
-
- * .gitignore: Add .gitignore
- Define unneeded files for our git repository.
-
-2014-04-10 Yasunori Goto <y-...@jp...>
-
- * lxcf/lib/lxcf-start: Make natural expression for lxcf-start
- Hi,
- I suppose that "is being start" is not natural expression a bit.
- So, I would like to make it more natural.
-
-2014-04-10 Ken ICHIKAWA <ich...@jp...>
-
- * lxcf/lib/lxcf-setup: Support writing into SysV IPC related
- parameters
- Libvirt-lxc mounts /proc/sys with read-only attribute as default.
- Therefore, we cannot change IPC related parameters under
- /proc/sys/kernel such as shmmax inside containers.
- However, containers' IPC related parameters are separated from host
- by IPC namespace. As a result, changing IPC related parameters
- inside a container has no effect on host but has effect on only the
- container.
- This patch changes domain XML for containers to additionally mount
- IPC related parameters under /proc/sys/kernel as writable so that we
- can change IPC related parameters inside containers.
-
-2014-04-10 niwa-hideyuki <niw...@jp...>
-
- * lxcf/package/makepkg.sh: clean up of makepkg.sh
- The package is able to be made excluding root.
-
-2014-04-10 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile: Fix the rule in Makefile
- Fix the .prepare and clean rule due to libdir=/usr/lib64 as default.
- * lxcf/lib/lxcf-createfile: Clean up of lxcf-createfile
- There are no logical changes, clean up only to keep maintainability.
-
-2014-04-09 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/lxcf, lxcf/package/makepkg.sh: Package
- making environment to shift to lib64
-
-2014-04-09 Ken ICHIKAWA <ich...@jp...>
-
- * lxcf/lib/lxcf-erase, lxcf/lib/lxcf-list, lxcf/lib/lxcf-reboot,
- lxcf/lib/lxcf-resource, lxcf/lib/lxcf-stop, lxcf/lib/lxcf-suspend,
- lxcf/lib/lxcf-sysgen, lxcf/lib/lxcf-update1: Specify absolute path
- for virsh
- Almost points are specifying /usr/bin/virsh for virsh path but some
- points were just specifying "virsh" without absolute path. Because
- of that, /usr/local/bin/virsh was executed along with /usr/bin/virsh
- unexpectedly on my environment. This patch fixes to specify
- absolute path for virsh.
-
-2014-04-09 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-setup: Fix typo in lxcf-setup
- Fix typo while converting /usr/lib/lxcf to /usr/lib64/lxcf.
-
-2014-04-08 niwa-hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/autostart, lxcf/cmd/blkio_r,
- lxcf/cmd/blkio_w, lxcf/cmd/blkiops_r, lxcf/cmd/blkiops_w,
- lxcf/cmd/clone, lxcf/cmd/clone-n, lxcf/cmd/cpun, lxcf/cmd/cpurate,
- lxcf/cmd/deploy, lxcf/cmd/erase, lxcf/cmd/erase-n, lxcf/cmd/helpcmd,
- lxcf/cmd/list, lxcf/cmd/lxcf, lxcf/cmd/memlimit,
- lxcf/cmd/memswlimit, lxcf/cmd/net_cls, lxcf/cmd/numa,
- lxcf/cmd/queue, lxcf/cmd/reboot, lxcf/cmd/resume, lxcf/cmd/resume-n,
- lxcf/cmd/run, lxcf/cmd/set-n, lxcf/cmd/show, lxcf/cmd/start,
- lxcf/cmd/start-n, lxcf/cmd/stop, lxcf/cmd/stop-n, lxcf/cmd/submit,
- lxcf/cmd/suspend, lxcf/cmd/suspend-n, lxcf/cmd/sysgen,
- lxcf/cmd/sysgen-n, lxcf/cmd/update, lxcf/conf/lxcf-hook,
- lxcf/conf/lxcf-sched.service, lxcf/conf/lxcf.service,
- lxcf/lib/lxcf-autostart, lxcf/lib/lxcf-clone,
- lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-define, lxcf/lib/lxcf-erase,
- lxcf/lib/lxcf-init, lxcf/lib/lxcf-list, lxcf/lib/lxcf-load,
- lxcf/lib/lxcf-queue-move, lxcf/lib/lxcf-rc, lxcf/lib/lxcf-reboot,
- lxcf/lib/lxcf-resource, lxcf/lib/lxcf-resource2,
- lxcf/lib/lxcf-resume, lxcf/lib/lxcf-run, lxcf/lib/lxcf-setup,
- lxcf/lib/lxcf-start, lxcf/lib/lxcf-stop, lxcf/lib/lxcf-suspend,
- lxcf/lib/lxcf-sysgen, lxcf/lib/lxcf-update, lxcf/lib/lxcf-update1,
- lxcf/lxcf.spec, lxcf/package/SOURCES/lxcf-0.5,
- lxcf/package/SPECS/lxcf.spec, lxcf/package/makepkg.sh: /usr/lib/lxcf
- is moved to /usr/lib64/lxcf.
-
-2014-04-07 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-clone: Wrong replacement processing is deleted for
- clone.
-
-2014-04-05 MUNEDA Takahiro <mu...@gm...>
-
- * lxcf/lib/lxcf-clone-setup, lxcf/lib/lxcf-config,
- lxcf/lib/lxcf-erase-setup, lxcf/lib/lxcf-load,
- lxcf/lib/lxcf-resource2, lxcf/lib/lxcf-setup, lxcf/lib/lxcf-submit:
- lib: Cleanup lxf-* python scripts
- Clean up warnings detected by flake8. This patch just fixes
- warnings, no functional change.
-
-2014-04-05 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-createfile: Trivial fix in lxcf-createfile
- Fix some comments to fit with the current situation. Also, separate
- the procedure of /home and /root to match with other procedures.
-
-2014-04-04 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/README, lxcf/lxcf.spec,
- lxcf/package/SOURCES/lxcf-0.5, lxcf/package/SPECS/lxcf.spec: start
- release-0.5
- * lxcf/cmd/lxcf, lxcf/cmd/version: change of version
-
-2014-04-03 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile: Adjust the uninstall rule in Makefile
- If "DESTDIR" is something defined (i.e. making the package,) prevent
- invoking "systemctl disable lxcf-sched."
-
-2014-04-02 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec:
- Correction of new ChangeLog of 0.4 release
-
-2014-04-01 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/conf/lxcf-sched.service, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec: Start when lxcf-sched is installed
-
-2014-03-30 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/cmd/lxcf, lxcf/lib/lxcf-config, lxcf/lib/lxcf-rc: Clean up
- related to lxcf wrapper and rc script
- There are no logical changes, clean up only.
- * lxcf/cmd/lxcf: Improve error handling of lxcf command wrapper
- Previously, if you mistype a lxcf command, you'd get a script error
- message from shell. To avoid this, check the command existence
- before invoking it. Also, during the transition to the lxcf
- interactive mode, invoke sh instead of bash in order to avoid
- reading and executing bashrc.
-
-2014-03-29 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: Fix of
- Makefile
- Fix around make install due to newly addition of submit and queue
- command. Also, avoid install empty lxcf-messages file.
-
-2014-03-28 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-check-json, lxcf/lib/lxcf-load, lxcf/lib/lxcf-setup:
- Fix around lxcf sysgen (Python script)
- Fix shebang line and place a UTF-8 byte-order marker at the
- beginning of the file. Also, fix print() functions to fit with both
- Python 2 and 3.
-
-2014-04-01 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-createfile: Optional -p is applied to mkdir.
-
-2014-03-29 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-createfile: Clean up of lxcf-createfile
- There are no logical changes, clean up only.
-
-2014-03-28 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-createfile: revert lxcf-create
- * lxcf/lib/lxcf-check-json, lxcf/lib/lxcf-load, lxcf/lib/lxcf-setup: A
- part of UTF-8 code and the print sentence of python are mended.
- * lxcf/Makefile, lxcf/conf/lxcf-sched.service, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec: Addition of lxcf-sched service
-
-2014-03-27 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-sysgen: Fix a careless typo in lxcf-sysgen
-
-2014-03-26 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/cmd/sysgen-n, lxcf/lib/lxcf-clearlog, lxcf/lib/lxcf-load,
- lxcf/lib/lxcf-sysgen: Improve lxcf sysgen (option checking)
- For sysgen-n and lxcf-clearlog, fix insufficient regex pattern, and
- then improve the check logic to be more efficient coding (including
- lxcf-sysgen.) Also, for lxcf-load, refine the unit conversion and
- fix variable typo.
- * lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-setup: Improve lxcf sysgen
- (creating directories)
- When copying directory tree for container creation, make it
- accurately reproducible the original, including dot files and
- symbolic links. For /sbin, /bin, /lib and /lib64, see if they are
- regular directories or symbolic links to make it copy properly.
- * lxcf/lib/lxcf-setup, lxcf/lib/lxcf-sysgen: Add sanity check for some
- functions
- For configuring systemd, networking and yum caching in lxcf-setup
- and lxcf-sysgen, add sanity checks assuming to work without error on
- various system. Also, reflect the host architecture to the
- container definition, and then refine here documents.
- * lxcf/lib/lxcf-sysgen: Fix around lxcf sysgen (~/.ssh/known_hosts)
- Deal with the case that ~/.ssh/known_hosts does not exist.
- * lxcf/Makefile: Adjust the .prepare rule in Makefile
- Fix the problem that "lxcf start ..." does not work properly when
- "make {clean,,install} libdir=/usr/lib64" are specified.
- * lxcf/cmd/sysgen, lxcf/cmd/sysgen-n, lxcf/lib/lxcf-clearlog,
- lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-define,
- lxcf/lib/lxcf-sysgen: Clean up around lxcf sysgen (1/2)
- Remove trailing whitespace and clean up and fix trivial typo.
- * lxcf/lib/lxcf-check-json, lxcf/lib/lxcf-load, lxcf/lib/lxcf-setup:
- Clean up around lxcf sysgen (2/2)
- Remove trailing whitespace and clean up and fix trivial typo.
-
-2014-03-27 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-queue-clear: Addition of processing of log of queue
- clear
-
-2014-03-27 Ken ICHIKAWA <ich...@jp...>
-
- * lxcf/conf/helpfile.txt: helpcmd: fix typo of helpcmd's message
- * lxcf/doc/lxcf.1: doc: trivial fixes
- Fix some trivial things such as adding period, changing style, etc.
-
-2014-03-26 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/src/lxcf-sched.c: The range of the lock of the scheduler is
- corrected.
- After the first job had been taken out, the unlock processing during
- the update of the job list was deleted.
- * lxcf/src/lxcf-sched.c: The range of the lock of the scheduler is
- corrected.
- After the first job had been taken out, the unlock processing during
- the update of the job list was deleted.
- * lxcf/lib/lxcf-submit: The length of the command line where submit
- can do is limited.
- A too long line cannot be specified.
- * lxcf/lib/lxcf-queue-cancel, lxcf/lib/lxcf-submit: Addition of log
- output for JOB submit and cancel.
-
-2014-03-25 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec:
- Correction of Makefile and spec file of lxcf-sched
- Compile and install of lxcf-sched are done.
-
-2014-03-25 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-submit, lxcf/src/lxcf-sched.c: addition of lxcf-sched
-
-2014-03-21 NIWA Hideyuki <niw...@jp...>
-
- * lxcf/Makefile, lxcf/lib/lxcf-queue-move, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec: Addition of lxcf-queue-move
- Submited JOB is moved to another queue.
- lxcf queue move [-h] [-q] [-l] UUID
-
-2014-03-21 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-queue-cancel, lxcf/lib/lxcf-queue-clear,
- lxcf/lib/lxcf-submit: Improvement of queue operation.
- Addition at job time. Display of list of cleared job. Display of
- job that cancels. The processing subcommand of the job is limited.
-
-2014-03-20 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-queue-clear, lxcf/package/SPECS/lxcf.spec: Addition of
- lxcf-queue-clear
-
-2014-03-19 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/queue, lxcf/cmd/submit,
- lxcf/lib/lxcf-queue-cancel, lxcf/lib/lxcf-queue-list,
- lxcf/lib/lxcf-submit, lxcf/lxcf.spec: Correction of processing of
- queue operation
- Addition of queue cancel. The range of queue clear is changed.
- After submit is executed, UUID is displayed.
-
-2014-03-17 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lib/lxcf-init, lxcf/lib/lxcf-keygen: Fix around lxcf-init again
- Exclude
- - Deal with the case ~/.bash_profile and ~/.bash_logout do not exist
- - Fix /dev/null typo
-
-2014-03-18 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/submit, lxcf/lib/lxcf-submit,
- lxcf/lxcf.spec: The LXCF processing is added and the submit command
- that turns on the batch is added.
- There are three batch queues (h:high priority, q:usually, l:low
- priority). The command is as follows.
- lxcf submit [-h] [-l] JOB-COMMAND
- The subcommand such as "sysgen euro-srv" can be used for the
- JOB-COMMAND.
- * lxcf/Makefile, lxcf/cmd/queue, lxcf/lib/lxcf-queue-list,
- lxcf/lxcf.spec: The queue list command that displays batch queue is
- added.
- The job that does submit is displayed. uu-id is added to the job.
- \# lxcf queue list \*\*\* H-QUEUE \*\*\*
- cf0f0f66-ae68-11e3-abd0-00d068148bd6 -h erase a-srv \*\*\* Q-QUEUE
- \*\*\* 13d049f6-ae5c-11e3-9da7-00d068148bd6 sysgen d-srv
- 819c8358-ae68-11e3-9861-00d068148bd6 sysgen euro-srv \*\*\* L-QUEUE
- \*\*\*
- * lxcf/cmd/submit, lxcf/lib/lxcf-submit, lxcf/package/SPECS/lxcf.spec:
- The command injection of submit is prevented.
-
-2014-03-18 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/cmd/update-alert, lxcf/lib/lxcf-init, lxcf/lib/lxcf-keygen: Fix
- around lxcf-init
- - Remove creating ~/.ssh directory because ssh-keygen creates ~/.ssh
- directory automatically
- - Append ssh-agent and ssh-add commands to either ~/.bash_profile,
- ~/.bash_login or ~/.profile instead of ~/.bashrc in order to avoid
- invoking the commands every time when stating a subshell
- - Also, Append ssh-agent killer to ~/.bash_logout
- - Remove trailing whitespace and clean up
-
-2014-03-17 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: Fix rpmlint warning
- To fix rpmlint warning bogus-variable-use-in-%post
- ${RPM_BUILD_ROOT}, Remove ${RPM_BUILD_ROOT} prefix in %post script.
-
-2014-03-16 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile, lxcf/cmd/show, lxcf/lib/lxcf-clone,
- lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-erase, lxcf/lib/lxcf-init,
- lxcf/lib/lxcf-sysgen: Remove unnecessary chmod's
- - Remove unnecessary chmod's, setting umask as needed
- - Remove trailing whitespace
- * lxcf/cmd/lxcf, lxcf/lib/lxcf-deploy, lxcf/lib/lxcf-erase,
- lxcf/lib/lxcf-maintenance, lxcf/lib/lxcf-update1,
- lxcf/lib/lxcf-update2: Fix the command path
- - Fix the command path to /bin for bash, rm and {,u}mount
- - Remove trailing whitespace
- * lxcf/Makefile, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec:
- Makefile: change file order
- Arrange cmd and lib files in functionally reasonable order.
-
-2014-03-15 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/doc/lxcf.1: doc: fix man page a bit
- Remove trailing whitespace.
- * lxcf/Makefile, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec:
- Makefile: clean up (change order)
- Change order to fit with spec file and clean up.
- * lxcf/package/BUILD/.gitignore, lxcf/package/BUILD/.gitkeep,
- lxcf/package/RPMS/.gitignore, lxcf/package/RPMS/.gitkeep,
- lxcf/package/SOURCES/.gitignore, lxcf/package/SOURCES/.gitkeep,
- lxcf/package/SPECS/.gitignore, lxcf/package/SRPMS/.gitignore,
- lxcf/package/SRPMS/.gitkeep: package: rename .gitignore to .gitkeep
- Rename .gitignore to .gitkeep as a placeholder.
- * lxcf/src/.deps/lxcf.Po: src: remove unnecessary file
- Remove unnecessary .deps/lxcf.Po file from repository.
-
-2014-03-14 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile: Makefile: some improvements
- Fix incomplete preparation.
- * lxcf/doc/lxcf.1: Remove last one contaminated multibyte character.
-
-2014-03-14 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile: The processing of ".prepared" of Makefile is
- corrected.
- * lxcf/doc/lxcf.1, lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-sysgen: he
- option that copies /opt, /home and /root in sysgen is added.
-
-2014-03-14 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/doc/lxcf.1: doc: fix man page
- Appropriately remove contaminated multibyte characters.
-
-2014-03-13 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile: Correction of permission of Makefile
- * lxcf/doc/lxcf.1: Update of man manual
- Update of man manual. Because a part of description is old.
- * lxcf/cmd/show: When /etc/lxcf/rsc disappears, the show command
- cannot display the result.
-
-2014-03-13 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile: Makefile: make directory variables configurable
- - Define install directories by configurable variables
- - Clean up and fix typo (uninstall: /sbin/lxcf -> /usr/sbin/lxcf)
-
-2014-03-12 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec:
- Correction of permission and %config of lxcf.spec and Makefile
-
-2014-03-12 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile: Makefile: improve make install
- If "DESTDIR" is something defined (i.e. making the package), prevent
- invoking "lxcf-init" and "systemctl restart libvirtd".
-
-2014-03-11 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: Improvement of spec
- file
-
-2014-03-11 TAMUKI Shoichi <ta...@li...>
-
- * lxcf/Makefile, lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec:
- Makefile: fix around make install
- - Replace "prefix" variable for "DESTDIR" in a standard way
- - Remove useless "-o root -g root" options from install command so
- as to work as non-root user for temporary install
-
-2014-03-10 MUNEDA Takahiro <mu...@gm...>
-
- * lxcf/ChangeLog: Doc: Clean up ChangeLog (order)
- Change the order of changelogs to newer-first. Then, people can see
- the latest log easily.
-
-2014-03-08 MUNEDA Takahiro <mu...@gm...>
-
- * lxcf/package/makepkg.sh: makepkg.sh: Removed hard coded version
- number
- Remove hard coded version number from makepkg.sh and get it from
- Makefile. By this change, no need to update this file in every
- version up.
- Thanks, Takahiro
- * lxcf/conf/lxcf.service: conf: Remove the un-needed statement
- I think this file is a part of lxcf, not a part of systemd. If you
- are not going to push this file into systemd, it should be removed.
- Thanks, Takahiro
- * lxcf/NEWS: Doc: Clean up NEWS (order)
- Change the order of contents to newer-first Then, people can see the
- latest log easily
- * lxcf/NEWS: Doc: Clean up NEWS (format)
- Aligned date format with ChangeLog
-
-2014-03-08 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/cmd/blkio_r, lxcf/cmd/blkio_w,
- lxcf/cmd/blkiops_r, lxcf/cmd/blkiops_w, lxcf/cmd/clone,
- lxcf/cmd/clone-n, lxcf/cmd/cpun, lxcf/cmd/cpurate, lxcf/cmd/deploy,
- lxcf/cmd/erase, lxcf/cmd/erase-n, lxcf/cmd/helpcmd, lxcf/cmd/list,
- lxcf/cmd/lxcf, lxcf/cmd/memlimit, lxcf/cmd/memswlimit,
- lxcf/cmd/net_cls, lxcf/cmd/numa, lxcf/cmd/reboot, lxcf/cmd/resume,
- lxcf/cmd/resume-n, lxcf/cmd/run, lxcf/cmd/set, lxcf/cmd/set-n,
- lxcf/cmd/show, lxcf/cmd/start, lxcf/cmd/start-n, lxcf/cmd/stop,
- lxcf/cmd/stop-n, lxcf/cmd/suspend, lxcf/cmd/suspend-n,
- lxcf/cmd/sysgen, lxcf/cmd/sysgen-n, lxcf/cmd/update,
- lxcf/cmd/version, lxcf/lib/lxcf-clone, lxcf/lib/lxcf-clone-setup,
- lxcf/lib/lxcf-config, lxcf/lib/lxcf-createfile,
- lxcf/lib/lxcf-deploy, lxcf/lib/lxcf-erase,
- lxcf/lib/lxcf-erase-setup, lxcf/lib/lxcf-keygen, lxcf/lib/lxcf-list,
- lxcf/lib/lxcf-load, lxcf/lib/lxcf-maintenance, lxcf/lib/lxcf-reboot,
- lxcf/lib/lxcf-resource, lxcf/lib/lxcf-resource2,
- lxcf/lib/lxcf-resume, lxcf/lib/lxcf-run, lxcf/lib/lxcf-setup,
- lxcf/lib/lxcf-start, lxcf/lib/lxcf-stop, lxcf/lib/lxcf-suspend,
- lxcf/lib/lxcf-sysgen, lxcf/lib/lxcf-update, lxcf/lib/lxcf-update1,
- lxcf/lib/lxcf-update2, lxcf/src/lxcf-resource1.c: Check on root
- authority
- Check on root authority. LXCF is checked without relying on a
- permission alone.
- * lxcf/Makefile, lxcf/lib/lxcf-sysgen, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec: Clear function of log.
- Clear function of log. Host's log is not succeeded to the
- container.
- * lxcf/lib/lxcf-clearlog: Clear function of log.
- Clear function of log. Host's log is not succeeded to the
- container.
-
-2014-03-05 Ken ICHIKAWA <ich...@jp...>
-
- * lxcf/lib/lxcf-update: lxcf-update: Fix infinite loop due to change
- of lxcf-list format
-
-2014-03-04 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/cmd/blkio_r, lxcf/cmd/blkio_w, lxcf/cmd/blkiops_r,
- lxcf/cmd/blkiops_w, lxcf/cmd/cpun, lxcf/cmd/cpurate,
- lxcf/cmd/memlimit, lxcf/cmd/memswlimit, lxcf/cmd/net_cls,
- lxcf/cmd/numa: Correction of error message
-
-2014-03-03 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-autostart, lxcf/lib/lxcf-clone,
- lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-define, lxcf/lib/lxcf-erase,
- lxcf/lib/lxcf-list, lxcf/lib/lxcf-reboot, lxcf/lib/lxcf-resource,
- lxcf/lib/lxcf-resume, lxcf/lib/lxcf-run, lxcf/lib/lxcf-start,
- lxcf/lib/lxcf-stop, lxcf/lib/lxcf-suspend, lxcf/lib/lxcf-sysgen: The
- character that can be used for the specified error display of the
- container name is displayed.
-
-2014-03-02 MUNEDA Takahiro <mu...@gm...>
-
- * lxcf/lib/lxcf-check-json, lxcf/lib/lxcf-clone-setup,
- lxcf/lib/lxcf-config, lxcf/lib/lxcf-parmchk-MJMI,
- lxcf/lib/lxcf-parmchk-cname, lxcf/lib/lxcf-parmchk-float,
- lxcf/lib/lxcf-parmchk-float-kmg, lxcf/lib/lxcf-parmchk-hexdig,
- lxcf/lib/lxcf-parmchk-num, lxcf/lib/lxcf-parmchk-num-kmg,
- lxcf/lib/lxcf-resource2: lib: Cleanup lxcf-* python scripts
- Clean up warnings detected by flake8 (a python source code checker)
- against following python scripts. This patch just fixes warnings,
- does not fix bugs.
- lxcf-check-json, lxcf-clone-setup, lxcf-config, lxcf-parmchk-MJMI,
- lxcf-parmchk-cname, lxcf-parmchk-float, lxcf-parmchk-float-kmg,
- lxcf-parmchk-hexdig, lxcf-parmchk-num, lxcf-parmchk-num-kmg, and
- lxcf-resource2
- I don't know whether lxcf project has a coding rule and/or
- submitting patches, so I just followed a flake8 way. If you have
- any information, please publish it on public. That would help
- upcoming project participants.
- Thanks, Takahiro
- * lxcf/lib/lxcf-erase-setup: lib: lxcf-erase-setup clean up and bug
- fixes
- Clean up warnings detected by flake8 (a python source code checker).
- This patch just fixes warnings, does not fix bugs.
- * lxcf/lib/lxcf-load: lib: lxcf-load clean up and bug fix
- Clean up warnings detected by flake8 (a python source code checker).
- This patch just fixes warnings, does not fix bugs.
- * lxcf/lib/lxcf-setup: lib: lxcf-setup clean up and bug fix
- Clean up warnings detected by flake8 (a python source code checker).
- This patch just fixes warnings, does not fix bugs.
-
-2014-02-24 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile, lxcf/doc/lxcf.1, lxcf/doc/lxcf.1.gz: The registration
- of the source of the man manual is changed from the binary into
- text.
-
-2014-02-22 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/ChangeLog, lxcf/INSTALL, lxcf/Makefile, lxcf/README,
- lxcf/cmd/lxcf, lxcf/cmd/version, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec, lxcf/package/makepkg.sh,
- lxcf/src/lxcf-resource1.c: start release-0.4-1
-
-2014-02-20 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/cmd/show, lxcf/lib/lxcf-resource2, lxcf/src/lxcf-resource1.c:
- Restoration processing when saved file on resource is dameged.
-
-2014-02-19 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-clone, lxcf/lib/lxcf-erase, lxcf/lib/lxcf-sysgen: When
- cntl-c is pushed sysgen, clone and erase on the way, the container
- under making is deleted.
-
-2014-02-19 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/Makefile_fedora19, lxcf/src/lxcf-resource1.c: Support of
- Fedora19
- * lxcf/ChangeLog, lxcf/lib/lxcf-suspend: Suspend on the way stop is
- prevented.
- * lxcf/ChangeLog: Suspend on the way stop is prevented.
- * lxcf/lib/lxcf-sysgen: When cntl-c is pushed sysgen on the way, the
- container under making is deleted.
-
-2014-02-17 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-erase, lxcf/lib/lxcf-sysgen: When cntl-c is pushed
- sysgen on the way, the container under making is deleted.
- * lxcf/cmd/update-alert: Neither rpm nor yum are checked when there is
- no container in the joint model.
-
-2014-02-14 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/cmd/show: The output of the show command is displayed with
- less.
- * lxcf/Makefile, lxcf/Makefile_fedora19, lxcf/cmd/set-n,
- lxcf/lxcf.spec, lxcf/package/SPECS/lxcf.spec: The set-n command is
- added.
- * lxcf/lib/lxcf-deploy: In deploy command, only the relative path of
- current dir or less can be used.
-
-2014-02-12 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-createfile: Because information on another container
- is not shown, it does not copy/etc/ libvirt onto the container.
- * lxcf/lib/lxcf-createfile: Because information on another container
- is not shown, it does not copy /var/log/libvirt onto the container.
- * lxcf/doc/lxcf.1.gz: witching to English of online manual
- * lxcf/cmd/clone-n, lxcf/cmd/sysgen-n: Optional -p option and -c is
- put on sysgen-n and clone-n.
-
-2014-02-11 Hdeyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-clone, lxcf/lib/lxcf-sysgen, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec, lxcf/package/makepkg.sh: ptional -p of
- sysgen improvement
- * lxcf/lib/lxcf-clone: The model of a former container is succeeded to
- with clone.
- * lxcf/lib/lxcf-list: Path is put up to the display of list.
-
-2014-02-10 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-createfile: /boot copy is stopped.
-
-2014-02-07 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/package/RPMS/.gitignore, lxcf/package/SOURCES/.gitignore,
- lxcf/package/SPECS/.gitignore, lxcf/package/SRPMS/.gitignore:
- Addition of directory for package
- * lxcf/package/makepkg.sh: Correction of package making script
- * lxcf/INSTALL, lxcf/Makefile, lxcf/Makefile_fedora19, lxcf/README,
- lxcf/cmd/lxcf, lxcf/cmd/version, lxcf/lxcf.spec,
- lxcf/package/SPECS/lxcf.spec, lxcf/package/makepkg.sh: start
- release-0.3
-
-2014-02-06 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/INSTALL, lxcf/README, lxcf/lib/lxcf-sysgen: The following
- description is added to README and INSTALL. "Lxcf operates only by
- Fedora 20 and RHEL7 Publib Beta now."
- * lxcf/lib/lxcf-clone, lxcf/lib/lxcf-erase, lxcf/lib/lxcf-sysgen:
- /opt/lxcf and/etc/lxcf are checked at generation and the deletion of
- the container.
- * lxcf/Makefile, lxcf/Makefile_fedora19, lxcf/lib/lxcf-clone,
- lxcf/lib/lxcf-erase, lxcf/lib/lxcf-sysgen, lxcf/lxcf.spec: When
- /etc/lxcf/lxcf.conf does not exist, it restores /etc/lxcf.
- * lxcf/lib/lxcf-clone, lxcf/lib/lxcf-erase, lxcf/lib/lxcf-sysgen,
- lxcf/package/RPMS/x86_64/lxcf-0.2-1.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.2-1.x86_64.rpm,
- lxcf/package/SPECS/lxcf.spec, lxcf/package/SRPMS/lxcf-0.2-1.src.rpm:
- Replenishment processing of/etc/hosts
- * lxcf/Makefile, lxcf/Makefile_fedora19, lxcf/lxcf.spec,
- lxcf/package/RPMS/x86_64/lxcf-0.2-1.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.2-1.x86_64.rpm,
- lxcf/package/SPECS/lxcf.spec, lxcf/package/SRPMS/lxcf-0.2-1.src.rpm:
- When installing and uninstalling the LXCF, virt-manager is stopped.
- * lxcf/package/BUILD/lxcf-0.2.tar.gz,
- lxcf/package/RPMS/x86_64/lxcf-0.2-1.x86_64.rpm,
- .../package/RPMS/x86_64/lxcf-debuginfo-0.2-1.x86_64.rpm,
- lxcf/package/SRPMS/lxcf-0.2-1.src.rpm: The file of rpm and tar.gz is
- excluded.
-
-2014-02-05 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-clone, lxcf/package/BUILD/lxcf-0.1.tar.gz,
- lxcf/package/SOURCES/lxcf-0.1, lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SPECS/lxcf.spec, lxcf/package/makepkg.sh: The bug to
- which the resource is not set with clone is corrected.
- * lxcf/lib/lxcf-clone, lxcf/lib/lxcf-setup: It was stopped to have
- copied it to dev, proc, and sys with clone.
- * lxcf/package/BUILD/lxcf-0.1.tar.gz,
- lxcf/package/BUILD/lxcf-0.2.tar.gz,
- lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- lxcf/package/RPMS/x86_64/lxcf-0.2-1.x86_64.rpm,
- .../package/RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- .../package/RPMS/x86_64/lxcf-debuginfo-0.2-1.x86_64.rpm: Renewal of
- package
- * lxcf/lib/lxcf-resume, lxcf/lib/lxcf-suspend: The response message of
- resume and suspend is added.
- * lxcf/lib/lxcf-list: The display of list is made to line up.
- * lxcf/package/RPMS/x86_64/lxcf-0.2-1.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.2-1.x86_64.rpm,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm,
- lxcf/package/SRPMS/lxcf-0.2-1.src.rpm: renewal of packages.
-
-2014-02-04 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-sysgen: It makes an error when VM and LXC of the same
- name exist.
- * lxcf/lib/lxcf-createfile, lxcf/lib/lxcf-resource2,
- lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: The display of blkio changes
- line line by line.
- * lxcf/README, lxcf/cmd/set,
- lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: Two or more containers can be
- used by the set command.
- * lxcf/lib/lxcf-erase, lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: The erase command is loosely
- checked.
- The erase command : because there is a role to make remains of an
- unnecessary container and the container beautiful.
- * lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm, lxcf/src/lxcf-resource1.c:
- The display of an initial value of resource is changed.
- * lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm, lxcf/src/lxcf-resource1.c: An
- unnecessary changing line is deleted from the resource display.
- * lxcf/lib/lxcf-load, lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: Error correction of sysgen of
- json specification
- * lxcf/lib/lxcf-update,
- lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: Update is a correction of the
- error to which infinity loops.
- * lxcf/ChangeLog, lxcf/INSTALL, lxcf/NEWS, lxcf/README,
- lxcf/package/BUILD/lxcf-0.1.tar.gz,
- lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: Update of document file
- * lxcf/Makefile, lxcf/cmd/version, lxcf/conf/helpfile.txt,
- lxcf/lxcf.spec, lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz, lxcf/package/SPECS/lxcf.spec,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: Addition of version command
- * lxcf/lib/lxcf-resource, lxcf/lib/lxcf-resume,
- lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: The resource can be set in
- suspend.
- * lxcf/INSTALL, lxcf/Makefile, lxcf/README, lxcf/cmd/lxcf,
- lxcf/cmd/version, lxcf/lxcf.spec: The version is adjusted to 0.2.
-
-2014-02-03 Hideyuki Niwa <niw...@jp...>
-
- * lxcf/lib/lxcf-stop, lxcf/package/RPMS/x86_64/lxcf-0.1-2.x86_64.rpm,
- lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../package/RPMS/x86_64/lxcf-debuginfo-0.1-2.x86_64.rpm,
- .../package/RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-2.src.rpm,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: Check on container name where
- it does not exist in stop operation.
- If the container name for which stop is specified does not exist,
- the error message is produced.
- * lxcf/lib/lxcf-clone, lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: The resource display by the
- clone operation is deleted.
- * lxcf/lib/lxcf-list, lxcf/lib/lxcf-reboot, lxcf/lib/lxcf-resource,
- lxcf/lib/lxcf-resume, lxcf/lib/lxcf-run, lxcf/lib/lxcf-setup,
- lxcf/lib/lxcf-start, lxcf/lib/lxcf-stop, lxcf/lib/lxcf-suspend,
- lxcf/lib/lxcf-sysgen, lxcf/lib/lxcf-update, lxcf/lib/lxcf-update1,
- lxcf/package/RPMS/x86_64/lxcf-0.1-3.x86_64.rpm,
- .../RPMS/x86_64/lxcf-debuginfo-0.1-3.x86_64.rpm,
- lxcf/package/SOURCES/lxcf-0.1.tar.gz,
- lxcf/package/SRPMS/lxcf-0.1-3.src.rpm: Check on container ...
[truncated message content] |
|
From: niwa <niw...@jp...> - 2014-05-29 05:01:07
|
Hi, TAMUKI-san Thank you. I adopt this patch. Thanks, niwa-hideyuki |
|
From: TAMUKI S. <ta...@li...> - 2014-05-29 02:45:49
|
Add sanity check for libvirtd service and fix for finding broken
containers. Previously, for example, if there are a broken container
"ct01" and a normal container "ct0123" at the same time, the broken
container will not be processed.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
lxcf/Makefile | 2 +-
lxcf/lib/lxcf-collection-broken-container | 45 +++++++++++++++----------------
2 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/lxcf/Makefile b/lxcf/Makefile
index d5d252b..21ba323 100644
--- a/lxcf/Makefile
+++ b/lxcf/Makefile
@@ -85,6 +85,7 @@ install_lib_lxcf: .prepare
install -m 755 src/lxcf-resource1 $(DESTDIR)$(libdir)/lxcf/lxcf-resource1
install -m 755 lib/lxcf-resource2 $(DESTDIR)$(libdir)/lxcf/lxcf-resource2
install -m 755 src/lxcf-sched $(DESTDIR)$(libdir)/lxcf/lxcf-sched
+ install -m 755 lib/lxcf-collection-broken-container $(DESTDIR)$(libdir)/lxcf/lxcf-collection-broken-container
install -m 755 lib/lxcf-sysgen $(DESTDIR)$(libdir)/lxcf/lxcf-sysgen
install -m 755 lib/lxcf-check-json $(DESTDIR)$(libdir)/lxcf/lxcf-check-json
install -m 755 lib/lxcf-createfile $(DESTDIR)$(libdir)/lxcf/lxcf-createfile
@@ -127,7 +128,6 @@ install_lib_lxcf: .prepare
install -m 755 lib/lxcf-parmchk-float-kmg $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-float-kmg
install -m 755 lib/lxcf-parmchk-hexdig $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-hexdig
install -m 755 lib/lxcf-parmchk-MJMI $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-MJMI
- install -m 755 lib/lxcf-collection-broken-container $(DESTDIR)$(libdir)/lxcf/lxcf-collection-broken-container
install_sbin_lxcf: .prepare
install -d -m 755 $(DESTDIR)$(sbindir)
diff --git a/lxcf/lib/lxcf-collection-broken-container b/lxcf/lib/lxcf-collection-broken-container
index 1b7425d..a268d36 100755
--- a/lxcf/lib/lxcf-collection-broken-container
+++ b/lxcf/lib/lxcf-collection-broken-container
@@ -28,30 +28,29 @@ umask 022
LOGFILE=/var/log/lxcf/lxcf-messages
-# If libvirtd.service is not effective, it does not do at all.
-if ! systemctl -q is-enabled libvirtd.service ; then
- exit 1
+# If libvirtd.service is not effective, it does not do at all.
+if [ -x /usr/bin/systemctl ] ; then
+ if ! systemctl -q is-enabled libvirtd.service ; then
+ exit 1
+ fi
fi
-# Nothing is done while sysgen, clone, and erase are operating.
-/usr/bin/ps -e -o cmd | awk '{ \
- if (($1 == "/usr/lib64/lxcf/lxcf-sysgen") || \
- ($1 == "/usr/lib64/lxcf/lxcf-clone") ||
- ($1 == "/usr/bin/lxcf/lxcf-erase")) { \
- echo "exit"
- exit(1) \
- }}'
-
-# A broken container is found, and it erases it.
-containers=`/usr/lib64/lxcf/lxcf-list | sed -e '1,2d' | awk '{print $1}'`
-for i in $containers
-do
- virshcontainer=`LANG=C /usr/bin/virsh -c lxc:/// list --all | sed -e '1,2d' | awk '{print $2}'`
- echo $virshcontainer | grep $i >& /dev/null
- if [ $? -ne 0 ]; then
- TM=`LANG=C date +"%c"`
- flock $LOGFILE echo "###" $TM "COLLECTION BROKEN CONTAINER :" $ "###" >> $LOGFILE
- /usr/lib64/lxcf/lxcf-erase $i >& /dev/null
- fi
+# Nothing is done while sysgen, clone, and erase are operating.
+if [ -n "`ps -e -o comm | grep "^lxcf-\(sysgen\|clone\|erase\)$"`" ] ; then
+ echo "exit"
+ exit 1
+fi
+
+# A broken container is found, and it erases it.
+virshcontainers=`virsh -c lxc:/// list --all | tail -n+3 | awk '{print $2}'`
+containers=`/usr/lib64/lxcf/lxcf-list | tail -n+3 | cut -f1`
+for i in $containers ; do
+ if ! echo "$virshcontainers" | grep -q "^$i$" ; then
+ TM=`LANG=C date "+%c"`
+ flock $LOGFILE echo "### $TM COLLECTION BROKEN CONTAINER: $i ###" \
+ >> $LOGFILE
+ /usr/lib64/lxcf/lxcf-erase "$i" > /dev/null 2>&1
+ fi
done
+exit 0
--
1.9.0
|
|
From: TAMUKI S. <ta...@li...> - 2014-05-29 02:44:57
|
Hello NIWA-san, From: niwa <niw...@jp...> Subject: Re: [Lxcfacility-allmail1] [PATCH] Improve lxcf-collection-broken-container Date: Thu, 29 May 2014 09:54:55 +0900 > However, only one point : > It is a name. > The purpose is to prevent the misunderstanding and the > misuse because it is a strong function that made to a long name. > And I feel lxcf-fsck strange though no fsck moreover. > Please, is not the name able not to be changed? I see. You have such an intension. Ok, I will revise the patch. Thanks in advance. Regards, TAMUKI Shoichi |
|
From: niwa <niw...@jp...> - 2014-05-29 00:55:09
|
Hi, TAMUKI-san
It is roughly good.
However, only one point :
It is a name.
The purpose is to prevent the misunderstanding and the
misuse because it is a strong function that made to a long name.
And I feel lxcf-fsck strange though no fsck moreover.
Please, is not the name able not to be changed?
Thanks,
niwa-hideyuki
-
On Wed, 28 May 2014 15:34:35 +0900
TAMUKI Shoichi <ta...@li...> wrote:
> Rename lxcf-collection-broken-container (too long) to lxcf-fsck, and
> then improve lxcf-fsck with sanity check for libvirtd service.
>
> Signed-off-by: TAMUKI Shoichi <ta...@li...>
> ---
> lxcf/Makefile | 2 +-
> lxcf/lib/lxcf-collection-broken-container | 57 -------------------------------
> lxcf/lib/lxcf-fsck | 56 ++++++++++++++++++++++++++++++
> lxcf/src/lxcf-sched.c | 2 +-
> 4 files changed, 58 insertions(+), 59 deletions(-)
> delete mode 100755 lxcf/lib/lxcf-collection-broken-container
> create mode 100755 lxcf/lib/lxcf-fsck
>
> diff --git a/lxcf/Makefile b/lxcf/Makefile
> index d5d252b..23a9284 100644
> --- a/lxcf/Makefile
> +++ b/lxcf/Makefile
> @@ -85,6 +85,7 @@ install_lib_lxcf: .prepare
> install -m 755 src/lxcf-resource1 $(DESTDIR)$(libdir)/lxcf/lxcf-resource1
> install -m 755 lib/lxcf-resource2 $(DESTDIR)$(libdir)/lxcf/lxcf-resource2
> install -m 755 src/lxcf-sched $(DESTDIR)$(libdir)/lxcf/lxcf-sched
> + install -m 755 lib/lxcf-fsck $(DESTDIR)$(libdir)/lxcf/lxcf-fsck
> install -m 755 lib/lxcf-sysgen $(DESTDIR)$(libdir)/lxcf/lxcf-sysgen
> install -m 755 lib/lxcf-check-json $(DESTDIR)$(libdir)/lxcf/lxcf-check-json
> install -m 755 lib/lxcf-createfile $(DESTDIR)$(libdir)/lxcf/lxcf-createfile
> @@ -127,7 +128,6 @@ install_lib_lxcf: .prepare
> install -m 755 lib/lxcf-parmchk-float-kmg $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-float-kmg
> install -m 755 lib/lxcf-parmchk-hexdig $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-hexdig
> install -m 755 lib/lxcf-parmchk-MJMI $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-MJMI
> - install -m 755 lib/lxcf-collection-broken-container $(DESTDIR)$(libdir)/lxcf/lxcf-collection-broken-container
>
> install_sbin_lxcf: .prepare
> install -d -m 755 $(DESTDIR)$(sbindir)
> diff --git a/lxcf/lib/lxcf-collection-broken-container b/lxcf/lib/lxcf-collection-broken-container
> deleted file mode 100755
> index 1b7425d..0000000
> --- a/lxcf/lib/lxcf-collection-broken-container
> +++ /dev/null
> @@ -1,57 +0,0 @@
> -#!/bin/sh
> -
> -# LXCF - LXC Facility
> -# Copyright (C) 2014 FUJITSU LIMITED
> -
> -# This program is free software; you can redistribute it and/or
> -# modify it under the terms of the GNU General Public License
> -# as published by the Free Software Foundation; version 2
> -# of the License.
> -#
> -# This program is distributed in the hope that it will be useful,
> -# but WITHOUT ANY WARRANTY; without even the implied warranty of
> -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> -# GNU General Public License for more details.
> -#
> -# You should have received a copy of the GNU General Public License
> -# along with this program; if not, write to the Free Software
> -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> -# 02110-1301, USA.
> -
> -# check root
> -if [ ${EUID:-$UID} -ne 0 ] ; then
> - echo "error: Because you are not root, you cannot execute this command."
> - exit 1
> -fi
> -
> -umask 022
> -
> -LOGFILE=/var/log/lxcf/lxcf-messages
> -
> -# If libvirtd.service is not effective, it does not do at all.
> -if ! systemctl -q is-enabled libvirtd.service ; then
> - exit 1
> -fi
> -
> -# Nothing is done while sysgen, clone, and erase are operating.
> -/usr/bin/ps -e -o cmd | awk '{ \
> - if (($1 == "/usr/lib64/lxcf/lxcf-sysgen") || \
> - ($1 == "/usr/lib64/lxcf/lxcf-clone") ||
> - ($1 == "/usr/bin/lxcf/lxcf-erase")) { \
> - echo "exit"
> - exit(1) \
> - }}'
> -
> -# A broken container is found, and it erases it.
> -containers=`/usr/lib64/lxcf/lxcf-list | sed -e '1,2d' | awk '{print $1}'`
> -for i in $containers
> -do
> - virshcontainer=`LANG=C /usr/bin/virsh -c lxc:/// list --all | sed -e '1,2d' | awk '{print $2}'`
> - echo $virshcontainer | grep $i >& /dev/null
> - if [ $? -ne 0 ]; then
> - TM=`LANG=C date +"%c"`
> - flock $LOGFILE echo "###" $TM "COLLECTION BROKEN CONTAINER :" $ "###" >> $LOGFILE
> - /usr/lib64/lxcf/lxcf-erase $i >& /dev/null
> - fi
> -done
> -
> diff --git a/lxcf/lib/lxcf-fsck b/lxcf/lib/lxcf-fsck
> new file mode 100755
> index 0000000..f08c3e6
> --- /dev/null
> +++ b/lxcf/lib/lxcf-fsck
> @@ -0,0 +1,56 @@
> +#!/bin/sh
> +
> +# LXCF - LXC Facility
> +# Copyright (C) 2014 FUJITSU LIMITED
> +
> +# This program is free software; you can redistribute it and/or
> +# modify it under the terms of the GNU General Public License
> +# as published by the Free Software Foundation; version 2
> +# of the License.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program; if not, write to the Free Software
> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +# 02110-1301, USA.
> +
> +# check root
> +if [ ${EUID:-$UID} -ne 0 ] ; then
> + echo "error: Because you are not root, you cannot execute this command."
> + exit 1
> +fi
> +
> +umask 022
> +
> +LOGFILE=/var/log/lxcf/lxcf-messages
> +
> +# If libvirtd.service is not effective, it does not do at all.
> +if [ -x /usr/bin/systemctl ] ; then
> + if ! systemctl -q is-enabled libvirtd.service ; then
> + exit 1
> + fi
> +fi
> +
> +# Nothing is done while sysgen, clone, and erase are operating.
> +if [ -n "`ps -e -o comm | grep "lxcf-\(sysgen\|clone\|erase\)"`" ] ; then
> + echo "exit"
> + exit 1
> +fi
> +
> +# A broken container is found, and it erases it.
> +virshcontainers=`virsh -c lxc:/// list --all | tail -n+3 | awk '{print $2}'`
> +containers=`/usr/lib64/lxcf/lxcf-list | tail -n+3 | cut -f1`
> +for i in $containers ; do
> + if ! echo $virshcontainers | grep -q $i ; then
> + TM=`LANG=C date "+%c"`
> + flock $LOGFILE echo "### $TM COLLECTION BROKEN CONTAINER: $i ###" \
> + >> $LOGFILE
> + /usr/lib64/lxcf/lxcf-erase $i > /dev/null 2>&1
> + fi
> +done
> +
> +exit 0
> diff --git a/lxcf/src/lxcf-sched.c b/lxcf/src/lxcf-sched.c
> index aba2769..7ee6887 100644
> --- a/lxcf/src/lxcf-sched.c
> +++ b/lxcf/src/lxcf-sched.c
> @@ -388,7 +388,7 @@ void launch_job(void)
>
> while (1) {
> // A broken container is found, and it erases it.
> - r = system("/usr/lib64/lxcf/lxcf-collection-broken-container");
> + r = system("/usr/lib64/lxcf/lxcf-fsck");
> if (r == -1) {
> printf("error: system function\n");
> }
> --
> 1.9.0
>
> ------------------------------------------------------------------------------
> Time is money. Stop wasting it! Get your web API in 5 minutes.
> www.restlet.com/download
> http://p.sf.net/sfu/restlet
> _______________________________________________
> Lxcfacility-allmail1 mailing list
> Lxc...@li...
> https://lists.sourceforge.net/lists/listinfo/lxcfacility-allmail1
|
|
From: TAMUKI S. <ta...@li...> - 2014-05-28 06:36:42
|
Rename lxcf-collection-broken-container (too long) to lxcf-fsck, and
then improve lxcf-fsck with sanity check for libvirtd service.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
lxcf/Makefile | 2 +-
lxcf/lib/lxcf-collection-broken-container | 57 -------------------------------
lxcf/lib/lxcf-fsck | 56 ++++++++++++++++++++++++++++++
lxcf/src/lxcf-sched.c | 2 +-
4 files changed, 58 insertions(+), 59 deletions(-)
delete mode 100755 lxcf/lib/lxcf-collection-broken-container
create mode 100755 lxcf/lib/lxcf-fsck
diff --git a/lxcf/Makefile b/lxcf/Makefile
index d5d252b..23a9284 100644
--- a/lxcf/Makefile
+++ b/lxcf/Makefile
@@ -85,6 +85,7 @@ install_lib_lxcf: .prepare
install -m 755 src/lxcf-resource1 $(DESTDIR)$(libdir)/lxcf/lxcf-resource1
install -m 755 lib/lxcf-resource2 $(DESTDIR)$(libdir)/lxcf/lxcf-resource2
install -m 755 src/lxcf-sched $(DESTDIR)$(libdir)/lxcf/lxcf-sched
+ install -m 755 lib/lxcf-fsck $(DESTDIR)$(libdir)/lxcf/lxcf-fsck
install -m 755 lib/lxcf-sysgen $(DESTDIR)$(libdir)/lxcf/lxcf-sysgen
install -m 755 lib/lxcf-check-json $(DESTDIR)$(libdir)/lxcf/lxcf-check-json
install -m 755 lib/lxcf-createfile $(DESTDIR)$(libdir)/lxcf/lxcf-createfile
@@ -127,7 +128,6 @@ install_lib_lxcf: .prepare
install -m 755 lib/lxcf-parmchk-float-kmg $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-float-kmg
install -m 755 lib/lxcf-parmchk-hexdig $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-hexdig
install -m 755 lib/lxcf-parmchk-MJMI $(DESTDIR)$(libdir)/lxcf/lxcf-parmchk-MJMI
- install -m 755 lib/lxcf-collection-broken-container $(DESTDIR)$(libdir)/lxcf/lxcf-collection-broken-container
install_sbin_lxcf: .prepare
install -d -m 755 $(DESTDIR)$(sbindir)
diff --git a/lxcf/lib/lxcf-collection-broken-container b/lxcf/lib/lxcf-collection-broken-container
deleted file mode 100755
index 1b7425d..0000000
--- a/lxcf/lib/lxcf-collection-broken-container
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-
-# LXCF - LXC Facility
-# Copyright (C) 2014 FUJITSU LIMITED
-
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# check root
-if [ ${EUID:-$UID} -ne 0 ] ; then
- echo "error: Because you are not root, you cannot execute this command."
- exit 1
-fi
-
-umask 022
-
-LOGFILE=/var/log/lxcf/lxcf-messages
-
-# If libvirtd.service is not effective, it does not do at all.
-if ! systemctl -q is-enabled libvirtd.service ; then
- exit 1
-fi
-
-# Nothing is done while sysgen, clone, and erase are operating.
-/usr/bin/ps -e -o cmd | awk '{ \
- if (($1 == "/usr/lib64/lxcf/lxcf-sysgen") || \
- ($1 == "/usr/lib64/lxcf/lxcf-clone") ||
- ($1 == "/usr/bin/lxcf/lxcf-erase")) { \
- echo "exit"
- exit(1) \
- }}'
-
-# A broken container is found, and it erases it.
-containers=`/usr/lib64/lxcf/lxcf-list | sed -e '1,2d' | awk '{print $1}'`
-for i in $containers
-do
- virshcontainer=`LANG=C /usr/bin/virsh -c lxc:/// list --all | sed -e '1,2d' | awk '{print $2}'`
- echo $virshcontainer | grep $i >& /dev/null
- if [ $? -ne 0 ]; then
- TM=`LANG=C date +"%c"`
- flock $LOGFILE echo "###" $TM "COLLECTION BROKEN CONTAINER :" $ "###" >> $LOGFILE
- /usr/lib64/lxcf/lxcf-erase $i >& /dev/null
- fi
-done
-
diff --git a/lxcf/lib/lxcf-fsck b/lxcf/lib/lxcf-fsck
new file mode 100755
index 0000000..f08c3e6
--- /dev/null
+++ b/lxcf/lib/lxcf-fsck
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# LXCF - LXC Facility
+# Copyright (C) 2014 FUJITSU LIMITED
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; version 2
+# of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# check root
+if [ ${EUID:-$UID} -ne 0 ] ; then
+ echo "error: Because you are not root, you cannot execute this command."
+ exit 1
+fi
+
+umask 022
+
+LOGFILE=/var/log/lxcf/lxcf-messages
+
+# If libvirtd.service is not effective, it does not do at all.
+if [ -x /usr/bin/systemctl ] ; then
+ if ! systemctl -q is-enabled libvirtd.service ; then
+ exit 1
+ fi
+fi
+
+# Nothing is done while sysgen, clone, and erase are operating.
+if [ -n "`ps -e -o comm | grep "lxcf-\(sysgen\|clone\|erase\)"`" ] ; then
+ echo "exit"
+ exit 1
+fi
+
+# A broken container is found, and it erases it.
+virshcontainers=`virsh -c lxc:/// list --all | tail -n+3 | awk '{print $2}'`
+containers=`/usr/lib64/lxcf/lxcf-list | tail -n+3 | cut -f1`
+for i in $containers ; do
+ if ! echo $virshcontainers | grep -q $i ; then
+ TM=`LANG=C date "+%c"`
+ flock $LOGFILE echo "### $TM COLLECTION BROKEN CONTAINER: $i ###" \
+ >> $LOGFILE
+ /usr/lib64/lxcf/lxcf-erase $i > /dev/null 2>&1
+ fi
+done
+
+exit 0
diff --git a/lxcf/src/lxcf-sched.c b/lxcf/src/lxcf-sched.c
index aba2769..7ee6887 100644
--- a/lxcf/src/lxcf-sched.c
+++ b/lxcf/src/lxcf-sched.c
@@ -388,7 +388,7 @@ void launch_job(void)
while (1) {
// A broken container is found, and it erases it.
- r = system("/usr/lib64/lxcf/lxcf-collection-broken-container");
+ r = system("/usr/lib64/lxcf/lxcf-fsck");
if (r == -1) {
printf("error: system function\n");
}
--
1.9.0
|
|
From: niwa <niw...@jp...> - 2014-05-28 04:41:57
|
Hi, TAMUKI-san Thank you for hearing various opinions. I adopt this patch. Thanks, niwa-hideyuki |
|
From: TAMUKI S. <ta...@li...> - 2014-05-28 03:52:10
|
There are no logical changes, clean up only.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
lxcf/src/lxcf-sched.c | 292 ++++++++++++++++++++++++++------------------------
1 file changed, 151 insertions(+), 141 deletions(-)
diff --git a/lxcf/src/lxcf-sched.c b/lxcf/src/lxcf-sched.c
index 706f9c8..aba2769 100644
--- a/lxcf/src/lxcf-sched.c
+++ b/lxcf/src/lxcf-sched.c
@@ -1,28 +1,29 @@
/*
-# LXCF - LXC Facility
-# copyright (C) 2013-2014 FUJITSU LIMITED All Rights Reserved
-
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-*/
+ * LXCF - LXC Facility
+ * Copyright (C) 2013-2014 FUJITSU LIMITED
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
/*
* lxcf batch scheduler
*
*/
-
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -33,37 +34,50 @@
// Control of multiplicity of job
#define MAXJOB 10
+
int MaxMultiJobs = 1;
pid_t JobPid[MAXJOB];
// Setting of queue
-#define HQUEUE "/var/lib/lxcf/hqueue"
-#define QQUEUE "/var/lib/lxcf/qqueue"
-#define LQUEUE "/var/lib/lxcf/lqueue"
-#define EXJOB "/var/lib/lxcf/exjob"
-
-#define LXCF_LOG "/var/log/lxcf/lxcf-messages"
-#define MAXBUF 4096
-
-#define MULTIQUEUENUM "/etc/lxcf/multiqueue"
-
-char *buf;
-char jobbuf[MAXBUF];
-char cmdbuf[MAXBUF+16];
-
-void lxcf_ex(char *arg);
-void set_exec_job(char *filename, pid_t pid, char* s);
+#define HQUEUE "/var/lib/lxcf/hqueue"
+#define QQUEUE "/var/lib/lxcf/qqueue"
+#define LQUEUE "/var/lib/lxcf/lqueue"
+#define EXJOB "/var/lib/lxcf/exjob"
+
+#define LXCF_LOG "/var/log/lxcf/lxcf-messages"
+#define MAXBUF 4096
+
+#define MULTIQUEUENUM "/etc/lxcf/multiqueue"
+
+char *buf;
+char jobbuf[MAXBUF];
+char cmdbuf[MAXBUF + 16];
+
+void usage(void);
+void init(void);
+void launch_job(void);
+void read_multiplicity(void);
+void write_multiplicity(void);
+int job_cleanup(void);
void clear_exec_job(char *filename, pid_t pid);
+char *get_job(void);
+char *get_job_queue(char *filequeue);
+char *date_time(void);
+void fork_multi_job(char *cmd);
+void cmd_exec(char *cmd);
+void lxcf_ex(char *arg);
+void set_exec_job(char *filequeue, pid_t pid, char *s);
-// The multiplicity is preserved in the file.
-void write_multiplicity()
+// The multiplicity is preserved in the file.
+void write_multiplicity(void)
{
FILE *fd;
int fh;
fd = fopen(MULTIQUEUENUM, "w");
if (fd == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM);
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ MULTIQUEUENUM);
exit(-1);
}
@@ -72,7 +86,7 @@ void write_multiplicity()
flock(fh, LOCK_EX);
if (ftruncate(fh, 0) == -1) {
- fprintf(stderr, "error: lxcf-sched : ftrancate\n");
+ fprintf(stderr, "error: lxcf-sched: ftrancate\n");
}
fprintf(fd, "%d", MaxMultiJobs);
@@ -84,21 +98,21 @@ void write_multiplicity()
return;
}
-// The multiplicity is read from the file.
-// MaxMultiJobs is written in the file if there is no file.
-void read_multiplicity()
+// The multiplicity is read from the file.
+// MaxMultiJobs is written in the file if there is no file.
+void read_multiplicity(void)
{
FILE *fd;
- int fh;
+ int fh, multi;
char buf[1024];
- int multi;
fd = fopen(MULTIQUEUENUM, "r");
if (fd == NULL) {
write_multiplicity();
fd = fopen(MULTIQUEUENUM, "r");
if (fd == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM);
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ MULTIQUEUENUM);
exit(-1);
}
}
@@ -109,11 +123,11 @@ void read_multiplicity()
buf[0] = 0;
multi = MaxMultiJobs;
- if (fgets(buf, 1024-1, fd) == NULL) {
+ if (fgets(buf, 1024 - 1, fd) == NULL) {
write_multiplicity();
} else {
- buf[1024-1] = 0;
- multi = (int)strtol(buf, NULL, 10);
+ buf[1024 - 1] = 0;
+ multi = (int) strtol(buf, NULL, 10);
if ((multi < 0) || (multi > MAXJOB)) {
multi = MaxMultiJobs;
}
@@ -131,15 +145,16 @@ void read_multiplicity()
}
// Preservation to file of job when being executing it
-void set_exec_job(char* filequeue, pid_t pid, char* s)
+void set_exec_job(char *filequeue, pid_t pid, char *s)
{
FILE *fdh;
- int fh;
+ int fh;
- // get job from QUEUE
+ // get job from QUEUE
fdh = fopen(filequeue, "a");
if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue);
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ filequeue);
exit(-1);
}
@@ -157,13 +172,14 @@ void set_exec_job(char* filequeue, pid_t pid, char* s)
}
// Deletion from file of completion job
-void clear_exec_job(char* filename, pid_t pid)
+void clear_exec_job(char *filename, pid_t pid)
{
char buf[4096];
- snprintf(buf, 4096-1,
- "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s",
+
+ snprintf(buf, 4096 - 1,
+ "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s",
filename, pid, filename);
- buf[4096-1] = 0;
+ buf[4096 - 1] = 0;
if (system(buf) == -1) {
printf("error: system function\n");
}
@@ -182,31 +198,29 @@ void cmd_exec(char *cmd)
lxcf_ex(cmd);
}
-char* date_time()
+char *date_time(void)
{
- time_t timer;
+ time_t timer;
struct tm *timep;
- char *s;
+ char *s;
time(&timer);
timep = localtime(&timer);
s = asctime(timep);
- if (s[strlen(s)-1] == '\n') {
- s[strlen(s)-1] = 0;
+ if (s[strlen(s) - 1] == '\n') {
+ s[strlen(s) - 1] = 0;
}
return s;
}
// salvage completion jobs
-int job_cleanup()
+int job_cleanup(void)
{
- int i, jobs;
pid_t p;
- int status;
-
+ int status, i, jobs;
+
p = waitpid(0, &status, WNOHANG);
- jobs = 0;
- for(i=0; i<MAXJOB; i++) {
+ for (i = jobs = 0; i < MAXJOB; i++) {
if (JobPid[i] == 0) {
continue;
}
@@ -221,16 +235,13 @@ int job_cleanup()
}
}
- return jobs;
+ return jobs;
}
-
void fork_multi_job(char *cmd)
{
- int pid;
- int i;
- int jobs=0;
-
+ int pid, i, jobs;
+
// spawn job
pid = fork();
if (pid < 0) {
@@ -240,21 +251,21 @@ void fork_multi_job(char *cmd)
exit(0);
} else { // parent process
set_exec_job(EXJOB, pid, cmd);
- for (i=0; i<MAXJOB; i++) {
+ for (i = 0; i < MAXJOB; i++) {
if (JobPid[i] == 0) {
JobPid[i] = pid;
break;
}
}
}
-
- for(;;) {
- // It loops until becoming empty JobPid.
+
+ while (1) {
+ // It loops until becoming empty JobPid.
read_multiplicity();
jobs = job_cleanup();
- // The multiplicity has been eased.
+ // The multiplicity has been eased.
if (jobs < MaxMultiJobs) {
break;
}
@@ -262,17 +273,16 @@ void fork_multi_job(char *cmd)
}
}
-char* get_job_queue(char* filequeue)
+char *get_job_queue(char *filequeue)
{
FILE *fdh;
- int fh;
- int i, j;
- int maxqueue, c;
+ int fh, maxqueue, c, i, j;
- // get job from QUEUE
+ // get job from QUEUE
fdh = fopen(filequeue, "r");
if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue);
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ filequeue);
return NULL;
}
@@ -281,54 +291,57 @@ char* get_job_queue(char* filequeue)
flock(fh, LOCK_EX);
// count jobfile lines
- for (maxqueue = 0;;) {
- if ((c = fgetc(fdh)) == '\n') {
+ maxqueue = 0;
+ while (1) {
+ c = fgetc(fdh);
+ if (c == '\n') {
maxqueue++;
} else if (c == EOF) {
break;
}
}
rewind(fdh);
-
- // The buffer where the job is put is allocated.
- buf = (char*)malloc(maxqueue*MAXBUF);
-
+
+ // The buffer where the job is put is allocated.
+ buf = (char *) malloc(maxqueue * MAXBUF);
+
// get all QUEUE
for (i = 0; i < maxqueue; i++) {
- if (fgets(&buf[i*MAXBUF], MAXBUF-1, fdh) == NULL) {
- buf[maxqueue*MAXBUF-1] = 0;
+ if (fgets(&buf[i * MAXBUF], MAXBUF - 1, fdh) == NULL) {
+ buf[maxqueue * MAXBUF - 1] = 0;
break;
}
- buf[(i+1)*MAXBUF-1] = 0;
+ buf[(i + 1) * MAXBUF - 1] = 0;
}
-
+
// find job in QUEUE
if (i != 0) {
fdh = freopen(filequeue, "w", fdh);
if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't re-open %s\n", filequeue);
+ fprintf(stderr, "error: lxcf-sched: "
+ "can't re-open %s\n", filequeue);
return NULL;
}
-
+
for (j = 1; j < i; j++) {
- fprintf(fdh, "%s", &buf[j*MAXBUF]);
+ fprintf(fdh, "%s", &buf[j * MAXBUF]);
}
// unlock QUEUE
flock(fh, LOCK_UN);
fclose(fdh);
- // The first job is put in jobbuf.
- strncpy(jobbuf, buf, MAXBUF-1);
- jobbuf[strlen(jobbuf)-1] = 0;
-
+ // The first job is put in jobbuf.
+ strncpy(jobbuf, buf, MAXBUF - 1);
+ jobbuf[strlen(jobbuf) - 1] = 0;
+
// free buf
free(buf);
buf = NULL;
-
+
return jobbuf;
}
-
+
// unlock QUEUE
flock(fh, LOCK_UN);
fclose(fdh);
@@ -336,60 +349,56 @@ char* get_job_queue(char* filequeue)
// free buf
free(buf);
- // Because the job is not found, NULL is returned.
+ // Because the job is not found, NULL is returned.
return NULL;
}
-char *get_job()
+char *get_job(void)
{
char *s;
-
+
s = get_job_queue(HQUEUE);
if (s != NULL) {
- printf("### %s H-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
+ printf("### %s H-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
return s;
}
s = get_job_queue(QQUEUE);
if (s != NULL) {
- printf("### %s Q-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
+ printf("### %s Q-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
return s;
}
s = get_job_queue(LQUEUE);
if (s != NULL) {
- printf("### %s L-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
+ printf("### %s L-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
return s;
}
return NULL;
}
-void launch_job()
+void launch_job(void)
{
- char *s;
- int i;
- int r;
-
- while(1) {
- // A broken container is found, and it erases it.
+ char *s;
+ int r, i;
+
+ while (1) {
+ // A broken container is found, and it erases it.
r = system("/usr/lib64/lxcf/lxcf-collection-broken-container");
if (r == -1) {
printf("error: system function\n");
}
- sleep (1);
+ sleep(1);
read_multiplicity();
job_cleanup();
-
+
// get a job from all queue
s = get_job();
if (s == NULL) {
@@ -398,11 +407,12 @@ void launch_job()
for (i = 0; i < strlen(s); i++) {
if (s[i] == ' ') {
- snprintf(cmdbuf, MAXBUF+16-1, "/usr/sbin/lxcf %s", &s[i]);
- cmdbuf[MAXBUF+16-1] = 0;
+ snprintf(cmdbuf, MAXBUF + 16 - 1,
+ "/usr/sbin/lxcf %s", &s[i]);
+ cmdbuf[MAXBUF + 16 - 1] = 0;
fork_multi_job(s);
-
+
break;
}
}
@@ -410,29 +420,28 @@ void launch_job()
printf("### %s JOB END ###\n", date_time());
fflush(stdout);
fflush(stderr);
-
}
}
-void usage()
+void usage(void)
{
- fprintf(stderr, "usage : lxcf-sched\n");
+ fprintf(stderr, "usage: lxcf-sched\n");
exit(-1);
}
-void init()
+void init(void)
{
- pid_t i;
- FILE *fd;
+ FILE *fd;
+ pid_t i;
// clear exjob
fd = fopen(EXJOB, "w");
if (fd != NULL) {
fclose(fd);
}
-
+
// clear jobstatus
- for (i=0; i < MAXJOB; i++) {
+ for (i = 0; i < MAXJOB; i++) {
JobPid[i] = 0;
}
}
@@ -441,7 +450,8 @@ int main(int argc, char **argv)
{
// euid check
if (geteuid() != 0) {
- fprintf(stderr, "error: Because you are not root, you cannot execute this command. \n");
+ fprintf(stderr, "error: Because you are not root, "
+ "you cannot execute this command.\n");
exit(-1);
}
@@ -452,24 +462,24 @@ int main(int argc, char **argv)
// reopen stdout
if (freopen(LXCF_LOG, "a", stdout) == NULL) {
- fprintf(stderr, "error: can't open %s\n",LXCF_LOG);
+ fprintf(stderr, "error: can't open %s\n", LXCF_LOG);
exit(-1);
}
// reopen stderr
if (freopen(LXCF_LOG, "a", stderr) == NULL) {
- fprintf(stderr, "error: can't open %s\n",LXCF_LOG);
+ fprintf(stderr, "error: can't open %s\n", LXCF_LOG);
exit(-1);
}
init();
-
+
launch_job();
// close stdout & stderr
fclose(stdout);
fclose(stderr);
-
- exit(0);
+
+ exit(0);
}
--
1.9.0
|
|
From: TAMUKI S. <ta...@li...> - 2014-05-28 03:50:58
|
Hello NIWA-san, From: niwa <niw...@jp...> Subject: Re: [Lxcfacility-allmail1] [PATCH v3] Clean up lxcf-sched.c Date: Wed, 28 May 2014 09:51:36 +0900 > 1) The reason to change "//" into "/* */" assumes > Linux kernel to be a rule. (It is sure not to send it > to kernel. ) > However, I think that there is not a problem in "//". > I have programmed chiefly with C++ and Java up to now. > I think that "//" is convenient as the line comment. > This is a perhaps problem of the belief. Ok, I will follow your opinion. :-) > 2) Why does the order of the function changes? > It takes time for me to understand the content of > the program when the order of the function changes ;-) Ok, I revised the patch. Thanks in advance. Regards, TAMUKI Shoichi |
|
From: niwa <niw...@jp...> - 2014-05-28 00:51:51
|
Hi, TAMUKI-san Thank you for the patch sending. There are some comments. 1) The reason to change "//" into "/* */" assumes Linux kernel to be a rule. (It is sure not to send it to kernel. ) However, I think that there is not a problem in "//". I have programmed chiefly with C++ and Java up to now. I think that "//" is convenient as the line comment. This is a perhaps problem of the belief. 2) Why does the order of the function changes? It takes time for me to understand the content of the program when the order of the function changes ;-) Thanks, niwa-hideyuki -- On Wed, 28 May 2014 06:48:53 +0900 TAMUKI Shoichi <ta...@li...> wrote: > There are no logical changes, clean up only. > > Signed-off-by: TAMUKI Shoichi <ta...@li...> > --- > The patch has been revised due to lxcf-sched.c updated. > > The "// ..." style for comments is actually a C++ feature in origin. > In GNU C, you may use C++ style comments, but many people, especially > working with Linux, consider this harmful. In fact, the "Linux kernel > coding style" clearly describes as follows: > > http://linuxjf.sourceforge.jp/JFdocs/kernel-docs-2.6/CodingStyle.html > | Linux style for comments is the C89 "/* ... */" style. > | Don't use C99-style "// ..." comments. > > To avoid being denied admittance by other reviewers, we should use C > style comments. > > lxcf/src/lxcf-sched.c | 586 +++++++++++++++++++++++++------------------------- > 1 file changed, 297 insertions(+), 289 deletions(-) > > diff --git a/lxcf/src/lxcf-sched.c b/lxcf/src/lxcf-sched.c > index 706f9c8..231f662 100644 > --- a/lxcf/src/lxcf-sched.c > +++ b/lxcf/src/lxcf-sched.c > @@ -1,28 +1,29 @@ > /* > -# LXCF - LXC Facility > -# copyright (C) 2013-2014 FUJITSU LIMITED All Rights Reserved > - > -# This program is free software; you can redistribute it and/or > -# modify it under the terms of the GNU General Public License > -# as published by the Free Software Foundation; version 2 > -# of the License. > -# > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU General Public License for more details. > -# > -# You should have received a copy of the GNU General Public License > -# along with this program; if not, write to the Free Software > -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > -# 02110-1301, USA. > -*/ > + * LXCF - LXC Facility > + * Copyright (C) 2013-2014 FUJITSU LIMITED > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; version 2 > + * of the License. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > + * 02110-1301, USA. > + * > + */ > > /* > * lxcf batch scheduler > * > */ > - > + > #include <stdio.h> > #include <stdlib.h> > #include <unistd.h> > @@ -31,89 +32,172 @@ > #include <sys/file.h> > #include <sys/wait.h> > > -// Control of multiplicity of job > +/* Control of multiplicity of job */ > #define MAXJOB 10 > + > int MaxMultiJobs = 1; > pid_t JobPid[MAXJOB]; > > -// Setting of queue > -#define HQUEUE "/var/lib/lxcf/hqueue" > -#define QQUEUE "/var/lib/lxcf/qqueue" > -#define LQUEUE "/var/lib/lxcf/lqueue" > -#define EXJOB "/var/lib/lxcf/exjob" > +/* Setting of queue */ > +#define HQUEUE "/var/lib/lxcf/hqueue" > +#define QQUEUE "/var/lib/lxcf/qqueue" > +#define LQUEUE "/var/lib/lxcf/lqueue" > +#define EXJOB "/var/lib/lxcf/exjob" > > -#define LXCF_LOG "/var/log/lxcf/lxcf-messages" > -#define MAXBUF 4096 > +#define LXCF_LOG "/var/log/lxcf/lxcf-messages" > +#define MAXBUF 4096 > > -#define MULTIQUEUENUM "/etc/lxcf/multiqueue" > +#define MULTIQUEUENUM "/etc/lxcf/multiqueue" > > -char *buf; > -char jobbuf[MAXBUF]; > -char cmdbuf[MAXBUF+16]; > +char *buf; > +char jobbuf[MAXBUF]; > +char cmdbuf[MAXBUF + 16]; > > -void lxcf_ex(char *arg); > -void set_exec_job(char *filename, pid_t pid, char* s); > +void usage(void); > +void init(void); > +void launch_job(void); > +void read_multiplicity(void); > +void write_multiplicity(void); > +int job_cleanup(void); > void clear_exec_job(char *filename, pid_t pid); > +char *get_job(void); > +char *get_job_queue(char *filequeue); > +char *date_time(void); > +void fork_multi_job(char *cmd); > +void cmd_exec(char *cmd); > +void lxcf_ex(char *arg); > +void set_exec_job(char *filequeue, pid_t pid, char *s); > > -// The multiplicity is preserved in the file. > -void write_multiplicity() > +int main(int argc, char **argv) > { > - FILE *fd; > - int fh; > + /* euid check */ > + if (geteuid() != 0) { > + fprintf(stderr, "error: Because you are not root, " > + "you cannot execute this command.\n"); > + exit(-1); > + } > > - fd = fopen(MULTIQUEUENUM, "w"); > - if (fd == NULL) { > - fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM); > + /* args check */ > + if (argc != 1) { > + usage(); > + } > + > + /* reopen stdout */ > + if (freopen(LXCF_LOG, "a", stdout) == NULL) { > + fprintf(stderr, "error: can't open %s\n", LXCF_LOG); > exit(-1); > } > > - // lock QUEUE > - fh = fileno(fd); > - flock(fh, LOCK_EX); > + /* reopen stderr */ > + if (freopen(LXCF_LOG, "a", stderr) == NULL) { > + fprintf(stderr, "error: can't open %s\n", LXCF_LOG); > + exit(-1); > + } > > - if (ftruncate(fh, 0) == -1) { > - fprintf(stderr, "error: lxcf-sched : ftrancate\n"); > + init(); > + > + launch_job(); > + > + /* close stdout & stderr */ > + fclose(stdout), fclose(stderr); > + > + exit(0); > +} > + > +void usage(void) > +{ > + fprintf(stderr, "usage: lxcf-sched\n"); > + exit(-1); > +} > + > +void init(void) > +{ > + FILE *fd; > + pid_t i; > + > + /* clear exjob */ > + fd = fopen(EXJOB, "w"); > + if (fd != NULL) { > + fclose(fd); > } > > - fprintf(fd, "%d", MaxMultiJobs); > + /* clear jobstatus */ > + for (i = 0; i < MAXJOB; i++) { > + JobPid[i] = 0; > + } > +} > > - // unlock QUEUE > - flock(fh, LOCK_UN); > - fclose(fd); > +void launch_job(void) > +{ > + char *s; > + int r, i; > > - return; > + while (1) { > + /* A broken container is found, and it erases it. */ > + r = system("/usr/lib64/lxcf/lxcf-collection-broken-container"); > + if (r == -1) { > + printf("error: system function\n"); > + } > + > + sleep(1); > + > + read_multiplicity(); > + > + job_cleanup(); > + > + /* get a job from all queue */ > + s = get_job(); > + if (s == NULL) { > + continue; > + } > + > + for (i = 0; i < strlen(s); i++) { > + if (s[i] == ' ') { > + snprintf(cmdbuf, MAXBUF + 16 - 1, > + "/usr/sbin/lxcf %s", &s[i]); > + cmdbuf[MAXBUF + 16 - 1] = 0; > + > + fork_multi_job(s); > + > + break; > + } > + } > + > + printf("### %s JOB END ###\n", date_time()); > + fflush(stdout), fflush(stderr); > + } > } > > -// The multiplicity is read from the file. > -// MaxMultiJobs is written in the file if there is no file. > -void read_multiplicity() > +/* The multiplicity is read from the file. > + MaxMultiJobs is written in the file if there is no file. */ > +void read_multiplicity(void) > { > FILE *fd; > - int fh; > + int fh, multi; > char buf[1024]; > - int multi; > > fd = fopen(MULTIQUEUENUM, "r"); > if (fd == NULL) { > write_multiplicity(); > fd = fopen(MULTIQUEUENUM, "r"); > if (fd == NULL) { > - fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM); > + fprintf(stderr, "error: lxcf-sched: can't open %s\n", > + MULTIQUEUENUM); > exit(-1); > } > } > > - // lock QUEUE > + /* lock QUEUE */ > fh = fileno(fd); > flock(fh, LOCK_EX); > > buf[0] = 0; > multi = MaxMultiJobs; > - if (fgets(buf, 1024-1, fd) == NULL) { > + if (fgets(buf, 1024 - 1, fd) == NULL) { > write_multiplicity(); > } else { > - buf[1024-1] = 0; > - multi = (int)strtol(buf, NULL, 10); > + buf[1024 - 1] = 0; > + multi = (int) strtol(buf, NULL, 10); > if ((multi < 0) || (multi > MAXJOB)) { > multi = MaxMultiJobs; > } > @@ -123,90 +207,51 @@ void read_multiplicity() > } > MaxMultiJobs = multi; > > - // unlock QUEUE > + /* unlock QUEUE */ > flock(fh, LOCK_UN); > fclose(fd); > > return; > } > > -// Preservation to file of job when being executing it > -void set_exec_job(char* filequeue, pid_t pid, char* s) > +/* The multiplicity is preserved in the file. */ > +void write_multiplicity(void) > { > - FILE *fdh; > - int fh; > + FILE *fd; > + int fh; > > - // get job from QUEUE > - fdh = fopen(filequeue, "a"); > - if (fdh == NULL) { > - fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue); > + fd = fopen(MULTIQUEUENUM, "w"); > + if (fd == NULL) { > + fprintf(stderr, "error: lxcf-sched: can't open %s\n", > + MULTIQUEUENUM); > exit(-1); > } > > - // lock QUEUE > - fh = fileno(fdh); > + /* lock QUEUE */ > + fh = fileno(fd); > flock(fh, LOCK_EX); > > - fprintf(fdh, "%010d %s\n", pid, s); > - > - // unlock QUEUE > - flock(fh, LOCK_UN); > - fclose(fdh); > - > - return; > -} > - > -// Deletion from file of completion job > -void clear_exec_job(char* filename, pid_t pid) > -{ > - char buf[4096]; > - snprintf(buf, 4096-1, > - "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s", > - filename, pid, filename); > - buf[4096-1] = 0; > - if (system(buf) == -1) { > - printf("error: system function\n"); > + if (ftruncate(fh, 0) == -1) { > + fprintf(stderr, "error: lxcf-sched: ftrancate\n"); > } > -} > > -// exec of a job > -void lxcf_ex(char *arg) > -{ > - execlp("/bin/sh", "sh", "-c", arg, NULL); > - fprintf(stderr, "error: exec %s\n", arg); > - exit(-1); > -} > - > -void cmd_exec(char *cmd) > -{ > - lxcf_ex(cmd); > -} > + fprintf(fd, "%d", MaxMultiJobs); > > -char* date_time() > -{ > - time_t timer; > - struct tm *timep; > - char *s; > + /* unlock QUEUE */ > + flock(fh, LOCK_UN); > + fclose(fd); > > - time(&timer); > - timep = localtime(&timer); > - s = asctime(timep); > - if (s[strlen(s)-1] == '\n') { > - s[strlen(s)-1] = 0; > - } > - return s; > + return; > } > > -// salvage completion jobs > -int job_cleanup() > +/* salvage completion jobs */ > +int job_cleanup(void) > { > - int i, jobs; > pid_t p; > - int status; > - > + int status, i, jobs; > + > p = waitpid(0, &status, WNOHANG); > - jobs = 0; > - for(i=0; i<MAXJOB; i++) { > + for (i = jobs = 0; i < MAXJOB; i++) { > if (JobPid[i] == 0) { > continue; > } > @@ -221,255 +266,218 @@ int job_cleanup() > } > } > > - return jobs; > + return jobs; > } > > +/* Deletion from file of completion job */ > +void clear_exec_job(char *filename, pid_t pid) > +{ > + char buf[4096]; > > -void fork_multi_job(char *cmd) > + snprintf(buf, 4096 - 1, > + "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s", > + filename, pid, filename); > + buf[4096 - 1] = 0; > + if (system(buf) == -1) { > + printf("error: system function\n"); > + } > +} > + > +char *get_job(void) > { > - int pid; > - int i; > - int jobs=0; > - > - // spawn job > - pid = fork(); > - if (pid < 0) { > - printf("### fork ERROR ###\n"); > - } else if (pid == 0) { // child proccess > - cmd_exec(cmdbuf); > - exit(0); > - } else { // parent process > - set_exec_job(EXJOB, pid, cmd); > - for (i=0; i<MAXJOB; i++) { > - if (JobPid[i] == 0) { > - JobPid[i] = pid; > - break; > - } > - } > + char *s; > + > + s = get_job_queue(HQUEUE); > + if (s != NULL) { > + printf("### %s H-QUEUE: %s ###\n", date_time(), s); > + fflush(stdout), fflush(stderr); > + return s; > } > - > - for(;;) { > - // It loops until becoming empty JobPid. > - read_multiplicity(); > > - jobs = job_cleanup(); > + s = get_job_queue(QQUEUE); > + if (s != NULL) { > + printf("### %s Q-QUEUE: %s ###\n", date_time(), s); > + fflush(stdout), fflush(stderr); > + return s; > + } > > - // The multiplicity has been eased. > - if (jobs < MaxMultiJobs) { > - break; > - } > - sleep(1); > + s = get_job_queue(LQUEUE); > + if (s != NULL) { > + printf("### %s L-QUEUE: %s ###\n", date_time(), s); > + fflush(stdout), fflush(stderr); > + return s; > } > + > + return NULL; > } > > -char* get_job_queue(char* filequeue) > +char *get_job_queue(char *filequeue) > { > FILE *fdh; > - int fh; > - int i, j; > - int maxqueue, c; > + int fh, maxqueue, c, i, j; > > - // get job from QUEUE > + /* get job from QUEUE */ > fdh = fopen(filequeue, "r"); > if (fdh == NULL) { > - fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue); > + fprintf(stderr, "error: lxcf-sched: can't open %s\n", > + filequeue); > return NULL; > } > > - // lock QUEUE > + /* lock QUEUE */ > fh = fileno(fdh); > flock(fh, LOCK_EX); > > - // count jobfile lines > - for (maxqueue = 0;;) { > - if ((c = fgetc(fdh)) == '\n') { > + /* count jobfile lines */ > + maxqueue = 0; > + while (1) { > + c = fgetc(fdh); > + if (c == '\n') { > maxqueue++; > } else if (c == EOF) { > break; > } > } > rewind(fdh); > - > - // The buffer where the job is put is allocated. > - buf = (char*)malloc(maxqueue*MAXBUF); > - > - // get all QUEUE > + > + /* The buffer where the job is put is allocated. */ > + buf = (char *) malloc(maxqueue * MAXBUF); > + > + /* get all QUEUE */ > for (i = 0; i < maxqueue; i++) { > - if (fgets(&buf[i*MAXBUF], MAXBUF-1, fdh) == NULL) { > - buf[maxqueue*MAXBUF-1] = 0; > + if (fgets(&buf[i * MAXBUF], MAXBUF - 1, fdh) == NULL) { > + buf[maxqueue * MAXBUF - 1] = 0; > break; > } > - buf[(i+1)*MAXBUF-1] = 0; > + buf[(i + 1) * MAXBUF - 1] = 0; > } > - > - // find job in QUEUE > + > + /* find job in QUEUE */ > if (i != 0) { > fdh = freopen(filequeue, "w", fdh); > if (fdh == NULL) { > - fprintf(stderr, "error: lxcf-sched : can't re-open %s\n", filequeue); > + fprintf(stderr, "error: lxcf-sched: " > + "can't re-open %s\n", filequeue); > return NULL; > } > - > + > for (j = 1; j < i; j++) { > - fprintf(fdh, "%s", &buf[j*MAXBUF]); > + fprintf(fdh, "%s", &buf[j * MAXBUF]); > } > > - // unlock QUEUE > + /* unlock QUEUE */ > flock(fh, LOCK_UN); > fclose(fdh); > > - // The first job is put in jobbuf. > - strncpy(jobbuf, buf, MAXBUF-1); > - jobbuf[strlen(jobbuf)-1] = 0; > - > - // free buf > + /* The first job is put in jobbuf. */ > + strncpy(jobbuf, buf, MAXBUF - 1); > + jobbuf[strlen(jobbuf) - 1] = 0; > + > + /* free buf */ > free(buf); > buf = NULL; > - > + > return jobbuf; > } > - > - // unlock QUEUE > + > + /* unlock QUEUE */ > flock(fh, LOCK_UN); > fclose(fdh); > > - // free buf > + /* free buf */ > free(buf); > > - // Because the job is not found, NULL is returned. > + /* Because the job is not found, NULL is returned. */ > return NULL; > } > > -char *get_job() > +char *date_time(void) > { > + time_t timer; > + struct tm *timep; > char *s; > - > - s = get_job_queue(HQUEUE); > - if (s != NULL) { > - printf("### %s H-QUEUE : %s ###\n", date_time(), s); > - fflush(stdout); > - fflush(stderr); > - return s; > - } > - > - s = get_job_queue(QQUEUE); > - if (s != NULL) { > - printf("### %s Q-QUEUE : %s ###\n", date_time(), s); > - fflush(stdout); > - fflush(stderr); > - return s; > - } > > - s = get_job_queue(LQUEUE); > - if (s != NULL) { > - printf("### %s L-QUEUE : %s ###\n", date_time(), s); > - fflush(stdout); > - fflush(stderr); > - return s; > + time(&timer); > + timep = localtime(&timer); > + s = asctime(timep); > + if (s[strlen(s) - 1] == '\n') { > + s[strlen(s) - 1] = 0; > } > - > - return NULL; > + return s; > } > > -void launch_job() > +void fork_multi_job(char *cmd) > { > - char *s; > - int i; > - int r; > - > - while(1) { > - // A broken container is found, and it erases it. > - r = system("/usr/lib64/lxcf/lxcf-collection-broken-container"); > - if (r == -1) { > - printf("error: system function\n"); > - } > - > - sleep (1); > - > - read_multiplicity(); > + int pid, i, jobs; > > - job_cleanup(); > - > - // get a job from all queue > - s = get_job(); > - if (s == NULL) { > - continue; > - } > - > - for (i = 0; i < strlen(s); i++) { > - if (s[i] == ' ') { > - snprintf(cmdbuf, MAXBUF+16-1, "/usr/sbin/lxcf %s", &s[i]); > - cmdbuf[MAXBUF+16-1] = 0; > - > - fork_multi_job(s); > - > + /* spawn job */ > + pid = fork(); > + if (pid < 0) { > + printf("### fork ERROR ###\n"); > + } else if (pid == 0) { /* child proccess */ > + cmd_exec(cmdbuf); > + exit(0); > + } else { /* parent process */ > + set_exec_job(EXJOB, pid, cmd); > + for (i = 0; i < MAXJOB; i++) { > + if (JobPid[i] == 0) { > + JobPid[i] = pid; > break; > } > } > + } > > - printf("### %s JOB END ###\n", date_time()); > - fflush(stdout); > - fflush(stderr); > + while (1) { > + /* It loops until becoming empty JobPid. */ > + read_multiplicity(); > > + jobs = job_cleanup(); > + > + /* The multiplicity has been eased. */ > + if (jobs < MaxMultiJobs) { > + break; > + } > + sleep(1); > } > } > > -void usage() > +void cmd_exec(char *cmd) > { > - fprintf(stderr, "usage : lxcf-sched\n"); > - exit(-1); > + lxcf_ex(cmd); > } > > -void init() > +/* exec of a job */ > +void lxcf_ex(char *arg) > { > - pid_t i; > - FILE *fd; > - > - // clear exjob > - fd = fopen(EXJOB, "w"); > - if (fd != NULL) { > - fclose(fd); > - } > - > - // clear jobstatus > - for (i=0; i < MAXJOB; i++) { > - JobPid[i] = 0; > - } > + execlp("/bin/sh", "sh", "-c", arg, NULL); > + fprintf(stderr, "error: exec %s\n", arg); > + exit(-1); > } > > -int main(int argc, char **argv) > +/* Preservation to file of job when being executing it */ > +void set_exec_job(char *filequeue, pid_t pid, char *s) > { > - // euid check > - if (geteuid() != 0) { > - fprintf(stderr, "error: Because you are not root, you cannot execute this command. \n"); > - exit(-1); > - } > - > - // args check > - if (argc != 1) { > - usage(); > - } > + FILE *fdh; > + int fh; > > - // reopen stdout > - if (freopen(LXCF_LOG, "a", stdout) == NULL) { > - fprintf(stderr, "error: can't open %s\n",LXCF_LOG); > + /* get job from QUEUE */ > + fdh = fopen(filequeue, "a"); > + if (fdh == NULL) { > + fprintf(stderr, "error: lxcf-sched: can't open %s\n", > + filequeue); > exit(-1); > } > > - // reopen stderr > - if (freopen(LXCF_LOG, "a", stderr) == NULL) { > - fprintf(stderr, "error: can't open %s\n",LXCF_LOG); > - exit(-1); > - } > + /* lock QUEUE */ > + fh = fileno(fdh); > + flock(fh, LOCK_EX); > > - init(); > - > - launch_job(); > + fprintf(fdh, "%010d %s\n", pid, s); > > - // close stdout & stderr > - fclose(stdout); > - fclose(stderr); > - > - exit(0); > + /* unlock QUEUE */ > + flock(fh, LOCK_UN); > + fclose(fdh); > + > + return; > } > > -- > 1.9.0 > > ------------------------------------------------------------------------------ > The best possible search technologies are now affordable for all companies. > Download your FREE open source Enterprise Search Engine today! > Our experts will assist you in its installation for $59/mo, no commitment. > Test it for FREE on our Cloud platform anytime! > http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk > _______________________________________________ > Lxcfacility-allmail1 mailing list > Lxc...@li... > https://lists.sourceforge.net/lists/listinfo/lxcfacility-allmail1 |
|
From: TAMUKI S. <ta...@li...> - 2014-05-27 21:49:23
|
There are no logical changes, clean up only. Signed-off-by: TAMUKI Shoichi <ta...@li...> --- The patch has been revised due to lxcf-sched.c updated. The "// ..." style for comments is actually a C++ feature in origin. In GNU C, you may use C++ style comments, but many people, especially working with Linux, consider this harmful. In fact, the "Linux kernel coding style" clearly describes as follows: http://linuxjf.sourceforge.jp/JFdocs/kernel-docs-2.6/CodingStyle.html | Linux style for comments is the C89 "/* ... */" style. | Don't use C99-style "// ..." comments. To avoid being denied admittance by other reviewers, we should use C style comments. lxcf/src/lxcf-sched.c | 586 +++++++++++++++++++++++++------------------------- 1 file changed, 297 insertions(+), 289 deletions(-) diff --git a/lxcf/src/lxcf-sched.c b/lxcf/src/lxcf-sched.c index 706f9c8..231f662 100644 --- a/lxcf/src/lxcf-sched.c +++ b/lxcf/src/lxcf-sched.c @@ -1,28 +1,29 @@ /* -# LXCF - LXC Facility -# copyright (C) 2013-2014 FUJITSU LIMITED All Rights Reserved - -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; version 2 -# of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -# 02110-1301, USA. -*/ + * LXCF - LXC Facility + * Copyright (C) 2013-2014 FUJITSU LIMITED + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; version 2 + * of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + * + */ /* * lxcf batch scheduler * */ - + #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -31,89 +32,172 @@ #include <sys/file.h> #include <sys/wait.h> -// Control of multiplicity of job +/* Control of multiplicity of job */ #define MAXJOB 10 + int MaxMultiJobs = 1; pid_t JobPid[MAXJOB]; -// Setting of queue -#define HQUEUE "/var/lib/lxcf/hqueue" -#define QQUEUE "/var/lib/lxcf/qqueue" -#define LQUEUE "/var/lib/lxcf/lqueue" -#define EXJOB "/var/lib/lxcf/exjob" +/* Setting of queue */ +#define HQUEUE "/var/lib/lxcf/hqueue" +#define QQUEUE "/var/lib/lxcf/qqueue" +#define LQUEUE "/var/lib/lxcf/lqueue" +#define EXJOB "/var/lib/lxcf/exjob" -#define LXCF_LOG "/var/log/lxcf/lxcf-messages" -#define MAXBUF 4096 +#define LXCF_LOG "/var/log/lxcf/lxcf-messages" +#define MAXBUF 4096 -#define MULTIQUEUENUM "/etc/lxcf/multiqueue" +#define MULTIQUEUENUM "/etc/lxcf/multiqueue" -char *buf; -char jobbuf[MAXBUF]; -char cmdbuf[MAXBUF+16]; +char *buf; +char jobbuf[MAXBUF]; +char cmdbuf[MAXBUF + 16]; -void lxcf_ex(char *arg); -void set_exec_job(char *filename, pid_t pid, char* s); +void usage(void); +void init(void); +void launch_job(void); +void read_multiplicity(void); +void write_multiplicity(void); +int job_cleanup(void); void clear_exec_job(char *filename, pid_t pid); +char *get_job(void); +char *get_job_queue(char *filequeue); +char *date_time(void); +void fork_multi_job(char *cmd); +void cmd_exec(char *cmd); +void lxcf_ex(char *arg); +void set_exec_job(char *filequeue, pid_t pid, char *s); -// The multiplicity is preserved in the file. -void write_multiplicity() +int main(int argc, char **argv) { - FILE *fd; - int fh; + /* euid check */ + if (geteuid() != 0) { + fprintf(stderr, "error: Because you are not root, " + "you cannot execute this command.\n"); + exit(-1); + } - fd = fopen(MULTIQUEUENUM, "w"); - if (fd == NULL) { - fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM); + /* args check */ + if (argc != 1) { + usage(); + } + + /* reopen stdout */ + if (freopen(LXCF_LOG, "a", stdout) == NULL) { + fprintf(stderr, "error: can't open %s\n", LXCF_LOG); exit(-1); } - // lock QUEUE - fh = fileno(fd); - flock(fh, LOCK_EX); + /* reopen stderr */ + if (freopen(LXCF_LOG, "a", stderr) == NULL) { + fprintf(stderr, "error: can't open %s\n", LXCF_LOG); + exit(-1); + } - if (ftruncate(fh, 0) == -1) { - fprintf(stderr, "error: lxcf-sched : ftrancate\n"); + init(); + + launch_job(); + + /* close stdout & stderr */ + fclose(stdout), fclose(stderr); + + exit(0); +} + +void usage(void) +{ + fprintf(stderr, "usage: lxcf-sched\n"); + exit(-1); +} + +void init(void) +{ + FILE *fd; + pid_t i; + + /* clear exjob */ + fd = fopen(EXJOB, "w"); + if (fd != NULL) { + fclose(fd); } - fprintf(fd, "%d", MaxMultiJobs); + /* clear jobstatus */ + for (i = 0; i < MAXJOB; i++) { + JobPid[i] = 0; + } +} - // unlock QUEUE - flock(fh, LOCK_UN); - fclose(fd); +void launch_job(void) +{ + char *s; + int r, i; - return; + while (1) { + /* A broken container is found, and it erases it. */ + r = system("/usr/lib64/lxcf/lxcf-collection-broken-container"); + if (r == -1) { + printf("error: system function\n"); + } + + sleep(1); + + read_multiplicity(); + + job_cleanup(); + + /* get a job from all queue */ + s = get_job(); + if (s == NULL) { + continue; + } + + for (i = 0; i < strlen(s); i++) { + if (s[i] == ' ') { + snprintf(cmdbuf, MAXBUF + 16 - 1, + "/usr/sbin/lxcf %s", &s[i]); + cmdbuf[MAXBUF + 16 - 1] = 0; + + fork_multi_job(s); + + break; + } + } + + printf("### %s JOB END ###\n", date_time()); + fflush(stdout), fflush(stderr); + } } -// The multiplicity is read from the file. -// MaxMultiJobs is written in the file if there is no file. -void read_multiplicity() +/* The multiplicity is read from the file. + MaxMultiJobs is written in the file if there is no file. */ +void read_multiplicity(void) { FILE *fd; - int fh; + int fh, multi; char buf[1024]; - int multi; fd = fopen(MULTIQUEUENUM, "r"); if (fd == NULL) { write_multiplicity(); fd = fopen(MULTIQUEUENUM, "r"); if (fd == NULL) { - fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM); + fprintf(stderr, "error: lxcf-sched: can't open %s\n", + MULTIQUEUENUM); exit(-1); } } - // lock QUEUE + /* lock QUEUE */ fh = fileno(fd); flock(fh, LOCK_EX); buf[0] = 0; multi = MaxMultiJobs; - if (fgets(buf, 1024-1, fd) == NULL) { + if (fgets(buf, 1024 - 1, fd) == NULL) { write_multiplicity(); } else { - buf[1024-1] = 0; - multi = (int)strtol(buf, NULL, 10); + buf[1024 - 1] = 0; + multi = (int) strtol(buf, NULL, 10); if ((multi < 0) || (multi > MAXJOB)) { multi = MaxMultiJobs; } @@ -123,90 +207,51 @@ void read_multiplicity() } MaxMultiJobs = multi; - // unlock QUEUE + /* unlock QUEUE */ flock(fh, LOCK_UN); fclose(fd); return; } -// Preservation to file of job when being executing it -void set_exec_job(char* filequeue, pid_t pid, char* s) +/* The multiplicity is preserved in the file. */ +void write_multiplicity(void) { - FILE *fdh; - int fh; + FILE *fd; + int fh; - // get job from QUEUE - fdh = fopen(filequeue, "a"); - if (fdh == NULL) { - fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue); + fd = fopen(MULTIQUEUENUM, "w"); + if (fd == NULL) { + fprintf(stderr, "error: lxcf-sched: can't open %s\n", + MULTIQUEUENUM); exit(-1); } - // lock QUEUE - fh = fileno(fdh); + /* lock QUEUE */ + fh = fileno(fd); flock(fh, LOCK_EX); - fprintf(fdh, "%010d %s\n", pid, s); - - // unlock QUEUE - flock(fh, LOCK_UN); - fclose(fdh); - - return; -} - -// Deletion from file of completion job -void clear_exec_job(char* filename, pid_t pid) -{ - char buf[4096]; - snprintf(buf, 4096-1, - "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s", - filename, pid, filename); - buf[4096-1] = 0; - if (system(buf) == -1) { - printf("error: system function\n"); + if (ftruncate(fh, 0) == -1) { + fprintf(stderr, "error: lxcf-sched: ftrancate\n"); } -} -// exec of a job -void lxcf_ex(char *arg) -{ - execlp("/bin/sh", "sh", "-c", arg, NULL); - fprintf(stderr, "error: exec %s\n", arg); - exit(-1); -} - -void cmd_exec(char *cmd) -{ - lxcf_ex(cmd); -} + fprintf(fd, "%d", MaxMultiJobs); -char* date_time() -{ - time_t timer; - struct tm *timep; - char *s; + /* unlock QUEUE */ + flock(fh, LOCK_UN); + fclose(fd); - time(&timer); - timep = localtime(&timer); - s = asctime(timep); - if (s[strlen(s)-1] == '\n') { - s[strlen(s)-1] = 0; - } - return s; + return; } -// salvage completion jobs -int job_cleanup() +/* salvage completion jobs */ +int job_cleanup(void) { - int i, jobs; pid_t p; - int status; - + int status, i, jobs; + p = waitpid(0, &status, WNOHANG); - jobs = 0; - for(i=0; i<MAXJOB; i++) { + for (i = jobs = 0; i < MAXJOB; i++) { if (JobPid[i] == 0) { continue; } @@ -221,255 +266,218 @@ int job_cleanup() } } - return jobs; + return jobs; } +/* Deletion from file of completion job */ +void clear_exec_job(char *filename, pid_t pid) +{ + char buf[4096]; -void fork_multi_job(char *cmd) + snprintf(buf, 4096 - 1, + "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s", + filename, pid, filename); + buf[4096 - 1] = 0; + if (system(buf) == -1) { + printf("error: system function\n"); + } +} + +char *get_job(void) { - int pid; - int i; - int jobs=0; - - // spawn job - pid = fork(); - if (pid < 0) { - printf("### fork ERROR ###\n"); - } else if (pid == 0) { // child proccess - cmd_exec(cmdbuf); - exit(0); - } else { // parent process - set_exec_job(EXJOB, pid, cmd); - for (i=0; i<MAXJOB; i++) { - if (JobPid[i] == 0) { - JobPid[i] = pid; - break; - } - } + char *s; + + s = get_job_queue(HQUEUE); + if (s != NULL) { + printf("### %s H-QUEUE: %s ###\n", date_time(), s); + fflush(stdout), fflush(stderr); + return s; } - - for(;;) { - // It loops until becoming empty JobPid. - read_multiplicity(); - jobs = job_cleanup(); + s = get_job_queue(QQUEUE); + if (s != NULL) { + printf("### %s Q-QUEUE: %s ###\n", date_time(), s); + fflush(stdout), fflush(stderr); + return s; + } - // The multiplicity has been eased. - if (jobs < MaxMultiJobs) { - break; - } - sleep(1); + s = get_job_queue(LQUEUE); + if (s != NULL) { + printf("### %s L-QUEUE: %s ###\n", date_time(), s); + fflush(stdout), fflush(stderr); + return s; } + + return NULL; } -char* get_job_queue(char* filequeue) +char *get_job_queue(char *filequeue) { FILE *fdh; - int fh; - int i, j; - int maxqueue, c; + int fh, maxqueue, c, i, j; - // get job from QUEUE + /* get job from QUEUE */ fdh = fopen(filequeue, "r"); if (fdh == NULL) { - fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue); + fprintf(stderr, "error: lxcf-sched: can't open %s\n", + filequeue); return NULL; } - // lock QUEUE + /* lock QUEUE */ fh = fileno(fdh); flock(fh, LOCK_EX); - // count jobfile lines - for (maxqueue = 0;;) { - if ((c = fgetc(fdh)) == '\n') { + /* count jobfile lines */ + maxqueue = 0; + while (1) { + c = fgetc(fdh); + if (c == '\n') { maxqueue++; } else if (c == EOF) { break; } } rewind(fdh); - - // The buffer where the job is put is allocated. - buf = (char*)malloc(maxqueue*MAXBUF); - - // get all QUEUE + + /* The buffer where the job is put is allocated. */ + buf = (char *) malloc(maxqueue * MAXBUF); + + /* get all QUEUE */ for (i = 0; i < maxqueue; i++) { - if (fgets(&buf[i*MAXBUF], MAXBUF-1, fdh) == NULL) { - buf[maxqueue*MAXBUF-1] = 0; + if (fgets(&buf[i * MAXBUF], MAXBUF - 1, fdh) == NULL) { + buf[maxqueue * MAXBUF - 1] = 0; break; } - buf[(i+1)*MAXBUF-1] = 0; + buf[(i + 1) * MAXBUF - 1] = 0; } - - // find job in QUEUE + + /* find job in QUEUE */ if (i != 0) { fdh = freopen(filequeue, "w", fdh); if (fdh == NULL) { - fprintf(stderr, "error: lxcf-sched : can't re-open %s\n", filequeue); + fprintf(stderr, "error: lxcf-sched: " + "can't re-open %s\n", filequeue); return NULL; } - + for (j = 1; j < i; j++) { - fprintf(fdh, "%s", &buf[j*MAXBUF]); + fprintf(fdh, "%s", &buf[j * MAXBUF]); } - // unlock QUEUE + /* unlock QUEUE */ flock(fh, LOCK_UN); fclose(fdh); - // The first job is put in jobbuf. - strncpy(jobbuf, buf, MAXBUF-1); - jobbuf[strlen(jobbuf)-1] = 0; - - // free buf + /* The first job is put in jobbuf. */ + strncpy(jobbuf, buf, MAXBUF - 1); + jobbuf[strlen(jobbuf) - 1] = 0; + + /* free buf */ free(buf); buf = NULL; - + return jobbuf; } - - // unlock QUEUE + + /* unlock QUEUE */ flock(fh, LOCK_UN); fclose(fdh); - // free buf + /* free buf */ free(buf); - // Because the job is not found, NULL is returned. + /* Because the job is not found, NULL is returned. */ return NULL; } -char *get_job() +char *date_time(void) { + time_t timer; + struct tm *timep; char *s; - - s = get_job_queue(HQUEUE); - if (s != NULL) { - printf("### %s H-QUEUE : %s ###\n", date_time(), s); - fflush(stdout); - fflush(stderr); - return s; - } - - s = get_job_queue(QQUEUE); - if (s != NULL) { - printf("### %s Q-QUEUE : %s ###\n", date_time(), s); - fflush(stdout); - fflush(stderr); - return s; - } - s = get_job_queue(LQUEUE); - if (s != NULL) { - printf("### %s L-QUEUE : %s ###\n", date_time(), s); - fflush(stdout); - fflush(stderr); - return s; + time(&timer); + timep = localtime(&timer); + s = asctime(timep); + if (s[strlen(s) - 1] == '\n') { + s[strlen(s) - 1] = 0; } - - return NULL; + return s; } -void launch_job() +void fork_multi_job(char *cmd) { - char *s; - int i; - int r; - - while(1) { - // A broken container is found, and it erases it. - r = system("/usr/lib64/lxcf/lxcf-collection-broken-container"); - if (r == -1) { - printf("error: system function\n"); - } - - sleep (1); - - read_multiplicity(); + int pid, i, jobs; - job_cleanup(); - - // get a job from all queue - s = get_job(); - if (s == NULL) { - continue; - } - - for (i = 0; i < strlen(s); i++) { - if (s[i] == ' ') { - snprintf(cmdbuf, MAXBUF+16-1, "/usr/sbin/lxcf %s", &s[i]); - cmdbuf[MAXBUF+16-1] = 0; - - fork_multi_job(s); - + /* spawn job */ + pid = fork(); + if (pid < 0) { + printf("### fork ERROR ###\n"); + } else if (pid == 0) { /* child proccess */ + cmd_exec(cmdbuf); + exit(0); + } else { /* parent process */ + set_exec_job(EXJOB, pid, cmd); + for (i = 0; i < MAXJOB; i++) { + if (JobPid[i] == 0) { + JobPid[i] = pid; break; } } + } - printf("### %s JOB END ###\n", date_time()); - fflush(stdout); - fflush(stderr); + while (1) { + /* It loops until becoming empty JobPid. */ + read_multiplicity(); + jobs = job_cleanup(); + + /* The multiplicity has been eased. */ + if (jobs < MaxMultiJobs) { + break; + } + sleep(1); } } -void usage() +void cmd_exec(char *cmd) { - fprintf(stderr, "usage : lxcf-sched\n"); - exit(-1); + lxcf_ex(cmd); } -void init() +/* exec of a job */ +void lxcf_ex(char *arg) { - pid_t i; - FILE *fd; - - // clear exjob - fd = fopen(EXJOB, "w"); - if (fd != NULL) { - fclose(fd); - } - - // clear jobstatus - for (i=0; i < MAXJOB; i++) { - JobPid[i] = 0; - } + execlp("/bin/sh", "sh", "-c", arg, NULL); + fprintf(stderr, "error: exec %s\n", arg); + exit(-1); } -int main(int argc, char **argv) +/* Preservation to file of job when being executing it */ +void set_exec_job(char *filequeue, pid_t pid, char *s) { - // euid check - if (geteuid() != 0) { - fprintf(stderr, "error: Because you are not root, you cannot execute this command. \n"); - exit(-1); - } - - // args check - if (argc != 1) { - usage(); - } + FILE *fdh; + int fh; - // reopen stdout - if (freopen(LXCF_LOG, "a", stdout) == NULL) { - fprintf(stderr, "error: can't open %s\n",LXCF_LOG); + /* get job from QUEUE */ + fdh = fopen(filequeue, "a"); + if (fdh == NULL) { + fprintf(stderr, "error: lxcf-sched: can't open %s\n", + filequeue); exit(-1); } - // reopen stderr - if (freopen(LXCF_LOG, "a", stderr) == NULL) { - fprintf(stderr, "error: can't open %s\n",LXCF_LOG); - exit(-1); - } + /* lock QUEUE */ + fh = fileno(fdh); + flock(fh, LOCK_EX); - init(); - - launch_job(); + fprintf(fdh, "%010d %s\n", pid, s); - // close stdout & stderr - fclose(stdout); - fclose(stderr); - - exit(0); + /* unlock QUEUE */ + flock(fh, LOCK_UN); + fclose(fdh); + + return; } -- 1.9.0 |
|
From: niwa <niw...@jp...> - 2014-05-27 05:42:55
|
Hi, TAMUKI-san I adopt this patch. Thanks, niwa-hideyuki |
|
From: niwa <niw...@jp...> - 2014-05-27 05:33:55
|
Hi, TAMUKI-san I adopt this patch. Thanks, niwa-hideyuki |
|
From: TAMUKI S. <ta...@li...> - 2014-05-25 11:32:18
|
There are no logical changes, clean up only.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
lxcf/src/lxcf-sched.c | 574 +++++++++++++++++++++++++-------------------------
1 file changed, 292 insertions(+), 282 deletions(-)
diff --git a/lxcf/src/lxcf-sched.c b/lxcf/src/lxcf-sched.c
index b3a4b7e..44ba2ba 100644
--- a/lxcf/src/lxcf-sched.c
+++ b/lxcf/src/lxcf-sched.c
@@ -1,28 +1,29 @@
/*
-# LXCF - LXC Facility
-# copyright (C) 2013-2014 FUJITSU LIMITED All Rights Reserved
-
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-*/
+ * LXCF - LXC Facility
+ * Copyright (C) 2013-2014 FUJITSU LIMITED
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
/*
* lxcf batch scheduler
*
*/
-
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -31,89 +32,166 @@
#include <sys/file.h>
#include <sys/wait.h>
-// Control of multiplicity of job
+/* Control of multiplicity of job */
#define MAXJOB 10
+
int MaxMultiJobs = 1;
pid_t JobPid[MAXJOB];
-// Setting of queue
-#define HQUEUE "/var/lib/lxcf/hqueue"
-#define QQUEUE "/var/lib/lxcf/qqueue"
-#define LQUEUE "/var/lib/lxcf/lqueue"
-#define EXJOB "/var/lib/lxcf/exjob"
+/* Setting of queue */
+#define HQUEUE "/var/lib/lxcf/hqueue"
+#define QQUEUE "/var/lib/lxcf/qqueue"
+#define LQUEUE "/var/lib/lxcf/lqueue"
+#define EXJOB "/var/lib/lxcf/exjob"
-#define LXCF_LOG "/var/log/lxcf/lxcf-messages"
-#define MAXBUF 4096
+#define LXCF_LOG "/var/log/lxcf/lxcf-messages"
+#define MAXBUF 4096
-#define MULTIQUEUENUM "/etc/lxcf/multiqueue"
+#define MULTIQUEUENUM "/etc/lxcf/multiqueue"
-char *buf;
-char jobbuf[MAXBUF];
-char cmdbuf[MAXBUF+16];
+char *buf;
+char jobbuf[MAXBUF];
+char cmdbuf[MAXBUF + 16];
-void lxcf_ex(char *arg);
-void set_exec_job(char *filename, pid_t pid, char* s);
+void usage(void);
+void init(void);
+void launch_job(void);
+void read_multiplicity(void);
+void write_multiplicity(void);
+int job_cleanup(void);
void clear_exec_job(char *filename, pid_t pid);
+char *get_job(void);
+char *get_job_queue(char *filequeue);
+char *date_time(void);
+void fork_multi_job(char *cmd);
+void cmd_exec(char *cmd);
+void lxcf_ex(char *arg);
+void set_exec_job(char *filequeue, pid_t pid, char *s);
-// The multiplicity is preserved in the file.
-void write_multiplicity()
+int main(int argc, char **argv)
{
- FILE *fd;
- int fh;
+ /* euid check */
+ if (geteuid() != 0) {
+ fprintf(stderr, "error: Because you are not root, "
+ "you cannot execute this command.\n");
+ exit(-1);
+ }
- fd = fopen(MULTIQUEUENUM, "w");
- if (fd == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM);
+ /* args check */
+ if (argc != 1) {
+ usage();
+ }
+
+ /* reopen stdout */
+ if (freopen(LXCF_LOG, "a", stdout) == NULL) {
+ fprintf(stderr, "error: can't open %s\n", LXCF_LOG);
exit(-1);
}
- // lock QUEUE
- fh = fileno(fd);
- flock(fh, LOCK_EX);
+ /* reopen stderr */
+ if (freopen(LXCF_LOG, "a", stderr) == NULL) {
+ fprintf(stderr, "error: can't open %s\n", LXCF_LOG);
+ exit(-1);
+ }
- if (ftruncate(fh, 0) == -1) {
- fprintf(stderr, "error: lxcf-sched : ftrancate\n");
+ init();
+
+ launch_job();
+
+ /* close stdout & stderr */
+ fclose(stdout), fclose(stderr);
+
+ exit(0);
+}
+
+void usage(void)
+{
+ fprintf(stderr, "usage: lxcf-sched\n");
+ exit(-1);
+}
+
+void init(void)
+{
+ FILE *fd;
+ pid_t i;
+
+ /* clear exjob */
+ fd = fopen(EXJOB, "w");
+ if (fd != NULL) {
+ fclose(fd);
}
- fprintf(fd, "%d", MaxMultiJobs);
+ /* clear jobstatus */
+ for (i = 0; i < MAXJOB; i++) {
+ JobPid[i] = 0;
+ }
+}
- // unlock QUEUE
- flock(fh, LOCK_UN);
- fclose(fd);
+void launch_job(void)
+{
+ char *s;
+ int i;
- return;
+ while (1) {
+ sleep(1);
+
+ read_multiplicity();
+
+ job_cleanup();
+
+ /* get a job from all queue */
+ s = get_job();
+ if (s == NULL) {
+ continue;
+ }
+
+ for (i = 0; i < strlen(s); i++) {
+ if (s[i] == ' ') {
+ snprintf(cmdbuf, MAXBUF + 16 - 1,
+ "/usr/sbin/lxcf %s", &s[i]);
+ cmdbuf[MAXBUF + 16 - 1] = 0;
+
+ fork_multi_job(s);
+
+ break;
+ }
+ }
+
+ printf("### %s JOB END ###\n", date_time());
+ fflush(stdout), fflush(stderr);
+ }
}
-// The multiplicity is read from the file.
-// MaxMultiJobs is written in the file if there is no file.
-void read_multiplicity()
+/* The multiplicity is read from the file.
+ MaxMultiJobs is written in the file if there is no file. */
+void read_multiplicity(void)
{
FILE *fd;
- int fh;
+ int fh, multi;
char buf[1024];
- int multi;
fd = fopen(MULTIQUEUENUM, "r");
if (fd == NULL) {
write_multiplicity();
fd = fopen(MULTIQUEUENUM, "r");
if (fd == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM);
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ MULTIQUEUENUM);
exit(-1);
}
}
- // lock QUEUE
+ /* lock QUEUE */
fh = fileno(fd);
flock(fh, LOCK_EX);
buf[0] = 0;
multi = MaxMultiJobs;
- if (fgets(buf, 1024-1, fd) == NULL) {
+ if (fgets(buf, 1024 - 1, fd) == NULL) {
write_multiplicity();
} else {
- buf[1024-1] = 0;
- multi = (int)strtol(buf, NULL, 10);
+ buf[1024 - 1] = 0;
+ multi = (int) strtol(buf, NULL, 10);
if ((multi < 0) || (multi > MAXJOB)) {
multi = MaxMultiJobs;
}
@@ -123,90 +201,51 @@ void read_multiplicity()
}
MaxMultiJobs = multi;
- // unlock QUEUE
+ /* unlock QUEUE */
flock(fh, LOCK_UN);
fclose(fd);
return;
}
-// Preservation to file of job when being executing it
-void set_exec_job(char* filequeue, pid_t pid, char* s)
+/* The multiplicity is preserved in the file. */
+void write_multiplicity(void)
{
- FILE *fdh;
- int fh;
+ FILE *fd;
+ int fh;
- // get job from QUEUE
- fdh = fopen(filequeue, "a");
- if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue);
+ fd = fopen(MULTIQUEUENUM, "w");
+ if (fd == NULL) {
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ MULTIQUEUENUM);
exit(-1);
}
- // lock QUEUE
- fh = fileno(fdh);
+ /* lock QUEUE */
+ fh = fileno(fd);
flock(fh, LOCK_EX);
- fprintf(fdh, "%010d %s\n", pid, s);
-
- // unlock QUEUE
- flock(fh, LOCK_UN);
- fclose(fdh);
-
- return;
-}
-
-// Deletion from file of completion job
-void clear_exec_job(char* filename, pid_t pid)
-{
- char buf[4096];
- snprintf(buf, 4096-1,
- "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s",
- filename, pid, filename);
- buf[4096-1] = 0;
- if (system(buf) == -1) {
- printf("error: system function\n");
+ if (ftruncate(fh, 0) == -1) {
+ fprintf(stderr, "error: lxcf-sched: ftrancate\n");
}
-}
-
-// exec of a job
-void lxcf_ex(char *arg)
-{
- execlp("/bin/sh", "sh", "-c", arg, NULL);
- fprintf(stderr, "error: exec %s\n", arg);
- exit(-1);
-}
-void cmd_exec(char *cmd)
-{
- lxcf_ex(cmd);
-}
+ fprintf(fd, "%d", MaxMultiJobs);
-char* date_time()
-{
- time_t timer;
- struct tm *timep;
- char *s;
+ /* unlock QUEUE */
+ flock(fh, LOCK_UN);
+ fclose(fd);
- time(&timer);
- timep = localtime(&timer);
- s = asctime(timep);
- if (s[strlen(s)-1] == '\n') {
- s[strlen(s)-1] = 0;
- }
- return s;
+ return;
}
-// salvage completion jobs
-int job_cleanup()
+/* salvage completion jobs */
+int job_cleanup(void)
{
- int i, jobs;
pid_t p;
- int status;
-
+ int status, i, jobs;
+
p = waitpid(0, &status, WNOHANG);
- jobs = 0;
- for(i=0; i<MAXJOB; i++) {
+ for (i = jobs = 0; i < MAXJOB; i++) {
if (JobPid[i] == 0) {
continue;
}
@@ -221,247 +260,218 @@ int job_cleanup()
}
}
- return jobs;
+ return jobs;
}
+/* Deletion from file of completion job */
+void clear_exec_job(char *filename, pid_t pid)
+{
+ char buf[4096];
-void fork_multi_job(char *cmd)
+ snprintf(buf, 4096 - 1,
+ "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s",
+ filename, pid, filename);
+ buf[4096 - 1] = 0;
+ if (system(buf) == -1) {
+ printf("error: system function\n");
+ }
+}
+
+char *get_job(void)
{
- int pid;
- int i;
- int jobs=0;
-
- // spawn job
- pid = fork();
- if (pid < 0) {
- printf("### fork ERROR ###\n");
- } else if (pid == 0) { // child proccess
- cmd_exec(cmdbuf);
- exit(0);
- } else { // parent process
- set_exec_job(EXJOB, pid, cmd);
- for (i=0; i<MAXJOB; i++) {
- if (JobPid[i] == 0) {
- JobPid[i] = pid;
- break;
- }
- }
+ char *s;
+
+ s = get_job_queue(HQUEUE);
+ if (s != NULL) {
+ printf("### %s H-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
+ return s;
}
-
- for(;;) {
- // It loops until becoming empty JobPid.
- read_multiplicity();
- jobs = job_cleanup();
+ s = get_job_queue(QQUEUE);
+ if (s != NULL) {
+ printf("### %s Q-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
+ return s;
+ }
- // The multiplicity has been eased.
- if (jobs < MaxMultiJobs) {
- break;
- }
- sleep(1);
+ s = get_job_queue(LQUEUE);
+ if (s != NULL) {
+ printf("### %s L-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
+ return s;
}
+
+ return NULL;
}
-char* get_job_queue(char* filequeue)
+char *get_job_queue(char *filequeue)
{
FILE *fdh;
- int fh;
- int i, j;
- int maxqueue, c;
+ int fh, maxqueue, c, i, j;
- // get job from QUEUE
+ /* get job from QUEUE */
fdh = fopen(filequeue, "r");
if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue);
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ filequeue);
return NULL;
}
- // lock QUEUE
+ /* lock QUEUE */
fh = fileno(fdh);
flock(fh, LOCK_EX);
- // count jobfile lines
- for (maxqueue = 0;;) {
- if ((c = fgetc(fdh)) == '\n') {
+ /* count jobfile lines */
+ maxqueue = 0;
+ while (1) {
+ c = fgetc(fdh);
+ if (c == '\n') {
maxqueue++;
} else if (c == EOF) {
break;
}
}
rewind(fdh);
-
- // The buffer where the job is put is allocated.
- buf = (char*)malloc(maxqueue*MAXBUF);
-
- // get all QUEUE
+
+ /* The buffer where the job is put is allocated. */
+ buf = (char *) malloc(maxqueue * MAXBUF);
+
+ /* get all QUEUE */
for (i = 0; i < maxqueue; i++) {
- if (fgets(&buf[i*MAXBUF], MAXBUF-1, fdh) == NULL) {
- buf[maxqueue*MAXBUF-1] = 0;
+ if (fgets(&buf[i * MAXBUF], MAXBUF - 1, fdh) == NULL) {
+ buf[maxqueue * MAXBUF - 1] = 0;
break;
}
- buf[(i+1)*MAXBUF-1] = 0;
+ buf[(i + 1) * MAXBUF - 1] = 0;
}
-
- // find job in QUEUE
+
+ /* find job in QUEUE */
if (i != 0) {
fdh = freopen(filequeue, "w", fdh);
if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't re-open %s\n", filequeue);
+ fprintf(stderr, "error: lxcf-sched: "
+ "can't re-open %s\n", filequeue);
return NULL;
}
-
+
for (j = 1; j < i; j++) {
- fprintf(fdh, "%s", &buf[j*MAXBUF]);
+ fprintf(fdh, "%s", &buf[j * MAXBUF]);
}
- // unlock QUEUE
+ /* unlock QUEUE */
flock(fh, LOCK_UN);
fclose(fdh);
- // The first job is put in jobbuf.
- strncpy(jobbuf, buf, MAXBUF-1);
- jobbuf[strlen(jobbuf)-1] = 0;
-
- // free buf
+ /* The first job is put in jobbuf. */
+ strncpy(jobbuf, buf, MAXBUF - 1);
+ jobbuf[strlen(jobbuf) - 1] = 0;
+
+ /* free buf */
free(buf);
buf = NULL;
-
+
return jobbuf;
}
-
- // unlock QUEUE
+
+ /* unlock QUEUE */
flock(fh, LOCK_UN);
fclose(fdh);
- // free buf
+ /* free buf */
free(buf);
- // Because the job is not found, NULL is returned.
+ /* Because the job is not found, NULL is returned. */
return NULL;
}
-char *get_job()
+char *date_time(void)
{
+ time_t timer;
+ struct tm *timep;
char *s;
-
- s = get_job_queue(HQUEUE);
- if (s != NULL) {
- printf("### %s H-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
- return s;
- }
- s = get_job_queue(QQUEUE);
- if (s != NULL) {
- printf("### %s Q-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
- return s;
- }
-
- s = get_job_queue(LQUEUE);
- if (s != NULL) {
- printf("### %s L-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
- return s;
+ time(&timer);
+ timep = localtime(&timer);
+ s = asctime(timep);
+ if (s[strlen(s) - 1] == '\n') {
+ s[strlen(s) - 1] = 0;
}
-
- return NULL;
+ return s;
}
-void launch_job()
+void fork_multi_job(char *cmd)
{
- char *s;
- int i;
-
- while(1) {
- sleep (1);
+ int pid, i, jobs;
- read_multiplicity();
-
- job_cleanup();
-
- // get a job from all queue
- s = get_job();
- if (s == NULL) {
- continue;
- }
-
- for (i = 0; i < strlen(s); i++) {
- if (s[i] == ' ') {
- snprintf(cmdbuf, MAXBUF+16-1, "/usr/sbin/lxcf %s", &s[i]);
- cmdbuf[MAXBUF+16-1] = 0;
-
- fork_multi_job(s);
-
+ /* spawn job */
+ pid = fork();
+ if (pid < 0) {
+ printf("### fork ERROR ###\n");
+ } else if (pid == 0) { /* child proccess */
+ cmd_exec(cmdbuf);
+ exit(0);
+ } else { /* parent process */
+ set_exec_job(EXJOB, pid, cmd);
+ for (i = 0; i < MAXJOB; i++) {
+ if (JobPid[i] == 0) {
+ JobPid[i] = pid;
break;
}
}
+ }
- printf("### %s JOB END ###\n", date_time());
- fflush(stdout);
- fflush(stderr);
+ while (1) {
+ /* It loops until becoming empty JobPid. */
+ read_multiplicity();
+
+ jobs = job_cleanup();
+
+ /* The multiplicity has been eased. */
+ if (jobs < MaxMultiJobs) {
+ break;
+ }
+ sleep(1);
}
}
-void usage()
+void cmd_exec(char *cmd)
{
- fprintf(stderr, "usage : lxcf-sched\n");
- exit(-1);
+ lxcf_ex(cmd);
}
-void init()
+/* exec of a job */
+void lxcf_ex(char *arg)
{
- pid_t i;
- FILE *fd;
-
- // clear exjob
- fd = fopen(EXJOB, "w");
- if (fd != NULL) {
- fclose(fd);
- }
-
- // clear jobstatus
- for (i=0; i < MAXJOB; i++) {
- JobPid[i] = 0;
- }
+ execlp("/bin/sh", "sh", "-c", arg, NULL);
+ fprintf(stderr, "error: exec %s\n", arg);
+ exit(-1);
}
-int main(int argc, char **argv)
+/* Preservation to file of job when being executing it */
+void set_exec_job(char *filequeue, pid_t pid, char *s)
{
- // euid check
- if (geteuid() != 0) {
- fprintf(stderr, "error: Because you are not root, you cannot execute this command. \n");
- exit(-1);
- }
-
- // args check
- if (argc != 1) {
- usage();
- }
+ FILE *fdh;
+ int fh;
- // reopen stdout
- if (freopen(LXCF_LOG, "a", stdout) == NULL) {
- fprintf(stderr, "error: can't open %s\n",LXCF_LOG);
+ /* get job from QUEUE */
+ fdh = fopen(filequeue, "a");
+ if (fdh == NULL) {
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ filequeue);
exit(-1);
}
- // reopen stderr
- if (freopen(LXCF_LOG, "a", stderr) == NULL) {
- fprintf(stderr, "error: can't open %s\n",LXCF_LOG);
- exit(-1);
- }
+ /* lock QUEUE */
+ fh = fileno(fdh);
+ flock(fh, LOCK_EX);
- init();
-
- launch_job();
+ fprintf(fdh, "%010d %s\n", pid, s);
- // close stdout & stderr
- fclose(stdout);
- fclose(stderr);
-
- exit(0);
+ /* unlock QUEUE */
+ flock(fh, LOCK_UN);
+ fclose(fdh);
+
+ return;
}
--
1.9.0
|
|
From: TAMUKI S. <ta...@li...> - 2014-05-25 10:59:17
|
If "DESTDIR" is something defined (i.e. making the package,) prevent displaying "Please reboot this system." Signed-off-by: TAMUKI Shoichi <ta...@li...> --- lxcf/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lxcf/Makefile b/lxcf/Makefile index 543ed79..4e7e2f6 100644 --- a/lxcf/Makefile +++ b/lxcf/Makefile @@ -61,7 +61,9 @@ endif install: src/lxcf-resource1 src/lxcf-sched doc/lxcf.1.gz install_lib_lxcf \ install_sbin_lxcf install_conf install_hooks install_man +ifeq ($(strip $(DESTDIR)),) @echo "Please reboot this system." +endif src/lxcf-resource1: src/lxcf-resource1.c .prepare $(CC) $(CFLAGS) -o $@ src/lxcf-resource1.c -- 1.9.0 |
|
From: TAMUKI S. <ta...@li...> - 2014-05-25 10:58:34
|
Brush up around UUID.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
lxcf/lib/lxcf-sysgen | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/lxcf/lib/lxcf-sysgen b/lxcf/lib/lxcf-sysgen
index f99a778..f58d4f5 100755
--- a/lxcf/lib/lxcf-sysgen
+++ b/lxcf/lib/lxcf-sysgen
@@ -139,15 +139,12 @@ lxcf_sysgen1() {
/usr/lib64/lxcf/lxcf-clearlog $LXCNAME
# UUID of queue is passed, if sysgen is called from job
- if [ -e /etc/lxcf/rsc/${i}/uuid ]; then
- UUID=""
- fi
+ [ -f /etc/lxcf/rsc/$LXCNAME/uuid ] && UUID=""
/usr/lib64/lxcf/lxcf-setup $VAL_SEPARATE $LXCNAME
- if [ -e /etc/lxcf/rsc/${i}/uuid -a x$UUID != x"" ]; then
- echo -n $UUID > /etc/lxcf/rsc/${i}/uuid
- fi
+ [ -f /etc/lxcf/rsc/$LXCNAME/uuid -a -n "$UUID" ] \
+ && echo "$UUID" > /etc/lxcf/rsc/$LXCNAME/uuid
UUID=""
/usr/lib64/lxcf/lxcf-define $LXCNAME
@@ -190,19 +187,15 @@ if [ ! -f /etc/hosts ] ; then
EOF
fi
-# Judges while executing the job.
-# UUID of the first job is passed from QUEUE when called from the job.
+# judge while executing the job
+# UUID of the first job is passed from QUEUE when called from the job
UUID=""
-PPPID=`ps -o pid,ppid | awk '{if ($1 == '${PPID}') print $2}'`
-PPPPID=`ps -o pid,ppid | awk '{if ($1 == '${PPPID}') print $2}'`
-QLINE=`egrep "^$PPPPID" /var/lib/lxcf/exjob`
-if [ $? -eq 0 ]; then
- UUID=`echo ${QLINE} | awk '{print $2}'`
-fi
-PPID_CMD=`ps --no-headers -o cmd ${PPID} | awk '{print $1}'`
-if [ x"${PPID_CMD}" = x"sysgen-n" ]; then
- UUID=""
+PPPID=`ps -o pid,ppid | awk "{if (\\$1 == $PPID) print \\$2}"`
+PPPPID=`ps -o pid,ppid | awk "{if (\\$1 == $PPPID) print \\$2}"`
+if QLINE=`grep "^$PPPPID" /var/lib/lxcf/exjob` ; then
+ UUID=`echo $QLINE | awk '{print $2}'`
fi
+[ "`ps -h -o comm $PPID`" == "sysgen-n" ] && UUID=""
# generate containers of args
for i in "$@" ; do lxcf_sysgen1 "$i" ; done
--
1.9.0
|
|
From: TAMUKI S. <ta...@li...> - 2014-05-25 10:58:12
|
Hello NIWA-san,
From: niwa <niw...@jp...>
Subject: Re: [Lxcfacility-allmail1] [PATCH 2/2] Clean up lxcf-sched.c
Date: Fri, 23 May 2014 16:31:30 +0900
> 1) Omission of parentheses {}
> I apply "{}" even by one statement. The purpose of this is to be safe.
> It is easy to correspond to addition/deletion and is correct.
>
> EX.
> if (a ==0) {
> b = 1;
> }
Well, I prefer not to use the style above. The "Linux kernel coding
style" also says "Do not unnecessarily use braces where a single
statement will do." However, if you insist, I will follow your
opinion. ;-)
> 2) Substitution in argument of function.
> I plan not to use it as much as possible though it might be concise.
> Parentheses increase, and it is easy to mistake.
>
> EX.
> if ((fdh = fopen(filequeue, "r")) == NULL) {
The style above is famous as frequently shown to us by the prophets
"Kernighan and Ritchie" and many people like that. However, if you
insist, I will follow your opinion. ;-)
> 3) "//" is changed to "/*".
> The necessity for the change is not understood.
> There is a reason if it is two or more lines. If it is one line,
> both are acceptable.
The "// ..." style for comments is actually a C++ feature in origin.
In GNU C, you may use C++ style comments, but many people, especially
working with Linux, consider this harmful. In fact, the "Linux kernel
coding style" clearly describes as follows:
http://linuxjf.sourceforge.jp/JFdocs/kernel-docs-2.6/CodingStyle.html
| Linux style for comments is the C89 "/* ... */" style.
| Don't use C99-style "// ..." comments.
For that reason, we should use C style comments.
> 4) Three tabs ahead of function name of function definition.
> It feels it strangely a little. Is there an advantage?
>
> EX.
> -char* get_job_queue(char* filequeue)
> +char *get_job_queue(char *filequeue)
I did that so as to align the set of function name, but that was not
so common. Sorry, my bad. I will restore to original style.
Thanks in advance.
Regards,
TAMUKI Shoichi
|
|
From: TAMUKI S. <ta...@li...> - 2014-05-25 10:57:43
|
Hello NIWA-san, From: niwa <niw...@jp...> Subject: Re: [Lxcfacility-allmail1] [PATCH 1/2] Improve lxcf-sysgen Date: Fri, 23 May 2014 16:00:41 +0900 > The processing of "ps -o pid and ppid" has been changed > into "/proc/$PPID/stat". > But, the process that has already ended according to timing > and does not exist is targeted. > In "ps", "" returns. However, the error occurs in > "/proc/$PPID/stat". Well, I don't know the situation that the PPID (the parent PID) does not exist. However I agree with you. I will send the revised patch soon. Thanks in advance. Regards, TAMUKI Shoichi |
|
From: niwa <niw...@jp...> - 2014-05-23 07:31:41
|
Hi, TAMUKI-san
I have reviewed this patch.
There is a difference between some problems and styles.
1) Omission of parentheses {}
I apply "{}" even by one statement. The purpose of this is to be safe.
It is easy to correspond to addition/deletion and is correct.
EX.
if (a ==0) {
b = 1;
}
2) Substitution in argument of function.
I plan not to use it as much as possible though it might be concise.
Parentheses increase, and it is easy to mistake.
EX.
if ((fdh = fopen(filequeue, "r")) == NULL) {
3) "//" is changed to "/*".
The necessity for the change is not understood.
There is a reason if it is two or more lines. If it is one line,
both are acceptable.
4) Three tabs ahead of function name of function definition.
It feels it strangely a little. Is there an advantage?
EX.
-char* get_job_queue(char* filequeue)
+char *get_job_queue(char *filequeue)
Thanks,
niwa-hideyuki
|
|
From: niwa <niw...@jp...> - 2014-05-23 07:00:56
|
Hi, TAMUKI-san
I have reviewed this patch.
There is a problems.
The processing of "ps -o pid and ppid" has been changed
into "/proc/$PPID/stat".
But, the process that has already ended according to timing
and does not exist is targeted.
In "ps", "" returns. However, the error occurs in
"/proc/$PPID/stat".
Ex.)When process 9685 does not exist, it becomes the following errors.
# awk '{print $4}' /proc/9685/stat
awk: fatal: cannot open file `/proc/9685/stat' for reading (No such file or directory)
Thanks,
niwa-hideyuki
|
|
From: TAMUKI S. <ta...@li...> - 2014-05-23 03:29:55
|
There are no logical changes, clean up only.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
lxcf/src/lxcf-sched.c | 649 ++++++++++++++++++++++++--------------------------
1 file changed, 312 insertions(+), 337 deletions(-)
diff --git a/lxcf/src/lxcf-sched.c b/lxcf/src/lxcf-sched.c
index d60f2cb..65108bf 100644
--- a/lxcf/src/lxcf-sched.c
+++ b/lxcf/src/lxcf-sched.c
@@ -1,219 +1,241 @@
/*
-# LXCF - LXC Facility
-# copyright (C) 2013-2014 FUJITSU LIMITED All Rights Reserved
-
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; version 2
-# of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-*/
+ * LXCF - LXC Facility
+ * Copyright (C) 2013-2014 FUJITSU LIMITED
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ */
/*
* lxcf batch scheduler
*
*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <string.h>
-#include <time.h>
-#include <sys/file.h>
-#include <sys/wait.h>
-
-// Control of multiplicity of job
-#define MAXJOB 10
-int MaxMultiJobs = 1;
-pid_t JobPid[MAXJOB];
-
-// Setting of queue
-#define HQUEUE "/var/tmp/lxcf/hqueue"
-#define QQUEUE "/var/tmp/lxcf/qqueue"
-#define LQUEUE "/var/tmp/lxcf/lqueue"
-#define EXJOB "/var/tmp/lxcf/exjob"
-
-#define LXCF_LOG "/var/log/lxcf/lxcf-messages"
-#define MAXBUF 4096
-
-#define MULTIQUEUENUM "/etc/lxcf/multiqueue"
-
-char *buf;
-char jobbuf[MAXBUF];
-char cmdbuf[MAXBUF+16];
-
-void lxcf_ex(char *arg);
-void set_exec_job(char *filename, pid_t pid, char* s);
-void clear_exec_job(char *filename, pid_t pid);
-
-// The multiplicity is preserved in the file.
-void write_multiplicity()
-{
- FILE *fd;
- int fh;
- fd = fopen(MULTIQUEUENUM, "w");
- if (fd == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM);
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <time.h>
+#include <sys/file.h>
+#include <sys/wait.h>
+
+/* Control of multiplicity of job */
+#define MAXJOB 10
+
+int MaxMultiJobs = 1;
+pid_t JobPid[MAXJOB];
+
+/* Setting of queue */
+#define HQUEUE "/var/tmp/lxcf/hqueue"
+#define QQUEUE "/var/tmp/lxcf/qqueue"
+#define LQUEUE "/var/tmp/lxcf/lqueue"
+#define EXJOB "/var/tmp/lxcf/exjob"
+
+#define LXCF_LOG "/var/log/lxcf/lxcf-messages"
+#define MAXBUF 4096
+
+#define MULTIQUEUENUM "/etc/lxcf/multiqueue"
+
+char *buf;
+char jobbuf[MAXBUF];
+char cmdbuf[MAXBUF + 16];
+
+void usage(void);
+void init(void);
+void launch_job(void);
+void read_multiplicity(void);
+void write_multiplicity(void);
+int job_cleanup(void);
+void clear_exec_job(char *filename, pid_t pid);
+char *get_job(void);
+char *get_job_queue(char *filequeue);
+char *date_time(void);
+void fork_multi_job(char *cmd);
+void cmd_exec(char *cmd);
+void lxcf_ex(char *arg);
+void set_exec_job(char *filequeue, pid_t pid, char *s);
+
+int main(int argc, char **argv)
+{
+ /* euid check */
+ if (geteuid() != 0) {
+ fprintf(stderr, "error: Because you are not root, "
+ "you cannot execute this command.\n");
exit(-1);
}
- // lock QUEUE
- fh = fileno(fd);
- flock(fh, LOCK_EX);
+ /* args check */
+ if (argc != 1)
+ usage();
- if (ftruncate(fh, 0) == -1) {
- fprintf(stderr, "error: lxcf-sched : ftrancate\n");
+ /* reopen stdout */
+ if (freopen(LXCF_LOG, "a", stdout) == NULL) {
+ fprintf(stderr, "error: can't open %s\n", LXCF_LOG);
+ exit(-1);
}
- fprintf(fd, "%d", MaxMultiJobs);
+ /* reopen stderr */
+ if (freopen(LXCF_LOG, "a", stderr) == NULL) {
+ fprintf(stderr, "error: can't open %s\n", LXCF_LOG);
+ exit(-1);
+ }
- // unlock QUEUE
- flock(fh, LOCK_UN);
- fclose(fd);
+ init();
- return;
+ launch_job();
+
+ /* close stdout & stderr */
+ fclose(stdout), fclose(stderr);
+
+ exit(0);
+}
+
+void usage(void)
+{
+ fprintf(stderr, "usage: lxcf-sched\n");
+ exit(-1);
+}
+
+void init(void)
+{
+ FILE *fd;
+ pid_t i;
+
+ /* clear exjob */
+ if ((fd = fopen(EXJOB, "w")) != NULL)
+ fclose(fd);
+
+ /* clear jobstatus */
+ for (i = 0; i < MAXJOB; i++)
+ JobPid[i] = 0;
}
-// The multiplicity is read from the file.
-// MaxMultiJobs is written in the file if there is no file.
-void read_multiplicity()
+void launch_job(void)
{
- FILE *fd;
- int fh;
- char buf[1024];
- int multi;
+ char *s;
+ int i;
+
+ while (1) {
+ sleep(1);
+
+ read_multiplicity();
+
+ job_cleanup();
+
+ /* get a job from all queue */
+ if ((s = get_job()) == NULL)
+ continue;
+
+ for (i = 0; i < strlen(s); i++)
+ if (s[i] == ' ') {
+ snprintf(cmdbuf, MAXBUF + 16 - 1,
+ "/usr/sbin/lxcf %s", &s[i]);
+ cmdbuf[MAXBUF + 16 - 1] = 0;
+
+ fork_multi_job(s);
+
+ break;
+ }
- fd = fopen(MULTIQUEUENUM, "r");
- if (fd == NULL) {
+ printf("### %s JOB END ###\n", date_time());
+ fflush(stdout), fflush(stderr);
+ }
+}
+
+/* The multiplicity is read from the file.
+ MaxMultiJobs is written in the file if there is no file. */
+void read_multiplicity(void)
+{
+ FILE *fd;
+ int fh, multi;
+ char buf[1024];
+
+ if ((fd = fopen(MULTIQUEUENUM, "r")) == NULL) {
write_multiplicity();
- fd = fopen(MULTIQUEUENUM, "r");
- if (fd == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", MULTIQUEUENUM);
+ if ((fd = fopen(MULTIQUEUENUM, "r")) == NULL) {
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ MULTIQUEUENUM);
exit(-1);
}
}
- // lock QUEUE
- fh = fileno(fd);
- flock(fh, LOCK_EX);
+ /* lock QUEUE */
+ flock((fh = fileno(fd)), LOCK_EX);
buf[0] = 0;
multi = MaxMultiJobs;
- if (fgets(buf, 1024-1, fd) == NULL) {
+ if (fgets(buf, 1024 - 1, fd) == NULL)
write_multiplicity();
- } else {
- buf[1024-1] = 0;
- multi = (int)strtol(buf, NULL, 10);
- if ((multi < 0) || (multi > MAXJOB)) {
+ else {
+ buf[1024 - 1] = 0;
+ multi = (int) strtol(buf, NULL, 10);
+ if ((multi < 0) || (multi > MAXJOB))
multi = MaxMultiJobs;
- }
}
- if (multi <= 0) {
+ if (multi <= 0)
multi = 1;
- }
MaxMultiJobs = multi;
- // unlock QUEUE
+ /* unlock QUEUE */
flock(fh, LOCK_UN);
fclose(fd);
return;
}
-// Preservation to file of job when being executing it
-void set_exec_job(char* filequeue, pid_t pid, char* s)
+/* The multiplicity is preserved in the file. */
+void write_multiplicity(void)
{
- FILE *fdh;
- int fh;
+ FILE *fd;
+ int fh;
- // get job from QUEUE
- fdh = fopen(filequeue, "a");
- if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue);
+ if ((fd = fopen(MULTIQUEUENUM, "w")) == NULL) {
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ MULTIQUEUENUM);
exit(-1);
}
- // lock QUEUE
- fh = fileno(fdh);
- flock(fh, LOCK_EX);
+ /* lock QUEUE */
+ flock((fh = fileno(fd)), LOCK_EX);
- fprintf(fdh, "%010d %s\n", pid, s);
+ if (ftruncate(fh, 0) == -1)
+ fprintf(stderr, "error: lxcf-sched: ftrancate\n");
- // unlock QUEUE
+ fprintf(fd, "%d", MaxMultiJobs);
+
+ /* unlock QUEUE */
flock(fh, LOCK_UN);
- fclose(fdh);
+ fclose(fd);
return;
}
-// Deletion from file of completion job
-void clear_exec_job(char* filename, pid_t pid)
-{
- char buf[4096];
- snprintf(buf, 4096-1,
- "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s",
- filename, pid, filename);
- buf[4096-1] = 0;
- if (system(buf) == -1) {
- printf("error: system function\n");
- }
-}
-
-// exec of a job
-void lxcf_ex(char *arg)
+/* salvage completion jobs */
+int job_cleanup(void)
{
- execlp("/bin/sh", "sh", "-c", arg, NULL);
- fprintf(stderr, "error: exec %s\n", arg);
- exit(-1);
-}
+ pid_t p;
+ int status, i, jobs;
-void cmd_exec(char *cmd)
-{
- lxcf_ex(cmd);
-}
-
-char* date_time()
-{
- time_t timer;
- struct tm *timep;
- char *s;
-
- time(&timer);
- timep = localtime(&timer);
- s = asctime(timep);
- if (s[strlen(s)-1] == '\n') {
- s[strlen(s)-1] = 0;
- }
- return s;
-}
-
-// salvage completion jobs
-int job_cleanup()
-{
- int i, jobs;
- pid_t p;
- int status;
-
p = waitpid(0, &status, WNOHANG);
- jobs = 0;
- for(i=0; i<MAXJOB; i++) {
- if (JobPid[i] == 0) {
+ for (i = 0, jobs = 0; i < MAXJOB; i++) {
+ if (JobPid[i] == 0)
continue;
- }
jobs++;
- if (p != JobPid[i]) {
+ if (p != JobPid[i])
continue;
- }
if (WIFEXITED(status) || WIFSIGNALED(status)) {
clear_exec_job(EXJOB, p);
JobPid[i] = 0;
@@ -221,247 +243,200 @@ int job_cleanup()
}
}
- return jobs;
+ return jobs;
}
+/* Deletion from file of completion job */
+void clear_exec_job(char *filename, pid_t pid)
+{
+ char buf[4096];
-void fork_multi_job(char *cmd)
+ snprintf(buf, 4096 - 1,
+ "/usr/bin/flock %s /usr/bin/sed -i \"/^%010d/d\" %s",
+ filename, pid, filename);
+ buf[4096 - 1] = 0;
+ if (system(buf) == -1)
+ printf("error: system function\n");
+}
+
+char *get_job(void)
{
- int pid;
- int i;
- int jobs=0;
-
- // spawn job
- pid = fork();
- if (pid < 0) {
- printf("### fork ERROR ###\n");
- } else if (pid == 0) { // child proccess
- cmd_exec(cmdbuf);
- exit(0);
- } else { // parent process
- set_exec_job(EXJOB, pid, cmd);
- for (i=0; i<MAXJOB; i++) {
- if (JobPid[i] == 0) {
- JobPid[i] = pid;
- break;
- }
- }
+ char *s;
+
+ if ((s = get_job_queue(HQUEUE)) != NULL) {
+ printf("### %s H-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
+ return s;
}
-
- for(;;) {
- // It loops until becoming empty JobPid.
- read_multiplicity();
- jobs = job_cleanup();
+ if ((s = get_job_queue(QQUEUE)) != NULL) {
+ printf("### %s Q-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
+ return s;
+ }
- // The multiplicity has been eased.
- if (jobs < MaxMultiJobs) {
- break;
- }
- sleep(1);
+ if ((s = get_job_queue(LQUEUE)) != NULL) {
+ printf("### %s L-QUEUE: %s ###\n", date_time(), s);
+ fflush(stdout), fflush(stderr);
+ return s;
}
+
+ return NULL;
}
-char* get_job_queue(char* filequeue)
+char *get_job_queue(char *filequeue)
{
- FILE *fdh;
- int fh;
- int i, j;
- int maxqueue, c;
-
- // get job from QUEUE
- fdh = fopen(filequeue, "r");
- if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't open %s\n", filequeue);
+ FILE *fdh;
+ int fh, maxqueue, c, i, j;
+
+ /* get job from QUEUE */
+ if ((fdh = fopen(filequeue, "r")) == NULL) {
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ filequeue);
exit(-1);
}
- // lock QUEUE
- fh = fileno(fdh);
- flock(fh, LOCK_EX);
+ /* lock QUEUE */
+ flock((fh = fileno(fdh)), LOCK_EX);
- // count jobfile lines
- for (maxqueue = 0;;) {
- if ((c = fgetc(fdh)) == '\n') {
+ /* count jobfile lines */
+ maxqueue = 0;
+ while (1)
+ if ((c = fgetc(fdh)) == '\n')
maxqueue++;
- } else if (c == EOF) {
+ else if (c == EOF)
break;
- }
- }
rewind(fdh);
-
- // The buffer where the job is put is allocated.
- buf = (char*)malloc(maxqueue*MAXBUF);
-
- // get all QUEUE
- for (i = 0; i < maxqueue; i++) {
- if (fgets(&buf[i*MAXBUF], MAXBUF-1, fdh) == NULL) {
- buf[maxqueue*MAXBUF-1] = 0;
+
+ /* The buffer where the job is put is allocated. */
+ buf = (char *) malloc(maxqueue * MAXBUF);
+
+ /* get all QUEUE */
+ for (i = 0; i < maxqueue; i++)
+ if (fgets(&buf[i * MAXBUF], MAXBUF - 1, fdh) == NULL) {
+ buf[maxqueue * MAXBUF - 1] = 0;
break;
}
- buf[(i+1)*MAXBUF-1] = 0;
- }
-
- // find job in QUEUE
+ buf[(i + 1) * MAXBUF - 1] = 0;
+
+ /* find job in QUEUE */
if (i != 0) {
- fdh = freopen(filequeue, "w", fdh);
- if (fdh == NULL) {
- fprintf(stderr, "error: lxcf-sched : can't re-open %s\n", filequeue);
+ if ((fdh = freopen(filequeue, "w", fdh)) == NULL) {
+ fprintf(stderr, "error: lxcf-sched: "
+ "can't re-open %s\n", filequeue);
exit(-1);
}
-
- for (j = 1; j < i; j++) {
- fprintf(fdh, "%s", &buf[j*MAXBUF]);
- }
- // unlock QUEUE
+ for (j = 1; j < i; j++)
+ fprintf(fdh, "%s", &buf[j * MAXBUF]);
+
+ /* unlock QUEUE */
flock(fh, LOCK_UN);
fclose(fdh);
- // The first job is put in jobbuf.
- strncpy(jobbuf, buf, MAXBUF-1);
- jobbuf[strlen(jobbuf)-1] = 0;
-
- // free buf
+ /* The first job is put in jobbuf. */
+ strncpy(jobbuf, buf, MAXBUF - 1);
+ jobbuf[strlen(jobbuf) - 1] = 0;
+
+ /* free buf */
free(buf);
buf = NULL;
-
+
return jobbuf;
}
-
- // unlock QUEUE
+
+ /* unlock QUEUE */
flock(fh, LOCK_UN);
fclose(fdh);
- // free buf
+ /* free buf */
free(buf);
- // Because the job is not found, NULL is returned.
+ /* Because the job is not found, NULL is returned. */
return NULL;
}
-char *get_job()
+char *date_time(void)
{
- char *s;
-
- s = get_job_queue(HQUEUE);
- if (s != NULL) {
- printf("### %s H-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
- return s;
- }
-
- s = get_job_queue(QQUEUE);
- if (s != NULL) {
- printf("### %s Q-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
- return s;
- }
+ time_t timer;
+ struct tm *timep;
+ char *s;
- s = get_job_queue(LQUEUE);
- if (s != NULL) {
- printf("### %s L-QUEUE : %s ###\n", date_time(), s);
- fflush(stdout);
- fflush(stderr);
- return s;
- }
-
- return NULL;
+ time(&timer);
+ timep = localtime(&timer);
+ s = asctime(timep);
+ if (s[strlen(s) - 1] == '\n')
+ s[strlen(s) - 1] = 0;
+ return s;
}
-void launch_job()
+void fork_multi_job(char *cmd)
{
- char *s;
- int i;
-
- while(1) {
- sleep (1);
-
- read_multiplicity();
-
- job_cleanup();
-
- // get a job from all queue
- s = get_job();
- if (s == NULL) {
- continue;
- }
-
- for (i = 0; i < strlen(s); i++) {
- if (s[i] == ' ') {
- snprintf(cmdbuf, MAXBUF+16-1, "/usr/sbin/lxcf %s", &s[i]);
- cmdbuf[MAXBUF+16-1] = 0;
+ int pid, i, jobs;
- fork_multi_job(s);
-
+ /* spawn job */
+ if ((pid = fork()) < 0)
+ printf("### fork ERROR ###\n");
+ else if (pid == 0) { /* child proccess */
+ cmd_exec(cmdbuf);
+ exit(0);
+ } else { /* parent process */
+ set_exec_job(EXJOB, pid, cmd);
+ for (i = 0; i < MAXJOB; i++)
+ if (JobPid[i] == 0) {
+ JobPid[i] = pid;
break;
}
- }
+ }
- printf("### %s JOB END ###\n", date_time());
- fflush(stdout);
- fflush(stderr);
+ while (1) {
+ /* It loops until becoming empty JobPid. */
+ read_multiplicity();
+
+ jobs = job_cleanup();
+
+ /* The multiplicity has been eased. */
+ if (jobs < MaxMultiJobs)
+ break;
+ sleep(1);
}
}
-void usage()
+void cmd_exec(char *cmd)
{
- fprintf(stderr, "usage : lxcf-sched\n");
- exit(-1);
+ lxcf_ex(cmd);
}
-void init()
+/* exec of a job */
+void lxcf_ex(char *arg)
{
- pid_t i;
- FILE *fd;
-
- // clear exjob
- fd = fopen(EXJOB, "w");
- if (fd != NULL) {
- fclose(fd);
- }
-
- // clear jobstatus
- for (i=0; i < MAXJOB; i++) {
- JobPid[i] = 0;
- }
+ execlp("/bin/sh", "sh", "-c", arg, NULL);
+ fprintf(stderr, "error: exec %s\n", arg);
+ exit(-1);
}
-int main(int argc, char **argv)
+/* Preservation to file of job when being executing it */
+void set_exec_job(char *filequeue, pid_t pid, char *s)
{
- // euid check
- if (geteuid() != 0) {
- fprintf(stderr, "error: Because you are not root, you cannot execute this command. \n");
- exit(-1);
- }
-
- // args check
- if (argc != 1) {
- usage();
- }
+ FILE *fdh;
+ int fh;
- // reopen stdout
- if (freopen(LXCF_LOG, "a", stdout) == NULL) {
- fprintf(stderr, "error: can't open %s\n",LXCF_LOG);
+ /* get job from QUEUE */
+ if ((fdh = fopen(filequeue, "a")) == NULL) {
+ fprintf(stderr, "error: lxcf-sched: can't open %s\n",
+ filequeue);
exit(-1);
}
- // reopen stderr
- if (freopen(LXCF_LOG, "a", stderr) == NULL) {
- fprintf(stderr, "error: can't open %s\n",LXCF_LOG);
- exit(-1);
- }
+ /* lock QUEUE */
+ flock((fh = fileno(fdh)), LOCK_EX);
- init();
-
- launch_job();
+ fprintf(fdh, "%010d %s\n", pid, s);
- // close stdout & stderr
- fclose(stdout);
- fclose(stderr);
-
- exit(0);
+ /* unlock QUEUE */
+ flock(fh, LOCK_UN);
+ fclose(fdh);
+
+ return;
}
--
1.9.0
|
|
From: TAMUKI S. <ta...@li...> - 2014-05-23 03:29:26
|
Brush up around UUID.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
lxcf/lib/lxcf-sysgen | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/lxcf/lib/lxcf-sysgen b/lxcf/lib/lxcf-sysgen
index 6744ad1..44bf09d 100755
--- a/lxcf/lib/lxcf-sysgen
+++ b/lxcf/lib/lxcf-sysgen
@@ -139,15 +139,12 @@ lxcf_sysgen1() {
/usr/lib64/lxcf/lxcf-clearlog $LXCNAME
# UUID of queue is passed, if sysgen is called from job
- if [ -e /etc/lxcf/rsc/${i}/uuid ]; then
- UUID=""
- fi
+ [ -f /etc/lxcf/rsc/$LXCNAME/uuid ] && UUID=""
/usr/lib64/lxcf/lxcf-setup $VAL_SEPARATE $LXCNAME
- if [ -e /etc/lxcf/rsc/${i}/uuid -a x$UUID != x"" ]; then
- echo -n $UUID > /etc/lxcf/rsc/${i}/uuid
- fi
+ [ -f /etc/lxcf/rsc/$LXCNAME/uuid -a -n "$UUID" ] \
+ && echo "$UUID" > /etc/lxcf/rsc/$LXCNAME/uuid
UUID=""
/usr/lib64/lxcf/lxcf-define $LXCNAME
@@ -190,19 +187,15 @@ if [ ! -f /etc/hosts ] ; then
EOF
fi
-# Judges while executing the job.
-# UUID of the first job is passed from QUEUE when called from the job.
+# judge while executing the job
+# UUID of the first job is passed from QUEUE when called from the job
UUID=""
-PPPID=`ps -o pid,ppid | awk '{if ($1 == '${PPID}') print $2}'`
-PPPPID=`ps -o pid,ppid | awk '{if ($1 == '${PPPID}') print $2}'`
-QLINE=`egrep "^$PPPPID" /var/tmp/lxcf/exjob`
-if [ $? -eq 0 ]; then
- UUID=`echo ${QLINE} | awk '{print $2}'`
-fi
-PPID_CMD=`ps --no-headers -o cmd ${PPID} | awk '{print $1}'`
-if [ x"${PPID_CMD}" = x"sysgen-n" ]; then
- UUID=""
+PPPID=`awk '{print $4}' /proc/$PPID/stat`
+PPPPID=`awk '{print $4}' /proc/$PPPID/stat`
+if QLINE=`grep "^$PPPPID" /var/tmp/lxcf/exjob` ; then
+ UUID=`echo $QLINE | awk '{print $2}'`
fi
+[ "`awk '{print $2}' /proc/$PPID/stat`" == "(sysgen-n)" ] && UUID=""
# generate containers of args
for i in "$@" ; do lxcf_sysgen1 "$i" ; done
--
1.9.0
|
|
From: niwa <niw...@jp...> - 2014-05-16 01:35:10
|
Hi, TAMUKI-san I adopt this patch. Thanks, niwa-hideyuki |
|
From: TAMUKI S. <ta...@li...> - 2014-05-15 21:04:44
|
Thanks to many suggestive comments by Fedora package reviewers, the
lxcf spec file has been brushed up to be simpler and arch-independent.
To proceed a step further, the lxcf package can now build into proper
rpms and work on architectures other than x86_64.
Signed-off-by: TAMUKI Shoichi <ta...@li...>
---
lxcf/lxcf.spec | 4 ++--
package/makepkg.sh | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lxcf/lxcf.spec b/lxcf/lxcf.spec
index 15053a8..cbbf9fb 100644
--- a/lxcf/lxcf.spec
+++ b/lxcf/lxcf.spec
@@ -28,10 +28,10 @@ collectively. Such stateless instance can be operated.
%build
CFLAGS=$RPM_OPT_FLAGS ; export CFLAGS
LDFLAGS=$RPM_OPT_FLAGS ; export LDFLAGS
-make %{?_smp_mflags}
+make %{?_smp_mflags} libdir=%_libdir
%install
-make install DESTDIR=$RPM_BUILD_ROOT
+make install libdir=%_libdir DESTDIR=$RPM_BUILD_ROOT
mkdir -p %{_var}/log/lxcf/
%preun
diff --git a/package/makepkg.sh b/package/makepkg.sh
index aa6c8c5..f16a5b1 100755
--- a/package/makepkg.sh
+++ b/package/makepkg.sh
@@ -8,7 +8,7 @@ rm -rf RPMS/*
rm -rf SRPMS/*
cd ../lxcf
-make clean
+make clean libdir=/usr/lib`[ $(uname -m) == x86_64 ] && echo 64`
cd ..
git clean -xdf
git set-file-times
--
1.9.0
|