Older blog entries for etbe (starting at number 84)

Starting a Heartbeat Resource Without Heartbeat

The command crm_resource allows you to do basic editing of resources in the Heartbeat configuration database. But sometimes you need to do different things and the tool xmlstarlet is a good option.

The below script can be used for testing Heartbeat OCF resource scripts. It uses the Heartbeat management program cibadmin to get the XML configuration data and then uses xmlstarlet to process it. The sel option for xmlstarlet selects some data from an XML file, the -t -m options instruct it to match data from a template. The template is the /resources/primitive part. The --value-of expression will print the values of some labels from the XML. The script will concatenate the name and value tags and export them as environment variables (see my post about Configuring a Heartbeat Service for an explanation of the use of the variables). The TYPE variable is the name of the script under the /usr/lib/ocf/resource.d/heartbeat directory.

In recent versions of Heartbeat (2.1.x) the OCF_ROOT environment variable must be set before an OCF script is called. Setting it on older versions of Heartbeat doesn’t do any harm so I unconditionally set it in this script (which should work for all 2.x.x versions of Heartbeat).

The first parameter for the script is the id of the service to be operated on and the second parameter is the operation to perform (start, stop, and status are the only interesting values). The script will echo the exit code to the screen (0 means success, 7 means that the service is not running or the operation failed, and any other number means a serious error that will trigger a STONITH if Heartbeat gets it).

