Solution to: Getting Kernel Panic After Update of Virtual Machine

If you recently updated your Centos VM you may started getting the error below:

Kernel panic -- not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

unknown-block may change depending on your configuration, but symptoms stay same: Kernel panic after the update, and this error message.

Solution is:

yum remove kernel
yum update

That fixed my problem. Hopefully it fixes yours.

 

 

System Sleep States

When you put your computer to suspend, it will turn some of its devices to power saving mode to preserve energy consumption. But computers have many sleep states from deeper to shallow just like humans. The most shallow one is the freeze (or S0-idle) which only puts CPU to idle and if possible turn other devices to less power consuming mode. The most deeper one is the “Sleep-to-Memory” (or S3) in which CPU is turned off, and nearly only memory and some critical devices uses energy. It is also possible to suspend-to-disk (S4, S5), with STD current state of computer saved to disk. STD is called hibernate. In hibernate cold reboot will be performed so, it will take longer to restore the state.

Continue reading

Physical Host Metrics in Ceilometer – An Openstack Liberty Tale

This post is about the errors while getting physical machine metrics with ceilometer specifically  Openstack Liberty. Simply errors can be:

– No metrics shown in:

ceilometer meter-list

specifically metrics listed below:

  • compute.node.cpu.frequency
  • compute.node.cpu.idle.percent
  • compute.node.cpu.idle.time
  • compute.node.cpu.iowait.percent
  • compute.node.cpu.iowait.time

Continue reading

SysReq, Raising Elephants Is So Utterly Boring

SysRq keyboard key is very magical. You can perform a safe reboot a locked up computer with this key.

To achieve this remember mnemonics: “Raising Elephants Is So Utterly Boring”

To use SysRq:

  • Press Alt and SysRq (Print Screen) keys at the same time (but do NOT release them)
  • While holding Alt and SysRq keys down, press the key: R, wait few seconds
  • While holding Alt and SysRq keys down, press the key: E, wait few seconds
  • While holding Alt and SysRq keys down, press the key: I, wait few seconds
  • While holding Alt and SysRq keys down, press the key: S, wait few seconds
  • While holding Alt and SysRq keys down, press the key: U, wait few seconds
  • While holding Alt and SysRq keys down, press the key: B, wait few seconds

Computer will reboot now!

Reclaim empty space from, Shrink disk of qcow2 disk file

To reclaim disk space (in other words to shrink disk space) of qcow2 disk file you need to run following steps.

1. Fill guest disk with empty file

This is required since disk does not really hold its configured size, instead it has a sparse file format in creation time. After a while disk gets writes, temporary file creations/deletions that result non zero blocks in qcow2 file which are useless in reality (i.e. temporarily created file and deleted later). So to gain this space we’ll create a file that takes all space available in backing store (here qcow2 file). This file will only contain zeros. That way qemu-img will skip copying zeros and it will only mark the meta-data of zero sequence (for example length of it).

To do this, turn on virtual machine and in virtual machine’s terminal (you can use ssh to connect):

dd if=/dev/zero of=/tempzerofile
 dd will read from /dev/zero and write to /tempzerofile until all disk space is full. Now remove the file:
 rm /tempzerofile

2. Reclaim unused disk space from qcow2 file

Now turn virtual machine off, and run below command in your host machine to reclaim unused space back. Remember this space is marked with zeros and these type of files are called “sparse file”.

qemu-img convert -O qcow2 image.qcow2 shrinked_image.qcow2

where image is the original image whose size is big and we want to shrink it. shrinked_image is the destination image we want to create.

Singleton Design Pattern

Singleton design pattern is well known design pattern which uses a single object to access its methods at all time. Assume that you have a configuration file to read settings from. You are expecting to access various settings from different source files. With singleton you’ll hold a single object in memory and use this object to access its methods.

Sample python code demonstrating singleton is given below:

class Mysingleton():
	#class variable holds singleton object's reference
    s = None
	
	#constructor
    def __init__(self):
        print "this will print only once!!!"
        self._name = None
		#set _name with setter
        self.name = "yuppii"

	#getter
    @property
    def name(self):
        return self._name

	#setter
    @name.setter
    def name(self,n):
        self._name = n

	#static method to get instance
    @staticmethod
    def getInstance():
		#if no object is created before, create new one
        if Mysingleton.s == None:
            Mysingleton.s = Mysingleton()

        return Mysingleton.s


print Mysingleton.getInstance().name
print Mysingleton.getInstance().name
print Mysingleton.getInstance().name
print Mysingleton.getInstance().name
print Mysingleton.getInstance().name
print Mysingleton.getInstance().name

You  should see an output like:

this will print only once!!!
yuppii
yuppii
yuppii
yuppii
yuppii
yuppii

Agile Manifesto

Scrum has been used by Google since 2005. Scrum is widely used agile framework. In short Agile can be described with the following manifesto:

Individuals and interactions,over,processes and tools
Working software,over,comprehensive documentation
Customer collaboration,over,contract negotiation
Responding to change,over,following a plan
Hats off for this manifesto.

look at: agilemanifesto.org for details.