-
Notifications
You must be signed in to change notification settings - Fork 850
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make clk id configurable #276
Conversation
Signed-off-by: Yang Keao <[email protected]>
Signed-off-by: Yang Keao <[email protected]>
Signed-off-by: Yang Keao <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #276 +/- ##
=======================================
Coverage 59.91% 59.91%
=======================================
Files 37 37
Lines 2018 2018
=======================================
Hits 1209 1209
Misses 714 714
Partials 95 95 Continue to review full report at Codecov.
|
@ethercflow PTAL |
clkIds := strings.Split(clockIdsSlice, ",") | ||
mask, err := utils.EncodeClkIds(clkIds) | ||
if err != nil { | ||
log.Error(err, "error while converting clock ids to mask") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use one log pkg uniformly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log
from controller-runtime
will bring in lots of flags about kubernetes, which is disappointing. And it uses zapr
too, so literally using this log
doesn't bring in any new dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got
cmd/watchmaker/main_linux.go
Outdated
mask, err := utils.EncodeClkIds(clkIds) | ||
if err != nil { | ||
log.Error(err, "error while converting clock ids to mask") | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
os.Exit(1)
@@ -41,5 +41,4 @@ Description: | |||
|
|||
* Time modification will only be injected into the main process of container | |||
* Time chaos has no effect on pure syscall `clock_gettime` | |||
* Only `CLOCK_REALTIME` will be modified. This is intended because modification on other clock such as `CLOCK_REALTIME_COARSE` (which go program uses to `time.Sleep`) will cause serious and deterministic problem. We should make it configurable in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should update this description instead of deleting it directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! I added description in former part
cmd/watchmaker/main_linux.go
Outdated
) | ||
|
||
func initFlag() { | ||
flag.IntVar(&pid, "pid", 0, "pid of target program") | ||
flag.Int64Var(&secDelta, "sec_delta", 0, "delta time of sec field") | ||
flag.Int64Var(&nsecDelta, "nsec_delta", 0, "delta time of nsec field") | ||
flag.StringVar(&clockIdsSlice, "clk_ids", "CLOCK_REALTIME", "affected clock ids") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fourth parameter may describe the split is ',' ?
@@ -137,14 +145,20 @@ func ModifyTime(pid int, deltaSec int64, deltaNsec int64) error { | |||
} | |||
fakeAddr := fakeEntry.StartAddress | |||
|
|||
// 115 is the index of TV_SEC_DELTA in fakeImage | |||
err = program.WriteUint64ToAddr(fakeAddr+115, uint64(deltaSec)) | |||
// 139 is the index of CLOCK_IDS_MASK in fakeImage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of the index does not match the 79 row's comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should modify 77-79 comments. They should follow the order of being used in program.
Signed-off-by: Yang Keao <[email protected]>
Signed-off-by: Yang Keao <[email protected]>
Signed-off-by: Yang Keao <[email protected]>
Signed-off-by: Yang Keao <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@ethercflow PTAL |
@YangKeao Fix conflicts |
Signed-off-by: Yang Keao <[email protected]>
Signed-off-by: Yang Keao <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
/run-all-tests |
@@ -19,7 +19,7 @@ controllerManager: | |||
replicaCount: 1 | |||
|
|||
image: pingcap/chaos-mesh:latest | |||
imagePullPolicy: Always | |||
imagePullPolicy: Never |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can I ask why this change to Never
?
Signed-off-by: Yang Keao [email protected]
What problem does this PR solve?
It makes the mask of affected
clk_id
configurable.What is changed and how does it work?
Add a new variable in
fake_clock_gettime
function.Check List
Tests
Code changes