#!/bin/sh
$(cibadmin -Q -o resources| xmlstarlet sel -t -m \
"/resources/primitive [@id='$1']/instance_attributes/attributes/nvpair" \
--value-of "concat('export OCF_RESKEY_',@name,'=',@value,'
','TYPE=',../../../@type,'
')")
OCF_ROOT=/usr/lib/ocf /usr/lib/ocf/resource.d/heartbeat/$TYPE $2
echo $?

Below is another version of the same script that instead uses crm_resource to get the XML data. The output of crm_resource has a couple of lines of non-XML data at the start (removed by the grep) and also only gives the XML tree related to the primitive in question (so the /resources part is removed from the xmlstarlet command-line).

#!/bin/sh
$(crm_resource -r $1 -x | grep -v ^[a-z] | xmlstarlet sel -t -m \
  "/primitive/instance_attributes/attributes/nvpair" --value-of \
  "concat('export OCF_RESKEY_',@name,'=',@value,'
','TYPE=',../../../@type,'
')")
OCF_ROOT=/usr/lib/ocf /usr/lib/ocf/resource.d/heartbeat/$TYPE $2
echo $?

The problem with both of those scripts is that they rely on Heartbeat being operational. Performing any operations other than a status check while Heartbeat is running is a risky thing to do. If Heartbeat starts a service at the same time as you start it via such a script then the results will probably be undesired. One situation where it is safe to run this is when a service fails to start. After it has failed repeatedly Heartbeat may stop trying to restart it (depending on the configuration) in which case it will be safe to try and start it. Also you can put in temporary constraints to stop the resource from running by repeatedly running crm_resource -M -r ID until all nodes have been prohibited from running it (make sure you run crm_resource -U -r ID afterwards to remove the temporary constraints).

The following script does the same thing but directly reads the XML file for the Heartbeat configuration. This is designed to be used when Heartbeat is not running. For example you could copy the XML file from a running cluster to a test machine and then test your OCF resource scripts.

#!/bin/sh
$(cat /var/lib/heartbeat/crm/cib.xml| xmlstarlet sel -t -m \
  "/cib/configuration/resources/primitive [@id='$1']/instance_attributes/attributes/nvpair" \
  --value-of \
  "concat('export OCF_RESKEY_',@name,'=',@value,'
','TYPE=',../../../@type,'
')")
OCF_ROOT=/usr/lib/ocf /usr/lib/ocf/resource.d/heartbeat/$TYPE $2
echo $?

Share This

Syndicated 2007-08-02 21:00:40 from etbe

Xen Saves

A couple of days ago the hardware that is used to host this blog was upgraded - doubling the amount of RAM in the machine. To do this the machine was halted, memtest86+ was run to ensure that the new RAM worked correctly, and then it was booted up again. During that process my ssh session was not stopped! I merely refrained from typing anything until the upgrade was complete.

This is one feature I really like about Xen. It can save the memory image of a running domain to a file and then restart it later. TCP sessions remain open if timeouts have not elapsed. The command xm save can be used to save the state to a file and the command xm restore will restore it.

In Debian the location of the save files is stored in the file /etc/default/xendomains with the variable name XENDOMAINS_SAVE and defaults to /var/lib/xen/save.

A quick experiment with one test domain (running Debian/unstable in 128M of RAM and had just run apt-get dist-upgrade so the memory contents would not be all zeros) showed that gzip -9 would decrease the file to 35% of it’s size at a cost of just over 1 minute of CPU time on a Pentium-M 1.7GHz. But gzip -3 compresses it to 37% and only takes 9 seconds. 9 seconds of CPU time to save 80M of disk space seems a reasonable trade-off.

In my particular case it saves CPU time as the encryption I use for my root filesystem takes more CPU time than gzip -3 so compressing the data saves time. But I don’t expect my case to be common.

Now when Xen is used on a more modern machine with a faster CPU gzip -3 has the potential to save time as well as disk space. A machine with a CPU that is in aggregate 10x faster than my laptop (I think that means most 64bit multi-core CPUs) running with a single S-ATA disk (that will have a sustained contiguous read speed of 80MB/s and write speed that is less) will save time when saving multiple Xen DomU’s if it runs them in parallel and compresses them.

Also gzip is not the fastest compression program. There may be other options that are better suited to the needs of Xen.

I have filed a Debian bug 435406 requesting that compression be supported.

Share This

Syndicated 2007-08-02 09:00:52 from etbe

Advogato and Hateful/Divisive Posts

Firstly for the benefit of people who haven’t heard of it, the Advogato FAQ and the Wikipedia Page describe what Advogato does.

Pete Zaitcev posted a strange article about me to Advogato. In it he accused me of “pumping hateful leftist propaganda into Advogato“, said propaganda being my regular blog posts. In an addendum he accused me of insanity, and said that my “attacks” were “divisive“.

I considered writing an Advogato post in response but first read the Posting Guidelines which say:

  • Please keep articles about Advogato itself to a minimum

  • Personal complaints, rants, and flames belong in your blog, not here

Both of those criteria rule out Pete’s post and any response that I might make would risk being in breach of such conditions - so I will use my blog as the Advogato admins recommend.

Pete’s ad-hominem attack on me claiming that my posts are hateful is bizarre. Pete, for the benefit of all the interested onlookers could you please inform us which of my posts you consider hateful and why you have such an opinion? As a general rule you should always cite articles that you reference. When you make accusations without any evidence to back them up it makes you look bad and prevents any positive discussion of the acts in question.

As for the accusation of being divisive, that only happens when people are forced to choose sides. For example when you encourage other people to rate me down on Advogato because of my political opinions that can divide the community (in a small way, neither you, nor me, nor Advogato is important enough to cause a serious problem in this regard).

The idea that I was intentionally pumping anything into Advogato was also strange to me. When I entered the URL for my blog into the Advogato settings page I didn’t even realise that it was being syndicated until I reviewed my web logs some time later. It seems that Advogato only has a small number of readers, a recent post about strange ZCAV performance included a graph and judging by the referrer tags it seems that 412 people read the post from Advogato out of 10468 total (so Advogato gets less than 4% of my readers). Planet Debian seems to get more than 15x the number of readers of Advogato. Incidentally if you don’t currently include images in your blog the reader tracking ability is one reason for including an image in an occasional post.

Another strange ad-hominem attack was the reference to “college indoctrination“. When I was in university I supported the Liberal party (the Australian equivalent of the Republican party in the US). The influence of Linux programmers (including some of Pete’s colleagues at Red Hat) had much more of an effect on my political opinions than that of my university experience.

I am not criticising Pete for disagreeing with me in regard to politics (I don’t even know what he disagrees with). Here are my specific criticisms of Pete’s behaviour:

  1. Ad-hominem attacks

  2. Encouraging mis-use of Advogato trust metrics for political reasons (this one may not have been deliberate)

  3. Non-specific accusations which do not allow me to either defend myself against the accusations or change my actions if he turns out to have any reasonable points

  4. Hypocrisy - he breaks two of the posting guidelines for the purpose of criticising my blog posts which supposedly break some unwritten rule

  5. Not reading the Advogato FAQ - it has a specific section about political disagreements

But I’m not going to advocate voting him down on Advogato. He does write some interesting things on occasion. Check out his page on guns for example.

Share This

Syndicated 2007-08-01 21:00:02 from etbe

ECC RAM in a Cheap Machine

In a comment on my previous post about ECC RAM someone commented that Dell sells PowerEdge desktop machines with ECC RAM. I visited the Dell web site and found that a low-end PowerEdge tower server (which still has a Pentium-D dual-core 64bit CPU) costs as little as $800AU. I also noticed that Dell Precision workstations that have ECC RAM - but that start at $2400. I wonder how much noise a low-end PowerEdge machine would produce.

HP Workstations with model codes starting with xw also have ECC RAM and are advertised at $584US as the starting price (about the same as a low-end PowerEdge).

I checked out NEC and Lenovo and according to their web sites they don’t make a desktop or desk-side machine that takes ECC RAM (someone please correct me if I’m wrong).

So now I’m looking for cheap HP Workstations and Dell PowerEdge and Precision machines at auction.

Share This

Syndicated 2007-08-01 09:00:19 from etbe

Germany Leads the World in Solar Power

boston.com reports that Germany now has 55% of the world’s photo-Voltaic (PV) power generation.

The German solar power industry has created tens of thousands of jobs including significant exports - so much for the Australian government claims that supporting the dirty coal industry is necessary for the economy! The renewable power industry in Germany employs over 250,000 people.

Australia has much more sun-light than Germany, the same programs of creating solar power could give better results here!

Share This

Syndicated 2007-07-31 21:00:10 from etbe

Praising Children vs Praising Programmers

In a comment on my blog post titled Childhood, Don Marti refers to an earlier blog post he wrote which refers to a New York Magazine article about the effects of praising children. The article does in some depth to describe scientific research into the issue of praising children for being “smart” vs praising them for working hard - with the conclusion being that it’s significantly better to praise them for working hard!

One quote from that article that I find very significant is “Baumeister has come to believe the continued appeal of self-esteem is largely tied to parents’ pride in their children’s achievements: It’s so strong that ‘when they praise their kids, it’s not that far from praising themselves’“. This matches my theory about people who subject their children to TV documentaries about gifted children.

The conclusions regarding children seem quite clear and the article provides direct advice to parents and teachers as to how to avoid the problems.

One issue I am wondering about after reading the NYM article is whether being exposed to smarter children hurts a child’s learning ability. The fact that there is no correlation between high self-esteem and learning ability has been proven, but the reports do not indicate whether there might be a correlation between a decreases in self-esteem and a decrease in learning ability. I recall pointing out to one the few good teachers at high-school that having some of the most capable and some of the least capable students in the same class was inefficient and led to excessive boredom for the more capable students and excessive difficulty in keeping up for the less capable students. I was told that “streaming” was considered bad because it was bad for the less capable students to know their status. I was also refused access to my results of the Westpac Maths contest for the same reason - which seems particularly strange, I was in the training program for the International Mathematical Olympiad so I doubt that releasing my score from one maths contest would change anyone’s opinion of my ability.

I am also wondering about how this effects adults (apart from their education history). Should we try to praise work colleagues for their effort instead of being smart? Are adults discouraged from trying hard at their work when they see others succeeding with little apparent effort?

One data point for this seems to be kernel coders in the Linux community. Everyone sees super-star Linux kernel coders on stage (on a pedestal) at conferences and it’s easy to believe that such people are significantly more intelligent than others (the well-known programmers are indeed very smart - but they also work a lot harder than most people believe) and that being so smart is a necessary pre-condition for submitting Linux kernel patches. I have met many people who appear to have the ability to be good at any type of coding but seem intimidated by kernel coding it for these reasons. Statements such as “I’ve been doing Linux coding for 10 years but I’m not a kernel coder” are often heard at Linux conferences. Also people who’s skills are respected are often regarded as kernel coders without any real reason.

The Linux kernel is a large C program with limited options for a debugger, if you are good at C coding you should do OK! I know that I am trivialising the issues related to kernel coding, there are some tasks such as reverse-engineering device-drivers and debugging some of the tricky race conditions that require special skills - but no-one is born with such skills! I would not suggest that someone try a significant kernel coding task on their first attempt - as with all areas of programming it’s best to start with the easy things first. The web site kernelnewbies.org is a good source of information for people who are getting into kernel coding.

I wonder whether a change in the attitudes towards such things could encourage more people to write free software, and more of the current programmers to attempt new challenges (such as kernel coding).

Share This

Syndicated 2007-07-31 09:00:22 from etbe

Hot Water

A response to a post I wrote about things to do for the environment suggested that there would be a health risk to lowering the temperature of a home hot-water system to save power.

I have just been reading about so-called tankless hot-water systems. The concept is that instead of keeping a tank of water hot (which means that you lose some energy due to the insulation not being perfect) you heat water when you need it. The down-side to this is that you need a moderate amount of power to heat water as rapidly as it’s used. The GoTankless.com products use between 11KW and 27KW of electricity. The early implementations of this idea used gas - the occasional carbon-monoxide problem with gas appliances makes me inclined to avoid them so it’s good that there’s an electric option.

One of the benefits of the tankless system is that it runs the water at a lower temperature than a regular hot water system. For a tank storing hot water you have to run it at a temperature that kills bacteria (or at least dramatically inhibits their growth) - which means greater than 50C, but for on-demand water it’s safer to have it run at something close to the desired temperature (probably not much above 40C) and not use the cold tap. Lower temperature water avoids the risk of scalding for children and the elderly and if the “hot tap” is running at a good temperature for a shower then you can just turn it on, wait 30 seconds for the pipes to warm up, and jump in! Incidentally it really sucks the way most showers have the taps under or behind the flow of water, so if the water becomes too hot before you get in then you end up getting minor burns in the process of turning on the cold tap.

I still think that solar hot water is the way to go. It apparently combines something like a tankless system on water that comes out of a tank heated by the sun. So during winter it operates like a tankless system but in summer you get more hot water than you can use.

This web site about Solar hot water systems indicates that they have a similar technology to “boost” solar hot water, so if the Sun doesn’t make the water hot enough then it can use electric or gas systems to further heat the water. It’s also interesting to note that they offer Heat Pump hot-water systems, it’s a pity that they apparently don’t support combining this with solar heating. Another interesting feature is what they call the Water Guardian that pumps cold water from the pipes back into the water tank and avoids wasting the water that you might otherwise run down the sink while waiting for it to get hot.

Share This

Syndicated 2007-07-30 21:00:08 from etbe

Porn vs Rape

Chris Samuel blogs about a plan to censor porn from the Internet in Australia. According to the ZDNet article the Fundamentalist Christian party Family First wants a national porn filter to protect children.

However there is strong evidence to suggest that the incidence of rape decreases as the availability of pornography increases. Access to porn prevents rapes!

The question is whether protecting people (mostly women and children) from rape is more important than protecting the strange and unusual (by the standards of modern Australian society) religious beliefs of a minority of people who oppose porn.

The current research on porn vs rape is based on comparing different regions of the US with different levels of Internet access. It would be more accurate if a scientific test could be performed in a controlled environment. The US has the largest number of prisoners of any country and the largest proportion of the population in prison of any first-world country and rape is common in prison. It would be easy to grant access to porn to one cell block of a prison and deny access to another and then record the incidence of reported rape (currently in the US porn is restricted in prisons and masturbation in prison is a crime). The results of such research could be used to devise government policy with the aim of protecting people from rape. Of course that would require compassion - something that’s extremely uncommon in politicians particularly the ones that claim to be Christian.

Some people are requesting the creation of Christian Porn - so Porn and Christianity don’t have to be opposed. The same site has an interesting page Masturbation: God’s Great Gift to Us. Now if all those rapists could be encouraged to watch Christian Porn and take advantage of God’s Great Gift then the world would be a better place.

Share This

Syndicated 2007-07-30 09:00:53 from etbe

Blogs and Conversation (or Lack Therof)

I recently received an email from RSA inviting me to read their blog (after having requested an evaluation copy of one of their products). They invited me to “join the conversation“. Often blogs are described as a “conversation” and I’ve been considering whether that analogy is appropriate.

The Collaborative International Dictionary of English v.0.48 has the following definition: Usage: {Conversation}, {Talk}. There is a looser sense of these words, in which they are synonymous; there is a stricter sense, in which they differ. Talk is usually broken, familiar, and versatile. Conversation is more continuous and sustained, and turns ordinarily upon topics or higher interest. Children talk to their parents or to their companions; men converse together in mixed assemblies.

There are instances of blogging that can approximate conversation when bloggers cite each other’s articles in turn and leave comments on each other’s blogs. But it’s usually not that continuous and sustained. An occasional patterin is that blogger A writes a post, blogger B writes a post disagreeing with it, blogger A comments on blogger B’s post, and that’s usually the end of it. Usually it’s just a case of multiple bloggers writing posts representing their own opinions with occasional references to other blogs and no sustained interaction. The blogging interaction seems to more closely resemble academics presenting papers with alternate solutions to a problem than a conversation.

One factor that I believe defines conversation but which isn’t mentioned in the dictionary is that the parties involved have an equal standing. The comments section of a blog is not such a forum, the blogger has a significantly more powerful voice (at least in connection with their own blog) than the people who comment. Someone who posts a comment may have it deleted, and it if is left then a rebuttal in another post will be seen by a significantly larger number of people (the number of people who read comments on a post is a tiny minority of the people who read the post). This doesn’t preclude conversation between bloggers who are of equal popularity in a community, for example most readers of my blog come from Planet Linux Australia and Planet Debian so any blogger who is also syndicated on those sites has an equal voice to me.

Another factor in conversation is whether responses are even read. Many blogs don’t accept comments and it’s never certain that a blogger will see a track-back from a blog that references one of their posts. When one party ignores the other (or appears to do so) then there is no conversation.

I’m not aware of whether a conversation with RSA people would be possible. While their blog refuses to send content to my Planet installation I guess I’m not going to find out…

Is the lack of conversation a bad thing? One problem with conversation is that it often degenerates into what GCIDE defines as talk, while that is good for a friendly mailing list (EG your local LUG) it isn’t so good for the exchange of technical information. A compounding problem for mailing lists is the number of posts that can not be interpreted without the context of a thread of discussion. This often makes mailing lists unreasonably difficult to use in the search for answers to technical problems. When reading google search results I will usually read blog URLs before mailing list posts as a blog post will usually stand alone and either give me an answer or be obviously not related to my problem - sometimes I have to read a dozen messages in a list discussion to determine that it’s not going to help me!

To improve things in this regard I plan to increase the number of posts I write with solutions to random technical problems that I encounter with the aim of providing a resource for google searches and to randomly inform people who read my blog. I find such posts by other people quite useful, I often get inspired to implement a technology after reading a blog post about it - there are many things that have a low priority in my todo list because they seem difficult, a blog post that reveals them to be easier than expected and advises how to avoid common problems can really make a difference!

Share This

Syndicated 2007-07-29 21:00:22 from etbe

A Worse Visual Migraine

Last night I had a Visual Migraine that was significantly worse than the previous ones. It started in the usual manner (flickering lights in my central vision and an inability to read text on a computer screen in a font that is normally quite readable) but then developed a new feature. Grey clouds appeared in the periphery of my vision which left me with only central vision which was obscured by flickering lights.

About an hour later it was gone. I’m glad that I don’t drive much, such limited vision is enough to allow me to use public transport without serious problems (although crossing a road could be interesting). Spending an hour in a parked car at the side of a road waiting for a migraine to go away is not something I’m looking forward to.

Share This

Syndicated 2007-07-29 08:48:55 from etbe

75 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!