Archive for the ‘Uncategorized’ Category

1. # dd if=/dev/zero of=idli bs=1000000 count=1

   This will create a file - idli - of approx 1 MB size

2. # chmod 0 idli

   So that no one can ever use it /delete it etc etc

3. # mkswap idli

4. # swapon -v idli

5. Test if your swap has increase by 1 MB

   # top

   or

   # cat /proc/swaps

Obituary

Posted: February 12, 2013 in Uncategorized

Obituary printed in the London Times…..Absolutely Brilliant !!

Today we mourn the passing of a beloved old friend, Common Sense , who has been with us for many years. No one knows for sure how old he was, since his birth records were long ago lost in bureaucratic red tape. He will be remembered as having cultivated such valuable lessons as:

– Knowing when to come in out of the rain;
– Why the early bird gets the worm;
– Life isn’t always fair;
– And maybe it was my fault.

Common Sense lived by simple, sound financial policies (don’t spend more than you can earn) and reliable strategies (adults, not children, are in charge).

His health began to deteriorate rapidly when well-intentioned but overbearing regulations were set in place. Reports of a 6-year-old boy charged with sexual harassment for kissing a classmate; teens suspended from school for using mouthwash after lunch; and a teacher fired for reprimanding an unruly student, only worsened his condition.

Common Sense lost ground when parents attacked teachers for doing the job that they themselves had failed to do in disciplining their unruly children.

It declined even further when schools were required to get parental consent to administer sun lotion or an aspirin to a student; but could not inform parents when a student became pregnant and wanted to have an abortion.

Common Sense lost the will to live as the churches became businesses; and criminals received better treatment than their victims.

Common Sense took a beating when you couldn’t defend yourself from a burglar in your own home and the burglar could sue you for assault.

Common Sense finally gave up the will to live, after a woman failed to realize that a steaming cup of coffee was hot. She spilled a little in her lap, and was promptly awarded a huge settlement.

Common Sense was preceded in death,
-by his parents, Truth and Trust,
-by his wife, Discretion,
-by his daughter, Responsibility,
-and by his son, Reason.

He is survived by his 5 stepbrothers;
– I Know My Rights
– I Want It Now
– Someone Else Is To Blame
– I’m A Victim
– Pay me for Doing Nothing

Not many attended his funeral because so few realized he was gone.

If you still remember him, pass this on. If not, join the majority and do nothing.

Getting Started with Salt Stack-the Other Configuration Management System Built with Python: http://www.linuxjournal.com/content/getting-started-salt-stack-other-configuration-management-system-built-python

 

In theoretical computer science, the CAP theorem, also known as Brewer’s theorem states that it is impossible for a distributed computer system to simultaneously provide all three of the following guarantees:

Consistency: All nodes see the same data at the same time.

Availability: A guarantee that every request receives
a response about whether it was successful or failed.

Partition Tolerance: The system continues to operate despite arbitrary message loss or failure of part of the system.

According to the theorm, a distributed system can satisfy any two of these guarantees at the same time, but not all three.Openstack Object Storgage (Swift) chose availability and partition tolerance and dropped consistency. That means that you’ll always get your data, they will be dispersed on many places, but you could get an old version of them (or no data at all) in some odd cases (like some server overload or failure). This compromise is made to allow maximum availability and scalability of the storage platform.

The libvirt library (http://www.libvirt.org) creates a virtual machine abstraction layer between hypervisor interfaces and the software applications that use them. With libvirt, developers and system administrators can focus on a common management framework, common API, and common shell interface (i.e., virsh) to many different hypervisors, including:

  • QEMU/KVM
  • XEN
  • LXC
  • VirtualBox

 

Check if libvirt is installed. In my case I have already installed the libvirt-bin package that comes with Ubuntu 12.04.

root@cluster:/etc/apt/sources.list.d# dpkg -l | grep libvirt
ii  libvirt-bin                           0.9.8-2ubuntu17.4                programs for the libvirt library
ii  libvirt-dev                           0.9.8-2ubuntu17.4                development files for the libvirt library
ii  libvirt-glib-1.0-0                    0.0.4-1                          libvirt glib mainloop integration
ii  libvirt0                              0.9.8-2ubuntu17.4                library for interfacing with different virtualization systems
ii  libvirt0-dbg                          0.9.8-2ubuntu17.4                library for interfacing with different virtualization systems
ii  libvirtodbc0                          6.1.4+dfsg1-0ubuntu1             high-performance database – ODBC libraries
ii  python-libvirt                        0.9.8-2ubuntu17.4                libvirt Python bindings

As you can see the libvirt packages have been installed.

Now install qemu and/or kvm. Though qemu or kvm is not necessary for libvirt to function, I am using it to launch a VM and check if LibVirt can connect to the instance.

root@cluster:~# apt-get install qemu qemu-kvm-extras qemu-kvm-extras-static qemu-kvm-spice
Reading package lists… Done
Building dependency tree       
Reading state information… Done
The following extra packages will be installed:
  binfmt-support libbluetooth3 libbrlapi0.5 libfdt1 libjpeg-turbo8 libjpeg8 libpixman-1-0
  libspice-server1 libvde0 libvdeplug2 qemu-keymaps qemu-system qemu-user qemu-user-static vde2
Suggested packages:
  samba vde2-cryptcab
The following NEW packages will be installed:
  binfmt-support libbluetooth3 libbrlapi0.5 libfdt1 libjpeg-turbo8 libjpeg8 libpixman-1-0
  libspice-server1 libvde0 libvdeplug2 qemu qemu-keymaps qemu-kvm-extras qemu-kvm-extras-static
  qemu-kvm-spice qemu-system qemu-user qemu-user-static vde2
0 upgraded, 19 newly installed, 0 to remove and 3 not upgraded.
Need to get 41.1 MB of archives.
After this operation, 160 MB of additional disk space will be used.
Do you want to continue [Y/n]?

 

Now check of KVM hardware acceleration can be possible 

root@cluster:~# kvm-ok
INFO: Your CPU does not support KVM extensions
KVM acceleration can NOT be used
root@cluster:~#

In my case the hardware is non VT enabled hence KVM acceleration cannot be used. I can still use qemu to launch virtual machines.

 

Once KVM is installed check if you can connect directly to libvirt using the virsh console.

root@cluster:~# virsh -c qemu:///system list
 Id Name                 State
———————————-

Create a domain with the instructions found at http://wiki.libvirt.org/page/VM_lifecycle#Creating_a_domain

root@cluster:~# virt-install  –connect qemu:///system –virt-type qemu –name cluster-test-vm –ram 512 –disk path=/home/cssoss/rhel6.img,size=8 –vnc –cdrom /home/cssoss/rhel-server-6.0-x86_64-dvd.iso –network network=default,mac=52:54:00:9c:94:3b –os-variant rhel6

 

root@cluster:~# virsh
Welcome to virsh, the virtualization interactive terminal.

Type:  ‘help’ for help with commands
       ‘quit’ to quit

 

Now list the VM with virsh.

virsh # list
 Id Name                 State
———————————-
  1 cluster-test-vm      running

virsh #

 

Now try connecting to the VM from virsh.

virsh # console cluster-test-vm
Connected to domain cluster-test-vm
Escape character is ^]

