Grant McWilliams

Tool to list XCP/Xenserver networks

My newest XCP tool is to list networks in a quick concise manner. By default lsnetworks shows the network name, the bridge it's associated with, the VLAN tag (if there is one), the VMs that have a network interface on it and the number of that interface. 

It can be found in the xenapi-admin-tools github.

 

 

 

Because XCP/Xenserver relies so much on UUID numbers I've provided a -u option which lists every object by UUID number if it has one. This won't be quite as useful as an interactive tool but if you're copy and pasting UUID's into xe commands this will give you a quick summary of them in relation to networks. 

 

Add a comment

A disk free command for Xen Cloud Platform

XCP and Xenserver store their Virtual Disk Images on storage repository. To see how much space you have on your LVM or lvmoisci storage repositories from the commandline can be quite a chore so I wrote a df command for storage repositories. My dfsr command mimics the output of the Linux df command with the human readable flag set (-h). All values will be printed in Kilobytes, Megabytes, Gigabytes and so on. It shows the size of the repository, how much is used, how much is available, the percent used and the Storage Repository type. 

 Get it from my Virtualization downloads section.

 

 

 

 

 

 

 

Add a comment

Cleaning up XCP's xe command with BASH

I've mentioned before that XCP/Xenserver's xe command is great for scripting but not always that great for interactive use. Because XCP relies so much on using UUID's for identification it's not very human friendly. Also the xe help is quite bad leading to our team that's working on writing documentation for xe. Even so xe makes a great scripting tool. 

To show the difference between xe's output and what I think it could be let me introduce my lstemplate.sh script available in the XCP Downloads Section of this website. The xe command has a tendency to show output on multiple lines which isn't very parsable and is sort of hard to read. I understand that it's easier to program though. I however, like as much info on one line as possible allowing me to send the output into awk/cut if I wish and also keeps formatting clean. 

Below is the output from xe template-list 

  ....

You can see the output doesn't wrap well and isn't that easy to read. My biggest irritation is trying to find the template for the OS I want to use. There are a lot of templates and I usually end up scrolling for quite some time to get the right one. My other choice is to pipe the output of xe template-list into grep -B1 to search for the name and print the line before the name-label which will show the UUID number. For instance xe template-list | grep -B1 'Red Hat'. As easy as that is I find myself scanning the output of xe template-list in order to know what to grep for which defeats the purpose of grepping. 

To solve this I wrote a small script called lstemplate.sh (list template). Below is the output. 

 

You can also pass a -v (verbose) flag to get the descriptions too. 

 

 

Add a comment

New XCP tools

As I and the team are writing manpages for XCP's xe command and it's 361 sub commands I'm writing more XCP tools. Last night I hacked out lshostvms.sh and xcptop.sh.

The lshostvms.sh script gives a quick list of hosts and shows numerically how many VMs are currently running on each. This includes the Control Domain itself currently  but I may change that in the future.

 

 

 

 

 

 

 

 The xcptop.sh script gives a list of all hosts and for each CPU core shows the utilisation according to XCP. 

 

Add a comment

New download section for Xen Cloud Platform/Xenserver scripts

As I build tools to help manage my clouds I will upload them here. So far I have three - mktemplate.sh, lstemplate.sh and lsvms.sh.

  1. mktemplate.sh is a wizard that creates XCP/Xenserver templates.
  2. lstemplate.sh lists XCP/Xenserver templates showing name-label and UUID sorted with colors. Optionally it shows the template description.
  3. lsvms.sh lists XCP/Xenserver Virtual Machines including name, running state, UUID and it's host.

In each of these cases I needed this functionality in a nice easy to use command. I also wanted the output to be parsable if possible ie. it needed to be line oriented and each field separated by white space. 

There will be many more tools coming as I get time and I have needs. I'd love to have a tool that lists VM hardware (nics, disks, cds) in a nice manner, a tool to list disks and the srs they reside on with flags (rw etc..). Stay tuned.

The tools have been moved to github so the most convenient way to install them is to install git and do a git clone.

Intall Git on XCP - http://grantmcwilliams.com/item/652-install-git-on-xcp-host

Git clone - git clone https://github.com/Xenapi-Admin-Project/xenapi-admin-tools

Add a comment

Calphalon joins the ranks of Al Clad

I was cooking sweet potatoes in a bed of salt the other night and I hear a pop from my oven. Thinking a sweet potato skin had popped I opened the oven door and it was in fact my glass lid to my Calphalon Saute pan. Yes, it shattered at 400 degrees. Thank you Calphalon, I'll remember that when I replace it.  

With that in mind I wonder about the quality control of major brand names. You may recall that I had the "copper" core of my Emerilware made by Al Clad melt out and to my surprise find out the copper was in fact aluminum. Strange, it was even colored copper on the outside. I of course wrote an article and took pictures as well. 

I didn't pay a ton for the Calphalon pan but Amazon is listing it at $175 and on sale for $75. I think for either price the lid should withstand normal oven temperatures. 

Add a comment

Format MyDocs as ext3

Fat32 is a very poor filesystem and Nokia chose it for the n900's MyDocs directory so Windows users could view their files if the n900 is plugged into a Windows PC via USB cable. Those of us who use the n900 on Linux machines (or use SSH/SFTP to access files) have the flexibility to use a better filesystem.

 

 

sed -i '1d' /usr/sbin/mmc-mount

echo -e '#!/bin/sh\ncase "$(sfdisk -c $(echo $1 | cut -c1-12) $(echo $1 | cut -c14))" in\n  43|83)\n    mount -t auto -o $3,noauto,nosuid,noatime,nodiratime "$1" "$2" > /dev/null\n    ;;\n  *)\n    '$(cat /usr/sbin/mmc-mount)'\n    ;;\nesac' > /usr/sbin/mmc-mount

sed -i 's/\(| 1e\)/\1 |43|83/' /usr/sbin/osso-mmc-mount.sh

umount /home/user/MyDocs

sfdisk -c /dev/mmcblk0 1 43

mkfs.ext3 -m 0 -L "Nokia N900" /dev/mmcblk0p1

osso-mmc-mount.sh /dev/mmcblk0p1 /home/user/MyDocs

chown -R user:users /home/user/MyDocs

Add a comment

Put some charcoal on the fire

I was wandering by the local Quality Food Store (QFC) recently and noticed that due to it being spring and everyone wanting to BBQ they had a nice display set up with a grill and many bags of charcoal brickets but something was off. Upon closer inspection the grill they decided to surround with brickets wouldn't even be able to use them... because it was gas.  Maybe they have a package deal - if you buy the grill you get a free back of charcoal....

Add a comment

When the right hand doesn't know....


You just have to wonder sometimes what the left hand is doing. Especially if you're the right hand. I was browsing LivingSocial looking for great food deals and I noticed that there were 8 (count them) hits for Indian food so I clicked on it and I got this message. Last time I checked 8 was still a positive number.

 

Add a comment

Media Validator

Media Validator - $1000.