Repository navigation
CLOUDSTACK-8616: Redundant VPC with both routers as Master #587
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
Changes from all commits
c35c666
c975185
c20b5f3
118d7b7
a635724
f4f4d11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,10 +35,9 @@ def load(self): | |
| self.new_config.append(line) | ||
| except IOError: | ||
| logging.debug("File %s does not exist" % self.filename) | ||
| return | ||
| else: | ||
| logging.debug("Reading file %s" % self.filename) | ||
| self.config = copy.deepcopy(self.new_config) | ||
| self.config = list(self.new_config) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copy.deepcopy may be a necessary evil, if the list new_config contains objects. I wrote an example to test this: https://gist.github.com/bhaisaab/fe85fb02e1a7fda2fd2d
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the way you put it, accessing the indexes, it changes both probably due to some reference. However, if one adds some other cases - mainly the uso of append(), as we have - you will see that it works. Check below:
Now, to show our complete use-case here: for l in file: config = list(new_config) Laters, for every new config item, we do: new_config.append(x) By using those operations we won't change the "config" variable. Another example:
What do you think?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, as I mentioned in my comment if the list contains (references to) other objects then only copy.deepcopy should be used. I was not clear about the usage, after reading the code I think it would work since we're working with list of strings (read from file), followed by append/insert operations; list() would be indeed faster than copy.deepcopy in this case as well. |
||
|
|
||
| def is_changed(self): | ||
| if set(self.config) != set(self.new_config): | ||
|
|
@@ -58,6 +57,7 @@ def repopulate(self): | |
|
|
||
| def commit(self): | ||
| if not self.is_changed(): | ||
| logging.info("Nothing to commit. The %s file did not change" % self.filename) | ||
| return | ||
| handle = open(self.filename, "w+") | ||
| for line in self.new_config: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,3 +51,6 @@ | |
|
|
||
| if options.backup: | ||
| red.set_backup() | ||
|
|
||
| if options.fault: | ||
| red.set_fault() | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,11 +22,11 @@ STRIKE_FILE="$ROUTER_BIN_PATH/keepalived.strikes" | |
|
|
||
| if [ -e $ROUTER_BIN_PATH/keepalived.ts2 ] | ||
| then | ||
| lasttime=$(cat $ROUTER_BIN_PATH/keepalived.ts2) | ||
| thistime=$(cat $ROUTER_BIN_PATH/keepalived.ts) | ||
| diff=$(($thistime - $lasttime)) | ||
| lasttime=$(cat $ROUTER_BIN_PATH/keepalived.ts2) | ||
| diff=$(($lasttime - $thistime)) | ||
| s=0 | ||
| if [ $diff -lt 30 ] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wilderrodrigues @rhtyd why there is a change in time comparison logic.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jayakarteek please refer master/4.11 for latest code, why are you commenting on this very old PR? |
||
| if [ $diff -ge 10 ] | ||
| then | ||
| if [ -e $STRIKE_FILE ] | ||
| then | ||
|
|
@@ -47,13 +47,14 @@ then | |
| if [ $s -gt 2 ] | ||
| then | ||
| echo Keepalived process is dead! >> $ROUTER_LOG | ||
| $ROUTER_BIN_PATH/services.sh stop >> $ROUTER_LOG 2>&1 | ||
| $ROUTER_BIN_PATH/disable_pubip.sh >> $ROUTER_LOG 2>&1 | ||
| $ROUTER_BIN_PATH/primary-backup.sh fault >> $ROUTER_LOG 2>&1 | ||
| service keepalived stop >> $ROUTER_LOG 2>&1 | ||
| service conntrackd stop >> $ROUTER_LOG 2>&1 | ||
| pkill -9 keepalived >> $ROUTER_LOG 2>&1 | ||
| pkill -9 conntrackd >> $ROUTER_LOG 2>&1 | ||
|
|
||
| #Set fault so we have the same effect as a KeepaliveD fault. | ||
| python /opt/cloud/bin/master.py --fault | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will running the script here block this shell script until it exists, or will it launch as a daemon? If it's blocking then it's alright.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep... it will block. |
||
|
|
||
| pkill -9 keepalived >> $ROUTER_LOG 2>&1 | ||
| pkill -9 conntrackd >> $ROUTER_LOG 2>&1 | ||
| echo Status: FAULT \(keepalived process is dead\) >> $ROUTER_LOG | ||
| exit | ||
| fi | ||
|
|
||
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.
Any package related change needs to go into: tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
AFAIK, this buildsystemvm script is not used or maintained by anyone
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.
That's a good point, @bhaisaab . I blindly trusted the script and did not check the version before. I just created a rVPC and checked the router to confirm that the version was not updated. I will fix that one, test and push to the PR.
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.
discussed with @wilderrodrigues : will add a note in this PR that this file is being phased out
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.
Added the following not to the file and will push it to the PR:
IMPORTANT REMARK
Package intallation is no longer done via this script. We are not removing the code yet, but we want to
make sure that everybody willing to install/update packages should refer to the file:
==> cloud-tools/appliance/definitions/systemvmtemplate/install_systemvm_packages.sh
Is it good enough?
Cheers,
Wilder