There you go libvirt is installed and works on the hardware.

 

 

 

RIP Raj “oldmonk” Mathur

Posted: December 13, 2012 in Uncategorized

RIP Raj “oldmonk” Mathur. http://www.mail-archive.com/ilugd@lists.linux-delhi.org/msg29557.html

Playing around with git.

Posted: December 3, 2012 in Uncategorized

Decided to play around with git to commit some of the Python Code I’ve been using to master ‘How to think like a Computer Scientist’ to github.

Basic Steps to commit your code to github are as follows.

1) Create an account on github.com (My username is vivekvc)

2) Generate an ssh key and upload the public key on github.

3) Create a project using git hub (my project name is python-code)

4) Create a directory using mkdir <directory_name> on your local machine.

5) Create or Copy the files you want to be add to git hub to the newly created directory

6) Issue the git init command inside the directory.

frodo@shire:~/python-code$ git init
Initialized empty Git repository in /home/frodo/python-code/.git/

7) Copy the git origin for your project from github.

frodo@shire:~/python-code$ git remote add origin git@github.com:vivekvc/python-code.git

8) issue the git add command

frodo@shire:~/python-code$ git add .

9) Commit your code with the -m option

frodo@shire:~/python-code$ git commit -m ‘Python Code’
[master (root-commit) 00521fd] Python Code
 14 files changed, 196 insertions(+)
 create mode 100644 computer-scientist/degree-radians.py
 create mode 100644 computer-scientist/degree-radians.py~
 create mode 100644 computer-scientist/expressions.py
 create mode 100644 computer-scientist/functions.py
 create mode 100644 computer-scientist/functions.py~
 create mode 100644 computer-scientist/functions1.py
 create mode 100644 computer-scientist/functions1.py~
 create mode 100644 computer-scientist/logtest.py
 create mode 100644 computer-scientist/math1.py
 create mode 100644 computer-scientist/math2.py
 create mode 100644 computer-scientist/print.py
 create mode 100644 computer-scientist/python.log
 create mode 100644 computer-scientist/variables_parameters_local.py
 create mode 100644 computer-scientist/variables_parameters_local.py~

11) Push your changes to github.

frodo@shire:~/python-code$ git push -u origin master
Counting objects: 17, done.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (17/17), 1.97 KiB, done.
Total 17 (delta 5), reused 0 (delta 0)
To git@github.com:vivekvc/python-code.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

There you go :-)

 

 

I’ve just completed a creative commons licensed document on Ubuntu Image/Instance hardening at my workplace (peer review and testing pending prior to publishing). I was reading through the OpenStack mailing list and a post on the concept of OpenStack Trust Computing Pools struck me. Trust computing pools is a mechanism for verifying if nodes are running on good hypervisors and also in a running environment that is reliable.

URL: http://wiki.openstack.org/TrustedComputingPools

 

Code:https://github.com/openstack/nova/blob/stable/folsom/nova/scheduler/filters/trusted_filter.py

OpenStack Swift eventual consistency analysis & bottlenecks: http://julien.danjou.info/blog/2012/openstack-swift-consistency-analysis

I came across this interesting RFC 1855 which talks about Netiquette. A must read for everyone who wants to be a responsible netizen.

RFC 1855 – Netiquette Guidelines: http://www.faqs.org/rfcs/rfc1855.html