<?xml version='1.0' encoding='ISO-8859-1'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-4121334</id><updated>2008-11-20T10:39:51.175Z</updated><title type='text'>Diary</title><subtitle type='html'>Dan's Diary</subtitle><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/index'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default?start-index=26&amp;max-results=25'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.berrange.com/personal/diary/atom.xml'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>128</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4121334.post-8139382439771940837</id><published>2008-11-20T10:28:00.002Z</published><updated>2008-11-20T10:39:51.185Z</updated><title type='text'>libvirt User Mode Linux driver and other new features</title><content type='html'>&lt;p&gt;
It has been a while since I reported on libvirt development news, but that doesn't mean we've been idle. The big news is the introduction of another new hypervisor driver in libvirt, this time for User Mode Linux. While Xen / KVM get all the press these days, UML has been quietly providing virtualization for Linux users for many years - until very recently nearly all Linux virtual server providers were deploying User Mode Linux guests. libvirt aims to be the universal management API for all virtualization technologies, and UML has no formal API of its own, so it is only natural that we provide a UML driver in libvirt. It is still at a fairly basic level of functionality, only supporting disks &amp; paravirt consoles, but it is enough to get a guest booted &amp; interact locally. The next step is adding networking support at which point it'll be genuinely useful.  To recap, libvirt now has drivers for Xen, QEMU, KVM, OpenVZ, LXC (LinuX native Containers) and UML, as well as a test driver &amp; RPC support.
&lt;/p&gt;

&lt;p&gt;
In other news, a couple of developers at VirtualIron have recently contributed some major new features to libvirt. The first set of APIs provides the ability to register for lifecycle events against domains, allowing an application to be notified whenever a domain stops, starts, migrates, etc, rather than having to continually poll for status changes. This is implemented for KVM and Xen so far. The second huge set of APIs provide a way to query a host for details of all the hardware devices it has. This is a key building block to allow remote management tools to assign PCI/USB devices directly to guest VMs, and to more intelligently configure networking and storage. Think of it as a remotely accessible version of HAL. In fact, we use HAL as one of the backend implementations for the API, or as an alternative, the new DeviceKit service.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/8139382439771940837/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=8139382439771940837' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/8139382439771940837'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/8139382439771940837'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/11/libvirt-user-mode-linux-driver-and' title='libvirt User Mode Linux driver and other new features'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-3522300935010033608</id><published>2008-07-25T08:43:00.003Z</published><updated>2008-07-25T09:04:10.739Z</updated><title type='text'>kernel-xen is dead. Long live kernel + paravirt_ops</title><content type='html'>&lt;p&gt;
In Fedora 9 we discontinued our long standing forward-port of Xen's &lt;a href="http://xenbits.xen.org/linux-2.6.18-xen.hg"&gt;2.6.18 kernel tree&lt;/a&gt;, and switch to a generic LKML tree (which already had i386 Xen DomU pv_ops), and added a set of patches to support x86_64 Xen DomU pv_ops. While it lacks functionality compared to the previous Xen kernels, and was certainly less stable for a while, overall this was a great success in terms of maintainability. It was still a separate kernel RPM though...
&lt;/p&gt;

&lt;p&gt;
Jeremy Fitzhardinge has meanwhile continued to improve the Xen i386 pv_ops tree stability &amp; functionality in upstream LKML, and has also taken the hacky Fedora x86_64 pv_ops patches, majorly cleaned them up &amp; worked them into a form that was acceptable for upstream. A couple of days ago Ingo &lt;a href="http://lkml.org/lkml/2008/7/21/201"&gt;sent Jeremy's work&lt;/a&gt; onto Linus who &lt;a href="http://lkml.org/lkml/2008/7/21/262"&gt;promptly merged it for 2.6.27&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Fedora 10 Rawhide of course is tracking 2.6.27 so yesterday Mark McLoughlin &lt;a href="http://www.redhat.com/archives/fedora-xen/2008-July/msg00044.html"&gt;turned on Xen pv_ops&lt;/a&gt; in the main kernel RPM, and killed off 'kernel-xen'.
&lt;/p&gt;

&lt;p&gt;
So for Fedora 10 we'll have &lt;strong&gt;one kernel RPM to rule them all&lt;/strong&gt;. By the magic of pv_ops,  auto-detecting whether its running bare metal, Xen, VMWare (VMI) or KVM at boot and optimizing itself for each platform!
&lt;/p&gt;

&lt;p&gt;
There's only one small wrinkle, that isn't really Xen's fault. Anaconda install images on 32-bit Fedora are a i586 non-PAE kernel. Xen 32-bit is i686, PAE only, so we still need to have a separate initrd and vmlinux for installation - but at least its derived from the general purpose 'kernel-PAE' binary, instead of 'kernel-xen'. Of course 64-bit doesn't have this complication.  Someone just needs to fix 32-bit Linux so it can auto-switch between non-PAE and PAE at runtime. It was always said to be impossible to unify UP &amp; SMP kernels...until someone actually did it. Now just need someone to do the impossible for PAE and all will be right with the world :-)
&lt;/p&gt;

&lt;p&gt;
It's taken a long time &amp; alot of work by many many people to get Xen's DomU kernel bits merged upstream, so congratulations to all involved on getting another architecture merged, enabling us to finally take full advantage of paravirt_ops in Fedora's Xen kernels. 
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/3522300935010033608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=3522300935010033608' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/3522300935010033608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/3522300935010033608'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/07/kernel-xen-is-dead-long-live-kernel' title='kernel-xen is dead. Long live kernel + paravirt_ops'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-2860228926655985071</id><published>2008-06-26T10:33:00.002Z</published><updated>2008-06-26T10:38:36.857Z</updated><title type='text'>New Java bindings for libvirt</title><content type='html'>&lt;p&gt;
&lt;a href="http://veillard.com/"&gt;DV&lt;/a&gt; has recently been looking at the issue of Java bindings for libvirt. A few months back a libvirt community member, Tóth István, contributed most of the code for Java bindings to libvirt. Daniel has now taken this codebase added a build system, and is hosting it in the libvirt CVS repository and done &lt;a href="http://www.redhat.com/archives/libvir-list/2008-June/msg00280.html"&gt;a formal release&lt;/a&gt;. This should be hitting Fedora 10 rawhide in the near future, meaning we now have bindings for C, Perl, Python, OCaml, Ruby and Java. Now who wants to do a PHP binding....that's the only other language commonly requested
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/2860228926655985071/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=2860228926655985071' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/2860228926655985071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/2860228926655985071'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/06/new-java-bindings-for-libvirt' title='New Java bindings for libvirt'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-3519830596558477787</id><published>2008-06-18T20:23:00.002Z</published><updated>2008-06-18T20:25:35.450Z</updated><title type='text'>Red Hat Summit 2008</title><content type='html'>&lt;p&gt;
Just finished my talk at the &lt;a href="http://redhat.com/summit/"&gt;Red Hat Summit&lt;/a&gt; on libvirt and virtualization tools. For those who are interested, the I've now posted &lt;a href="http://people.redhat.com/berrange/summit-2008/"&gt;the slides&lt;/a&gt; online.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/3519830596558477787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=3519830596558477787' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/3519830596558477787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/3519830596558477787'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/06/red-hat-summit-2008' title='Red Hat Summit 2008'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-4110472207169373707</id><published>2008-05-23T19:08:00.004Z</published><updated>2008-05-23T20:31:12.637Z</updated><title type='text'>Better living through API design: low level memory allocation</title><content type='html'>&lt;p&gt;
The &lt;a href="http://libvirt.org/"&gt;libvirt&lt;/a&gt; library provides a core C API upon which language specific bindings are also built. Being written in C of course means we have to do our memory management / allocation. Historically we've primarily used the standard malloc/realloc/calloc/free APIs that even knows and loves/hates, although we do have an internal variable length string API (more on that in a future post). Of course there are many other higher level memory management APIs (obstacks/memory pools, garbage collectors, etc) you can write C code with too, but in common with the majority of other other apps/code we happen to be using the general purpose malloc/free pattern everywhere. I've recently been interested in improving our code quality, reliability and testing, and found myself thinking about whether there was a way to make our use of these APIs less error prone, and verifiably correct at build time. 
&lt;/p&gt;
&lt;p&gt;
If you consider the standard C library malloc/realloc/calloc/free APIs, they in fact positively encourage application coding errors. Off the top of my head there are at least 7 common problems, probably more....
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;malloc() - pass incorrect number of bytes&lt;/li&gt;
&lt;li&gt;malloc() - fail to check the return value&lt;/li&gt;
&lt;li&gt;malloc() - forget to fully initialize returned memory&lt;/li&gt;
&lt;li&gt;free() - double free by not setting pointer to NULL&lt;/li&gt;
&lt;li&gt;realloc() - fail to check the return value&lt;/li&gt;
&lt;li&gt;realloc() - fail to re-assign the pointer with new address&lt;/li&gt;
&lt;li&gt;realloc() - leaking memory upon failure to resize&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
A great many libraries will create wrapper functions around malloc/free/realloc but they generally only attempt to address one or two of these points. As an example, consider GLib, which has a wrapper around malloc() attempting to address point 2. It does this by making it call abort() on failure to allocate, but then re-introduces the risk by also adding a wrapper which doesn't abort()
&lt;/p&gt;

&lt;pre&gt;
  gpointer g_malloc         (gulong        n_bytes) G_GNUC_MALLOC;
  gpointer g_try_malloc     (gulong        n_bytes) G_GNUC_MALLOC;
&lt;/pre&gt;

&lt;p&gt;
It also wraps realloc() for the same reason, and adds an annotation to make the compiler warn if you don't use the return value
&lt;/p&gt;
&lt;pre&gt;
  gpointer g_realloc        (gpointer      mem,
                             gulong        n_bytes) G_GNUC_WARN_UNUSED_RESULT;
  gpointer g_try_realloc    (gpointer      mem,
                             gulong        n_bytes) G_GNUC_WARN_UNUSED_RESULT;
&lt;/pre&gt;
&lt;p&gt;
This at least addresses point 6, ensuring that you update your variable with the new pointer, but can't protect against failure to check for NULL. And the free() wrapper doesn't address the double-free issue at all.
&lt;/p&gt;

&lt;p&gt;
You can debate which of "checking for NULL" vs "calling abort()" is the better approach - &lt;a href="http://log.ometer.com/2008-02.html"&gt;Havoc has some compelling points&lt;/a&gt; - but that's not the point of this blog posting. I was interested in whether I could create wrappers for libvirt which kept the choice in the hands of the caller, while still protecting from the common risks. 
&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;For any given pointer type the compiler knows how many bytes need to be allocated for a single instance of it - it sizeof(datatype) or sizeof(*mptr). Both options are a little tedious to write out, eg&lt;/p&gt;
&lt;pre&gt;
mytype *foo;
foo = malloc(sizeof(*foo));
foo = malloc(sizeof(mytype));
&lt;/pre&gt;
&lt;p&gt;
Since C has no data type representing a data type, you cannot simply pass a data type to a function as you might like to:
&lt;/p&gt;
&lt;pre&gt;
mytype *foo = malloc(mytype);
&lt;/pre&gt;
&lt;p&gt;
You do, however, have access to the preprocessor and so you can achieve the same effect via a trivial macro. 
&lt;/p&gt;
&lt;pre&gt;
#define MALLOC(ptr) malloc(sizeof(*(ptr)))
or
#define MALLOC(mytype) malloc(sizeof(mytype))
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
GCC has a number of ways to annotate APIs, one of which is &lt;code&gt;__attribute__((__warn_unused_result__))&lt;/code&gt;. This causes emit a warning if return value is not used / checked. Add -Werror and you can get guarenteed compile time verification (the rest of your code was 100% warning free, wasn't it - it ought to be :-). This doesn't actually help with the NULL check for malloc, because you &lt;strong&gt;always&lt;/strong&gt; do something with the return value - assign it to a variable. The core problem here is that the API encodes the error condition as a special case value in the returned "data". The obvious answer to this is to separate the two cases, keeping the return value soley as a bi-state success of fail flag. 
The data can be passed by via a output parameter.  This might look like:
&lt;/p&gt;
&lt;pre&gt;
myptr *foo;
mymalloc(&amp;foo, sizeof(*foo));
&lt;/pre&gt;
&lt;p&gt;
And the compiler would be able to warn that you failed to check for failure. It looks rather ugly to write this way, but consider that a preprocessor macro is already being used for the previous issue, so we can merely extend its use
&lt;/p&gt;
&lt;pre&gt;
#define MALLOC(ptr) mymalloc(&amp;(foo), sizeof(*(foo))
myptr *foo;
if (MALLOC(foo) &lt; 0)
   ... do error handling...
&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
The memory allocated by malloc() is not initialized to zero. For that a separate calloc() function is provided. This leaves open the possiblity of an app mistakenly using the wrong variant. Or consider an app using malloc() and explicitly initializing all struct members. Some time later a new member is added and now the developer needs to find all malloc() calls wrt to that struct and explicitly initilize the new member. It would be safer to always have malloc zero all memory - even though it has an obvious performance impact, the net win in safety is probably worth it for most applications. Dealing with this in realloc() is much harder though, because you don't know how many extra bytes (if any) you need to initialize without knowing the original size.
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
Since free() takes the pointer to be freed directly it cannot reset the caller's original pointer variable back to NULL. So the application is at risk of mistakenly calling free() a second time, leading to corruption or a crash. free() will happily ignore a NULL pointer though. If free() were to accept a pointer to a pointer instead, it could automatically NULL-ify it. Again this has extra computational cost from the often redundant assignment to NULL, but it is negligable in the context of the work done to actually free the memory region, and easily offset by the safety benefits.
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;
As with point 2, this is caused by the fact that the error condition is special case of the return data value.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;This is a fun one which may escape detection for ages because most of the time the returned pointer address is the same as the original address. realloc() doesn't often need to relocate the data to another address. Given that solving the previous point required changing the return data to be an output-parameter, we've already basically solved this issue to. Pass in a pointer to the pointer to be reallocated and it can update the address directly.
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;
What todo on failure of a realloc() is an interesting question. The chances are that most applications will immediately free() the block and go into cleanup code - indeed I don't recall coming across code that would ever continue its work if realloc() failed. Thus one could simply define that if realloc fails it automatically free's the original data too.  
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;
Having considered this all its possible to define a set of criteria for the design of a low level memory allocation  API that is considerably safer than the standard C one, while still retaining nearly all its flexibility and avoiding the imposition of policy such as calling abort() on failure.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use return values only for a success/fail error condition flag&lt;/li&gt;
&lt;li&gt;Annotate all the return values with __warn_unused_result__&lt;/li&gt;
&lt;li&gt;Pass a pointer to the pointer into all functions&lt;/li&gt;
&lt;li&gt;Define macros around all functions to automatically calculate datatype sizes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
So the primary application usage would be via a set of macros:
&lt;/p&gt;
&lt;pre&gt;
    VIR_ALLOC(ptr)
    VIR_ALLOC_N(ptr, count)
    VIR_REALLOC_N(ptr, count)
    VIR_FREE(ptr)
&lt;/pre&gt;
&lt;p&gt;
These call through to the underlying APIs:
&lt;/p&gt;
&lt;pre&gt;
    int virAlloc(void *ptrptr, size_t bytes)
    int virAllocN(void *ptrptr, size_t bytes, size_t count)
    int virReallocN(void *ptrptr, size_t bytes, size_t count)
    int virFree(void *ptrptr)
&lt;/pre&gt;
&lt;p&gt;
The only annoying thing here is that although we're passing a pointer to a pointer into all these, the first param is still just 'void *' and not 'void **'. This works because 'void *' is defined to hold any type of pointer, and in addition using 'void **' causes the compiler to complain bitterly about strict aliasing violations. Internally the impls of these methods can still safely cast to 'void **' when deferencing the pointer.
&lt;/p&gt;
&lt;p&gt;
All 3 of Alloc/Realloc functions will have &lt;code&gt;__warn_unused_result__&lt;/code&gt; annotation so the caller is forced to check the return value for failure, validated at compile time generating a warning (or fatal compile error with -Werror).
&lt;/p&gt;
&lt;p&gt;
And finally to wire up the macros to the APIs:
&lt;/p&gt;
&lt;pre&gt;
  #define VIR_ALLOC(ptr)            virAlloc(&amp;(ptr), sizeof(*(ptr)))
  #define VIR_ALLOC_N(ptr, count)   virAllocN(&amp;(ptr), sizeof(*(ptr)), (count))
  #define VIR_REALLOC_N(ptr, count) virReallocN(&amp;(ptr), sizeof(*(ptr)), (count))
  #define VIR_FREE(ptr)             virFree(&amp;(ptr))
&lt;/pre&gt;

&lt;p&gt;
If this is all sounding fairly abstract, an illustration of usage should clear things up. These snippets are taken from libvirt, showing before and after

&lt;dl&gt;
&lt;dt&gt;Allocating a new variable:&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Before&lt;/p&gt;
&lt;pre&gt;
      virDomain *domain;
      if ((domain = malloc(sizeof(*domain))) == NULL) {
         __virRaiseError(VIR_ERROR_NO_MEMORY)
         return NULL;
      }
&lt;/pre&gt;
&lt;p&gt;
After
&lt;/p&gt;
&lt;pre&gt;
      virDomain *domain;

      if (VIR_ALLOC(domain) &lt; 0) {
         __virRaiseError(VIR_ERROR_NO_MEMORY)
         return NULL;
      }
&lt;/pre&gt;
&lt;/dd&gt;
&lt;dt&gt;Allocating an array of domains&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Before&lt;/p&gt;
&lt;pre&gt;
       virDomain *domains;
       int ndomains = 10;

       if ((domains = malloc(sizeof(*domains) * ndomains)) == NULL) {
         __virRaiseError(VIR_ERROR_NO_MEMORY)
         return NULL;
       }
&lt;/pre&gt;
&lt;p&gt;After&lt;/p&gt;
&lt;pre&gt;
       virDomain *domains;
       int ndomains = 10;

       if (VIR_ALLOC_N(domains, ndomains) &lt; 0) {
         __virRaiseError(VIR_ERROR_NO_MEMORY)
         return NULL;
       }
&lt;/pre&gt;
&lt;/dd&gt;
&lt;dt&gt;Allocating an array of domain pointers&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;Before&lt;/p&gt;
&lt;pre&gt;
       virDomain **domains;
       int ndomains = 10;

       if ((domains = malloc(sizeof(*domains) * ndomains)) == NULL) {
         __virRaiseError(VIR_ERROR_NO_MEMORY)
         return NULL;
       }
&lt;/pre&gt;
&lt;p&gt;After&lt;/p&gt;
&lt;pre&gt;
       virDomain **domains;
       int ndomains = 10;

       if (VIR_ALLOC_N(domains, ndomains) &lt; 0) {
         __virRaiseError(VIR_ERROR_NO_MEMORY)
         return NULL;
       }
&lt;/pre&gt;
&lt;/dd&gt;
&lt;dt&gt;Re-allocate the array of domains to be longer&lt;/dt&gt;
&lt;dd&gt;
&lt;p&gt;Before&lt;/p&gt;
&lt;pre&gt;
       virDomain **tmp;
       ndomains = 20

       if ((tmp = realloc(domains, sizeof(*domains) * ndomains)) == NULL {
         free(domains);
         __virRaiseError(VIR_ERROR_NO_MEMORY)
         return NULL;
       }
       domains = tmp;
&lt;/pre&gt;
&lt;p&gt;After&lt;/p&gt;
&lt;pre&gt;
       ndomains = 20

       if (VIR_REALLOC_N(domains, ndomains) &lt; 0) {
         __virRaiseError(VIR_ERROR_NO_MEMORY)
         return NULL;
       }
&lt;/pre&gt;
&lt;/dd&gt;
&lt;dt&gt;Free the domain&lt;/dt&gt;
&lt;dd&gt;&lt;p&gt;Before&lt;/p&gt;
&lt;pre&gt;
       free(domain);
       domain = NULL;
&lt;/pre&gt;
&lt;p&gt;After&lt;/p&gt;
&lt;pre&gt;
       VIR_FREE(domain);
&lt;/pre&gt;
&lt;/dd&gt;
&lt;/dl&gt;

&lt;p&gt;
As these short examples show the number of lines of code hasn't changed much, but the clarity of them has - particularly the realloc() usage, and of course there is now compile time verification of usage. The main problem remaining is the classic memory leak, by forgetting to call free() at all. If you want to use a low level memory allocation API this problem is essentially unavoidable. Fixing it really requires a completely different type of API (eg, obstacks/pools) or a garbage collector. And there's always valgrind to identify leaks which works very nicely, particularly if you have extensive test suite coverage
&lt;/p&gt;
&lt;p&gt;
The original mailing thread from which this post is derived is on &lt;a href="http://www.redhat.com/archives/libvir-list/2008-April/msg00372.html"&gt;the libvirt mailing list&lt;/a&gt;
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/4110472207169373707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=4110472207169373707' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/4110472207169373707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/4110472207169373707'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/05/better-living-through-api-design-low' title='Better living through API design: low level memory allocation'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-4109844165493719791</id><published>2008-04-25T01:39:00.003Z</published><updated>2008-04-25T01:48:24.986Z</updated><title type='text'>Flickr around the world</title><content type='html'>&lt;p&gt;
While browsing around the web a few weeks back I discovered a fabulous new way to &lt;strike&gt;waste&lt;/strike&gt; occupy my time while &lt;a href="http://xkcd.com/303/"&gt;waiting for code to compile&lt;/a&gt; in the form of &lt;a href="http://flickrvision.com/maps/show_3d"&gt;FlickrVision&lt;/a&gt;. A globe showing satellite imagery of the Earth, spinning around every few seconds to show a newly uploaded &amp; geo-tagged photo from Flickr.
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://flickrvision.com/maps/show_3d"&gt;&lt;img src="/~dan/flickrvision.png" alt="FlickrVision screengrab"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
For those without flash it also comes in a &lt;a href="http://flickrvision.com/"&gt;plain old 2-d format&lt;/a&gt;, but that's not nearly so entertaining.</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/4109844165493719791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=4109844165493719791' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/4109844165493719791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/4109844165493719791'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/04/flickr-around-world' title='Flickr around the world'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-2741073390355211674</id><published>2008-04-21T17:22:00.002Z</published><updated>2008-04-21T17:34:00.245Z</updated><title type='text'>Presentation is everything</title><content type='html'>&lt;p&gt;
CNet are running an article with a nice &lt;a href="http://www.cnet.com/8301-13846_1-9920202-62.html"&gt;scary sounding headline&lt;/a&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;strong&gt;"Free Open Source Software Is Costing Vendors $60 Billion"&lt;/strong&gt;
&lt;/blockquote&gt;

&lt;p&gt;
Pretty clearly trying to imply that open source software is a threat to the entire existence of the software industry. Don't fall for such FUD. Just look at the headline from the other side of the fence
&lt;/p&gt;

&lt;blockquote&gt;
&lt;strong&gt;"Free Open Source Software Is Saving Customers $60 Billion"&lt;/strong&gt; 
&lt;/blockquote&gt;

&lt;p&gt;
Not nearly so scary sounding now. In fact it is probably quite appealing.
&lt;/p&gt;

&lt;p&gt;
On the one hand, you have a small number of large software companies sitting on their monopolies and extorting cash through licensing fees. On the other hand, you have hundreds of thousands of companies saving money by using open source software, paying for services with tangible value for their business, rather than an arbitrary software "tax" (license fee). Open source software benefits the many, at the expense of the few. A worthy trade-off.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/2741073390355211674/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=2741073390355211674' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/2741073390355211674'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/2741073390355211674'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/04/presentation-is-everything' title='Presentation is everything'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-2910256187006521606</id><published>2008-04-18T14:48:00.002Z</published><updated>2008-04-18T14:54:28.013Z</updated><title type='text'>Dilbert + flash: epic fail</title><content type='html'>&lt;p&gt;
For some incomprehensible reason it has been decided that presenting &lt;a href="http://dilbert.com/"&gt;Dilbert&lt;/a&gt; cartoon strips as a plain old image isn't sexy enough. You now need a flash plugin to display the same old static image as before. Seriously, WTF.COM ? 
&lt;/p&gt;

&lt;p&gt;
The only positive, is that there is a now &lt;a href="http://feeds.feedburner.com/DilbertDailyStrip"&gt;an RSS feed&lt;/a&gt; for the strips, which does have the static images inline to the feed. So now I can avoid the nauseating website completely and just read the strips from the comfort of &lt;a href="http://liferea.sourceforge.net/"&gt;LiFeRea&lt;/a&gt;.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/2910256187006521606/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=2910256187006521606' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/2910256187006521606'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/2910256187006521606'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/04/dilbert-flash-epic-fail' title='Dilbert + flash: epic fail'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-6530713813555223836</id><published>2008-04-14T16:34:00.003Z</published><updated>2008-04-14T16:47:51.824Z</updated><title type='text'>New CPANTS test criteria for Fedora suitability</title><content type='html'>&lt;p&gt;
&lt;a href="http://cpants.perl.org"&gt;CPANTS&lt;/a&gt; is an automated testing system for Perl modules hosted on &lt;a href="http://search.cpan.org"&gt;CPAN&lt;/a&gt; which checks various Perl &lt;a href="http://cpants.perl.org/kwalitee.html"&gt;Kwalitee&lt;/a&gt; guidelines. There was recently a hackathon to add more guidlines to the testrig and interestingly a couple of these are focusing on distribution integration points.
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://cpants.perl.org/kwalitee/shortcoming?name=fits_fedora_license"&gt;&lt;strong&gt;fits_fedora_license&lt;/strong&gt;&lt;/a&gt; - this validates the module license against the allowable Fedora license list. In particular this seeks to fail modules which are Artistic v1 only - modules need to be dual Artistic/GPL to be suitable for Fedora. This is a great example of how Fedora's rigour around licensing is raising awareness across the open source community &amp;amp; helping to identify and solve problems before they get to the distro. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://cpants.perl.org/kwalitee/shortcoming?name=easily_repackageable_by_fedora"&gt;&lt;strong&gt;easily_repackageable_by_fedora&lt;/strong&gt;&lt;/a&gt; - this is a compound metric which validates that the &lt;strong&gt;fits_fedora_license&lt;/strong&gt; and &lt;strong&gt;no_generated_files&lt;/strong&gt; metrics were satisfied by the module.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
Unfortunately with all these new metrics I've got a whole bunch more failures to address in &lt;a href="http://cpants.perl.org/author/DANBERR"&gt;my CPAN modules&lt;/a&gt;.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/6530713813555223836/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=6530713813555223836' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/6530713813555223836'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/6530713813555223836'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/04/new-cpants-test-criteria-for-fedora' title='New CPANTS test criteria for Fedora suitability'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-7469824443716700845</id><published>2008-03-20T01:43:00.007Z</published><updated>2008-03-20T03:12:35.237Z</updated><title type='text'>The answer is not 42</title><content type='html'>&lt;p&gt;
The question is..

&lt;blockquote&gt;
&lt;p&gt;
&lt;em&gt;How long should police/security services be allowed to hold a suspect prior to charging them with an offense?&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;
In the USA the answer to this question is &lt;em&gt;2 days&lt;/em&gt;; In Russia it is &lt;em&gt;5 days&lt;/em&gt;; In France it is &lt;em&gt;6 days&lt;/em&gt;; In the UK the answer is &lt;strong&gt;already an astonishing 28 days&lt;/strong&gt;. &lt;a href="http://www.liberty-human-rights.org.uk/issues/pdfs/comparative-law-exec-summary.pdf"&gt;No other democracy comes close&lt;/a&gt;. And yet the government's latest "anti-terror" legistation (which will get a second reading in the commons on April 1st ,with a vote to follow after the May local elections), proposes to extend &lt;strong&gt;this period of pre-charge detention to 42 days&lt;/strong&gt;. 
&lt;/p&gt;

&lt;p&gt;
The idea that someone can be held by Police for as long as 42 days, potentially without being told of the grounds for suspicion, let alone be charged with an offence, is an idea that should remain the province of Kafka and his book &lt;a href="http://www.gutenberg.org/etext/7849"&gt;"The Trial"&lt;/a&gt;. The Judiciary serves the key role in English law providing the counter-balance to the state, allowing independent oversight and review of prosecution. Yet until you are charged with an offense there are no grounds for the Judiciary to intervene. You cannot defend yourself when there is no charge against which to defend.  
&lt;/p&gt;


&lt;blockquote&gt;
...the first impression made by the defence will often determine the whole course of the proceedings.  Unfortunately, though, he would still have to make it clear to K. that the first documents submitted are sometimes not even read by the court.  


if the court deems it necessary it can be made public but there is no law that says it has to be.  As a result, the accused and his defence don't have
access even to the court records, and especially not to the indictment, and that means we generally don't know - or at least not precisely - what the first documents need to be about, which means that if they do contain anything of relevance to the case it's only by a lucky coincidence.  If anything about the individual charges and the reasons for them comes out clearly or can be guessed at while the accused is being questioned, then it's possible to work out and submit documents that really direct the issue and present proof, but not before. Conditions like this, of course, place the defence in a very unfavourable and difficult position.  But that is what they intend.  In fact, defence is not really allowed under the law, it's only tolerated, and there is even some dispute about whether the relevant parts of the law imply even that.  So strictly speaking, there is no such thing as a counsel acknowledged by the court, and anyone who comes before this court as counsel is basically no more than a barrack room lawyer. The effect of all this, of course, is to remove the dignity of the whole procedure,
&lt;/blockquote&gt;

&lt;p&gt;
This is an extract from "The Trial" yet disturbingly close to what can happen in the UK should the government continue to extend pre-charge detention during which time the (yet to be) accused is allowed no meaningful defense.
&lt;/p&gt;
&lt;p&gt;
&lt;blockquote&gt;
&lt;em&gt;What is the motivation of the government in extending this pre-charge period ?&lt;/em&gt;
&lt;/blockquote&gt;

&lt;p&gt;
The posited need is to allow more time to investigate "terrorism" cases. There is little-to-no evidence that the current limit of 28 days is harming such investigations, and members of the security services, police and judiciary have either directly questioned whether an extension would have any tangible benefit in terror investigations, or failed to provide any supporting evidence for the extension.
Furthermore, &lt;strong&gt;there are viable alternatives&lt;/strong&gt; to this proposal which extend the powers relating to terrorism investigations. As part of the &lt;a href="http://liberty-human-rights.org.uk/issues/2-terrorism/extension-of-pre-charge-detention/index.shtml"&gt;Charge or Release&lt;/a&gt; campaign, &lt;a href="http://liberty-human-rights.org.uk/"&gt;Liberty Human Rights&lt;/a&gt; have suggested &amp;amp; support a number of alternative powers:
&lt;/p&gt;

&lt;blockquote style="padding-left: 3em"&gt;
&lt;ul&gt;
&lt;li&gt;Remove the bar on the use of intercept (phone tap) evidence because its inadmissibility is a major factor in being unable to bring charges in terror cases. Liberty welcomes the Government?s proposed Privy Council review into the use of this evidence in terror trials.
&lt;/li&gt;
&lt;li&gt;Allow post-charge questioning in terror cases, provided that the initial charge is legitimate and there is judicial oversight. This will allow for a charge to be replaced with a more appropriate offense at a later stage.
&lt;/li&gt;
&lt;li&gt;Hire more interpreters: Prioritise the hiring of more foreign language interpreters to expedite pre-charge questioning and other procedures.
&lt;/li&gt;
&lt;li&gt;Add resources: More resources for police and intelligence services.
&lt;/li&gt;
&lt;li&gt;Emergency measures in the Civil Contingencies Act 2004 could be triggered in a genuine emergency in which the police are overwhelmed by multiple terror plots, allowing the Government to temporarily extend pre-charge detention subject to Parliamentary and judicial oversight. Liberty believes that this is preferable to creating a permanent state of emergency.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;
Crucially these proposals do not undermine the foundations of our justice system.
&lt;/p&gt;

&lt;blockquote&gt;
&lt;em&gt;What can you do about it?&lt;/em&gt;
&lt;/blockquote&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.liberty-human-rights.org.uk/issues/2-terrorism/extension-of-pre-charge-detention/what-you-can-do.shtml"&gt;Support the Charge or Release&lt;/a&gt; campaign.
&lt;li&gt;&lt;a href="http://www.theyworkforyou.com/"&gt;Check up on your MP's record&lt;/a&gt; of participation in the parliamentary debates. After all they work for and represent &lt;em&gt;you&lt;/em&gt;.
&lt;li&gt;And if they support the extension to 42 days, &lt;a href="http://www.writetothem.com/"&gt;write to your MP&lt;/a&gt; and present a counterpoint to the government's plans.
&lt;li&gt;&lt;a href="http://liberty-human-rights.org.uk/issues/2-terrorism/extension-of-pre-charge-detention/index.shtml"&gt;Educate yourself on the issues&lt;/a&gt;&lt;br&gt;
&lt;object width="425" height="355"&gt;&lt;param name="movie" value="http://www.youtube.com/v/sA-cUpLa-aE&amp;hl=en"&gt;&lt;/param&gt;&lt;param name="wmode" value="transparent"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/sA-cUpLa-aE&amp;hl=en" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/7469824443716700845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=7469824443716700845' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/7469824443716700845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/7469824443716700845'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/03/answer-is-not-42' title='The answer is not 42'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-4293104055517467712</id><published>2008-02-17T20:48:00.004Z</published><updated>2008-02-17T21:17:08.276Z</updated><title type='text'>Prototype for a Fedora virtual machine appliance builder</title><content type='html'>&lt;p&gt;
For the &lt;a href="http://ovirt.org/"&gt;oVirt&lt;/a&gt; project the end product distributed to users consists of a LiveCD image to serve as the 'managed node' for hosting guests, and a virtual machine appliance to serve as the 'admin node' for the web UI. The excellant Fedora LiveCD creator tools obviously already deal with the first use case. For the second though we don't currently have a solution. The way we build the admin node appliance is to boot a virtual machine and run anaconda with a kickstart, and then grab the resulting installed disk image. While this works it involves a number of error-prone steps. Appliance images are not inherantly different from LiveCDs - instead of a ext3 filesystem inside an ISO using syslinux, we want a number of filesystems inside a partitioned disk using grub. The overall OS installation method is the same in both use cases.
&lt;/p&gt;
&lt;p&gt;
After a day's hacking I've managed to re-factor the internals of the LiveCD creator, and add a new installation class able to create virtual machine appliances. As its input it takes a kickstart file, and the names and sizes for one or more output files (which will act as the disks). It reads the 'part' entries from the kickstart file and uses parted to create suitable partitions across the disks. It then uses kpartx to map the partitions and mounts them all in the chroot. The regular LiveCD installation process then takes place. Once complete, it writes a grub config and installs the bootloader into the MBR. The result is one or more files representing the appliance's virtual disks which can be directly booted in KVM / Xen / VMware.
&lt;/p&gt;
&lt;p&gt;
The &lt;code&gt;virt-image&lt;/code&gt; tool defines a simple XML format which can be used to describe a virtual appliance. It specifies things like minimum recommended RAM and VCPUs, the disks associated with the appliance, and the hypervisor requirements for booting it (eg Xen paravirt vs bare metal / fullvirt). Given one of these XML files, the &lt;code&gt;virt-image&lt;/code&gt; tool can use libvirt to directly deploy a virtual machine without requiring any further user input. So an obvious extra feature for the virtual appliance creator is to output a virt-image XML description. With a demo kickstart file for the &lt;strong&gt;oVirt&lt;/strong&gt; admin node, I end up with 2 disks:
&lt;/p&gt;

&lt;pre&gt;
-rwxr-xr-x 1 root     root     5242880001 2008-02-17 14:48 ovirt-wui-os.raw
-rwxr-xr-x 1 root     root     1048576001 2008-02-17 14:48 ovirt-wui-data.raw
&lt;/pre&gt;

&lt;p&gt;
And an associated XML file
&lt;/p&gt;

&lt;pre&gt;
&amp;lt;image&amp;gt;
  &amp;lt;name&amp;gt;ovirt-wui&amp;lt;/name&amp;gt;
  &amp;lt;domain&amp;gt;
    &amp;lt;boot type='hvm'&amp;gt;
      &amp;lt;guest&amp;gt;
        &amp;lt;arch&amp;gt;x86_64&amp;lt;/arch&amp;gt;
      &amp;lt;/guest&amp;gt;
      &amp;lt;os&amp;gt;
        &amp;lt;loader dev='hd'/&amp;gt;
      &amp;lt;/os&amp;gt;
      &amp;lt;drive disk='ovirt-wui-os.raw' target='hda'/&amp;gt;
      &amp;lt;drive disk='ovirt-wui-data.raw' target='hdb'/&amp;gt;
    &amp;lt;/boot&amp;gt;
    &amp;lt;devices&amp;gt;
      &amp;lt;vcpu&amp;gt;1&amp;lt;/vcpu&amp;gt;
      &amp;lt;memory&amp;gt;262144&amp;lt;/memory&amp;gt;
      &amp;lt;interface/&amp;gt;
      &amp;lt;graphics/&amp;gt;
    &amp;lt;/devices&amp;gt;
  &amp;lt;/domain&amp;gt;
  &amp;lt;storage&amp;gt;
    &amp;lt;disk file='ovirt-wui-os.raw' use='system' format='qcow2'/&amp;gt;
    &amp;lt;disk file='ovirt-wui-data.raw' use='system' format='qcow2'/&amp;gt;
  &amp;lt;/storage&amp;gt;
&amp;lt;/image&amp;gt;
&lt;/pre&gt;

&lt;p&gt;
To deploy the appliance under KVM I run
&lt;/p&gt;

&lt;pre&gt;
# virt-image --connect qemu:///system ovirt-wui.xml
# virsh --connect qemu:///system list
 Id Name                 State
----------------------------------
  1 ovirt-wui            running
&lt;/pre&gt;


&lt;p&gt;
Now raw disk images are really quite large - in this example I have a 5 GB and a 1 GB image. The LiveCD creator saves space by using resize2fs to shrink the ext3 filesystem, but this won't help disk images since the partitions are a fixed size regardless of what the filesystem size is. So to allow smaller the appliance creator is able to call out to &lt;code&gt;qemu-img&lt;/code&gt; to convert the raw file into a &lt;code&gt;qcow2&lt;/code&gt; (QEMU/KVM) or &lt;code&gt;vmdk&lt;/code&gt; (VMWare) disk image, both of which are grow on demand formats. The &lt;code&gt;qcow2&lt;/code&gt; image can even be compressed. Wtth the &lt;code&gt;qcow2&lt;/code&gt; format the disks for the &lt;strong&gt;oVirt&lt;/strong&gt; WUI reduce to 600 KB and 1.9 GB. 
&lt;/p&gt;

&lt;p&gt;
The LiveCD tools have already seen immense popularity in the Fedora community. Once I polish off &lt;a href="http://www.redhat.com/archives/fedora-livecd-list/2008-February/msg00085.html"&gt;this new code&lt;/a&gt; to be production quality, it is my hope that we'll see similar uptake by people interested in creating and distributing appliances. The great thing about basing the appliance creator on the Live CD codebase and using kickstart files for both, is that you can easily switch between doing regular anaconda installs, creating Live CDs and creating appliances at will, with a single kickstart file.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/4293104055517467712/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=4293104055517467712' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/4293104055517467712'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/4293104055517467712'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/02/prototype-for-fedora-virtual-machine' title='Prototype for a Fedora virtual machine appliance builder'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-7815184654174838925</id><published>2008-02-14T22:15:00.002Z</published><updated>2008-02-14T22:35:55.570Z</updated><title type='text'>Announcing oVirt: a web based virtual machine management application</title><content type='html'>&lt;p&gt;
Way back in Fedora Core 5, we introduced the &lt;a href="http://libvirt.org"&gt;libvirt management library&lt;/a&gt; for virtual machines. Shortly thereafter in Fedora Core 6 we introduced &lt;a href="http://virt-manager.org/"&gt;Virtual Machine Manager&lt;/a&gt; (aka virt-manager) desktop application. In Fedora Core 7 we introduced &lt;a href="http://kvm.qumranet.com/"&gt;KVM&lt;/a&gt; as a virtualization technology. In Fedora 8 we introduced secure remote management of virtual machines using TLS/x509, further enhanced to support Kerberos in Fedora 9. Meanwhile the &lt;a href="http://freeipa.org/"&gt;FreeIPA&lt;/a&gt; project has been busy working to integrate Kerberos and LDAP (Fedora Directory Server).
&lt;/p&gt;
&lt;p&gt;
Clearly the time has come to move beyond managing handfuls of virtual machines with a desktop application, and take full advantage of all the infrastructure we've painstakingly prepared. To move to a web-based management capable of scaling from a handful of machines, up to an entire data center, allowing administration from any client OS whether Linux or Windows or Mac OS-X.
&lt;/p&gt;
&lt;p&gt;
It is time for &lt;a href="http://ovirt.org/"&gt;&lt;strong&gt;&lt;big&gt;oVirt&lt;/big&gt;&lt;/strong&gt;&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Quoting &lt;a href="http://www.redhat.com/archives/libvir-list/2008-February/msg00155.html"&gt;Hugh's announcement&lt;/a&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
oVirt is:

    * A small OS image that runs libvirt and hosts virtual machines 
    * A Web-based virtual machine management console

oVirt goals:

    * Empower virtual machine owners without giving up control of
      hardware
    * Automate virtual machine clustering, load balancing, and SLA
      maintenance
    * Simplify management of large numbers of machines
    * Work across platforms and architectures

oVirt uses:

    * A kerberos/LDAP server for authentication and authorization
      (oVirt ships with FreeIPA)
    * DNS/DHCP services on the local LAN -- or provides them for oVirt
      hosts over a private network if desired
    * Libvirt for virtual machine management, storage management, and
      secure remote communication
    * collectd for stats gathering and monitoring
    * Rails for rapid, flexible development

oVirt mailing list: http://www.redhat.com/mailman/listinfo/ovirt-devel
oVirt IRC: irc.freenode.net/#ovirt
oVirt website: http://ovirt.org
&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;
&lt;a href="http://fedoraproject.org/"&gt;Fedora 9&lt;/a&gt; (current rawhide) is providing the underlying OS distribution for both the "managed nodes" running guests, and the management application itself. We're targetting &lt;a href="http://libvirt.org/"&gt;libvirt&lt;/a&gt; as the mangement API, to avoid being tied into any single virtualization technology, though KVM is our current technology of choice due to its clean integration with the Linux kernel, and its ever improving performance.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/7815184654174838925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=7815184654174838925' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/7815184654174838925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/7815184654174838925'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/02/announcing-ovirt-web-based-virtual' title='Announcing oVirt: a web based virtual machine management application'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-5404216273494923560</id><published>2008-02-05T01:04:00.000Z</published><updated>2008-02-05T01:17:30.811Z</updated><title type='text'>New GTK-VNC and work on OpenGL accelerated scaling</title><content type='html'>&lt;p&gt;
The new GTK-VNC 0.3.3 release was made available over the weekend. This was primarily a bug fix release dealing with yet more UltraVNC compatability issues, a few crash scenarios, improved key-state tracking to deal with annoying GTK behaviour where it fails to send you 'release' events during key-repeat, and ability to reset modifier state when the widget looses focus to avoid the server thinking Alt/Ctrl are stuck 'on'.
&lt;/p&gt;

&lt;p&gt;
We also have an &lt;strong&gt;EXPERIMENTAL&lt;/strong&gt; web browser plugin for firefox. Before you go and install this, remember I'm saying this is &lt;strong&gt;EXPERIMENTAL&lt;/strong&gt;. We're not recommending anyone use this outside the lab yet because there needs to be a proper security audit of our protocol handling, and some more thought about how plugin security should work.  Needless to say the build is disabled by default for now. 
&lt;/p&gt;

&lt;p&gt;
More interestingly though, is that the dev tree of GTK-VNC now has support for scaling the VNC display. We didn't fancy writing pixmap scaling code, so for this we're integrating with &lt;a href="http://gtkglext.sourceforge.net/"&gt;GtkGExt&lt;/a&gt; and OpenGL to get hardware accelerated scaling. The performance is pretty decent - Anthony tells me he's been able to watch a DVD over VNC with scaling active. Sadly I'm stuck with the non-accelerated radeon driver in my laptop for now, so CPU usage is considerable. Still, its nice to be able to go "full screen" and have it use all screen real estate even when the remote desktop resolution doesn't match the local desktop resolution.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/5404216273494923560/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=5404216273494923560' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/5404216273494923560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/5404216273494923560'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/02/new-gtk-vnc-and-work-on-opengl' title='New GTK-VNC and work on OpenGL accelerated scaling'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-9193491123818894609</id><published>2008-02-01T15:26:00.000Z</published><updated>2008-02-01T15:57:36.728Z</updated><title type='text'>Progress in Fedora 9 Xen pv_ops kernel development</title><content type='html'>&lt;p&gt;
You may recall &lt;a href="http://berrange.com/personal/diary/2007/11/plan-for-xen-kernels-in-fedora-9"&gt;my announcement&lt;/a&gt; of our plans for Fedora 9 Xen kernels. The 5 second summary is that we're throwing away the current Xen kernels, and writing Xen support on top of paravirt_ops, for both DomU and Dom0, and both i386 &amp;amp; x86_64. Hugely ambitious given the limited time scales involved and the fact that only i386 DomU was working when we started this project. 
&lt;/p&gt;
&lt;p&gt;
Just minutes ago, after many many weeks work, Stephen Tweedie reached a very important milestone - the first kernel build capable of fully booting on Dom0, including the IOAPIC &amp;amp; DMA support neccessary to run real hardware drivers - ie the ability to access your real disks once the initrd is done :-)
&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;
(10:22:13 AM) sct: It boots
(10:22:14 AM) sct: It runs
(10:22:16 AM) sct: I can ssh into it
(10:22:50 AM) sct: [root@ghost ~]# dmesg|grep para
(10:22:50 AM) sct: Booting paravirtualized kernel on Xen
(10:22:50 AM) sct: [root@ghost ~]# 
&lt;/pre&gt;
&lt;/blockquote&gt;
&lt;p&gt;
It is beginning to look like we might actually succeed in our goals in time for Fedora 9 - congrats due to Stephen &amp; the rest of the team working on this !
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/9193491123818894609/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=9193491123818894609' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/9193491123818894609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/9193491123818894609'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/02/progress-in-fedora-9-xen-pvops-kernel' title='Progress in Fedora 9 Xen pv_ops kernel development'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-6184718449878717559</id><published>2008-01-11T05:36:00.001Z</published><updated>2008-01-11T05:46:25.866Z</updated><title type='text'>PolicyKit and libvirt integration</title><content type='html'>&lt;p&gt;
For Fedora 9 one of the new feature's we've got pending for virtualization is &lt;a href="http://fedoraproject.org/wiki/Features/VirtPolicyKit"&gt;integration with PolicyKit&lt;/a&gt;. This will allow virt-manager to manage local hypervisor connections without having to run as root via consolehelper. Although the virt-manager part of this won't be ready for a while yet, the libvirt bits were made available in libvirt 0.4.0 just before christmas. As a sneak preview this is now in updates-testing and already gives you the ability to run virsh as non root.
&lt;/p&gt;
&lt;p&gt;
For example, currently if you run virsh as non-root you'l lsee something like
&lt;/p&gt;
&lt;pre&gt;
$ virsh --connect qemu:///system
libvir: Remote error : authentication failed
error: failed to connect to the hypervisor
&lt;/pre&gt;
&lt;p&gt;
Now with PolicyKit support you can use 'polkit-grant' to authenticate and then you'll be able to run virsh without issue!
&lt;/p&gt;
&lt;pre&gt;
$ polkit-grant --gain org.libvirt.unix.manage
Attempting to gain the privilege for org.libvirt.unix.manage.
Authentication is required.
Password: 
Keep this privilege for the session? [no/session]?
session
Successfully gained the privilege for org.libvirt.unix.manage.
$ virsh --connect qemu:///system
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
       'quit' to quit

virsh #  start VirtTest
virsh # list
 Id Name                 State
----------------------------------
  1 VirtTest             running

&lt;/pre&gt;
&lt;p&gt;
In other news, &lt;a href="http://annexia.org/"&gt;Rich Jones&lt;/a&gt; has created a &lt;a href="http://sourceforge.net/mailarchive/forum.php?thread_name=47866C66.9090000%40redhat.com&amp;forum_name=gtk-vnc-devel"&gt;Mozilla Plugin for GTK-VNC&lt;/a&gt; so there's at last a less-sucky replacement for the terrible Java VNC plugins out there
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/6184718449878717559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=6184718449878717559' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/6184718449878717559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/6184718449878717559'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2008/01/policykit-and-libvirt-integration_11' title='PolicyKit and libvirt integration'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-1732226149687596917</id><published>2007-12-31T18:05:00.000Z</published><updated>2007-12-31T18:21:05.433Z</updated><title type='text'>New GTK-VNC release 0.3.2</title><content type='html'>&lt;p&gt;
Things have been progressing well with the &lt;a href="http://gtk-vnc.sourceforge.net/"&gt;GTK-VNC widget&lt;/a&gt;. The 0.3.0 release a few weeks back fixed a couple of co-routine race conditions, fixed portability to Solaris and added compatability for UltraVNC brokenness - it claims support for RFB version 3.4 which doesn't technically exist. 0.3.1 was a brown paper bag release a day later, due to the 'make dist' process going wrong with 0.3.0; say no more. Today &lt;a href="http://codemonkey.ws/"&gt;Anthony&lt;/a&gt; released version 0.3.2 which adds a GThread based co-routine implementation to provide portability to platforms lacking ucontext support (yes I'm looking at you Windows/cygwin). It also adds support for the RRE server encoding which is a zlib compressed format, although not commonly used its in the spec so its worth supporting. 
&lt;/p&gt;

&lt;p&gt;
For the next releases we'll have support for the Tight encoding as used by TightVNC - this is a more advanced variant on RRE, in some cases using JPEG as its compression method which is interesting. We're also in communication with the VMWare team to see if we can write code to support the RFB extensions, for which they recently got official extension numbers assigned. We decided to apply the 'release early, release often' mentality with earnest, and thus we're aiming to have regular monthly releases for the forseeable future. Meanwhile John is continuing to develop &lt;a href="http://www.gnome.org/projects/vinagre/"&gt;Vinagre&lt;/a&gt;, a long overdue modern VNC client taking full advantage of the GNOME infrastructure &amp; desktop integration points. 
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/1732226149687596917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=1732226149687596917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/1732226149687596917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/1732226149687596917'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/12/new-gtk-vnc-release-032' title='New GTK-VNC release 0.3.2'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-8085336440450637470</id><published>2007-12-29T01:28:00.000Z</published><updated>2007-12-29T01:43:47.443Z</updated><title type='text'>Improve your (Perl) code Kwalitee</title><content type='html'>&lt;p&gt;
If you are a Perl developer you may have come across &lt;a href="http://cpants.perl.org/"&gt;CPANTS&lt;/a&gt; which analyses and ranks all distributions and authors on &lt;a href="http://search.cpan.org"&gt;CPAN&lt;/a&gt; based on their &lt;strong&gt;&lt;a href="http://cpants.perl.org/kwalitee.html"&gt;Kwalitee&lt;/a&gt;&lt;/strong&gt; score.  To quote...
&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;
  What is a good module? That's hard to say.
  
  What is good code? That's also hard to say.
  
  "Quality" is not a well-defined term in computing ... and especially not Perl.

  One man's Thing of Beauty is another's man's Evil Hack
  
  Since we can't define quality, how do we write a program to assure it?
&lt;/pre&gt;

&lt;p&gt;
&lt;em&gt;&lt;strong&gt;Kwalitee:&lt;/strong&gt; It looks like quality, it sounds like quality, but it's not quite quality.&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;
I was rather disappointed to discover &lt;a href="http://cpants.perl.org/author/DANBERR"&gt;my own Kwalitee scores&lt;/a&gt; were rather poor so have been spending time to improve matters. The key to this is to run a test to check the Kwalitee score of a new release &lt;strong&gt;before uploading&lt;/strong&gt; it to CPAN. Conveniently the very code used to generate the rankings is available to download and run offline in the form of the &lt;a href="http://search.cpan.org/dist/Module-CPANTS-Analyse/"&gt;Module-CPANTS-Analyse&lt;/a&gt;. Inconveniently this wasn't in Fedora...&lt;strong&gt;until today&lt;/strong&gt;. I finally got all the dependent modules through review and built for rawhide, with F-8 to follow shortly... So now if you want to test the Kwalitee of your Perl modules before release just run:
&lt;/p&gt;

&lt;pre&gt;
# yum install perl-Module-CPANTS-Analyse
# cpants_lint.pl /path/to/my/module.tar.gz
&lt;/pre&gt;

&lt;p&gt;
It already helped me get Test-AutoBuild perfect...
&lt;/p&gt;

&lt;pre&gt;
$ cpants_lint.pl Test-AutoBuild-1.2.2.tar.gz 
Checked dist            Test-AutoBuild-1.2.2.tar.gz
Kwalitee rating         112.50% (27/24)

Congratulations for building a 'perfect' distribution!
&lt;/pre&gt;

&lt;p&gt;
112.50% you might wonder ? Yes, indeed. Only 24 of the checks are considered mandatory at this time. The other 3 are optional, but good practice none-the-less. To get to 100% you need to pass all the mandatory checks. If you manage this, then passing any optional checks will give you an additional boost.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/8085336440450637470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=8085336440450637470' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/8085336440450637470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/8085336440450637470'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/12/improve-your-perl-code-kwalitee' title='Improve your (Perl) code Kwalitee'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-5905633036531081403</id><published>2007-12-10T01:58:00.000Z</published><updated>2007-12-10T02:18:12.547Z</updated><title type='text'>New release of Test-AutoBuild 1.2.1</title><content type='html'>&lt;p&gt;
I finally got around to doing some more work on &lt;a href="http://autobuild.org/"&gt;Test-AutoBuild&lt;/a&gt; - a build and test automation framework for upstream developers. It checks sources out of SCM repos (CVS, Subversion, SVK, GNU Arch, Mercurial, Perforce), runs any build and test processes. It detects any RPMs generated during the build and publishes them in a YUM repo. It also publishes HTML status pages showing build logs, list of generated packages, any artifacts generated (eg, code test coverage reports, API documentation) and changelogs from the SCM repo. It is a similar system to CruiseControl, but is more powerful since it directly understands the idea of module dependancies, and so can intelligently manage chained builds of multiple dependant modules. We use this in the ET group for testing our virtualization stack. Our &lt;a href="http://builder.virt-manager.org/"&gt;nightly builder&lt;/a&gt; builds libvirt and gtk-vnc first, then builds virt-viewer and virt-install against these builds, and finally builds virt-manager against all of them. So any change in libvirt gets validated to make sure it doesn't break apps using libvirt. Since autobuild understands the dependancies, it can do intelligent build caching. eg if there were new changes in the libvirt SCM repo, but none in the virt-manager repos, it will still do a rebuild of virt-manager as a regression test 
&lt;/p&gt;
&lt;p&gt;
This &lt;a href="https://mail.gna.org/public/testautobuild-announce/2007-12/msg00000.html"&gt;new release version 1.2.1&lt;/a&gt; was all about making the SCM checkout process more reliable. Previously if a module could not be checked out (eg due to a server being down, or a config file typo) the entire build cycle would be aborted. With the new release, the troublesome module is simply skipped and the SCM logs published for the admin to diagnose - other modules in the build cycle continue to be built
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/5905633036531081403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=5905633036531081403' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/5905633036531081403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/5905633036531081403'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/12/new-release-of-test-autobuild-121' title='New release of Test-AutoBuild 1.2.1'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-5291104927250988108</id><published>2007-11-30T20:36:00.000Z</published><updated>2007-11-30T20:54:05.390Z</updated><title type='text'>The plan for Xen kernels in Fedora 9</title><content type='html'>&lt;p&gt;
This is a friendly alert of the major plans we have for Xen kernels in 
Fedora 9 timeframe...  Also &lt;a href="http://www.redhat.com/archives/fedora-xen/2007-November/msg00106.html"&gt;syndicated&lt;/a&gt; on the &lt;a href="http://www.redhat.com/mailman/listinfo/fedora-xen"&gt;fedora-xen&lt;/a&gt; mailing list.
&lt;/p&gt;
&lt;p&gt;
Since we first added Xen in Fedora Core 4, our kernels have been based on a forward-port of XenSource's upstream Xen kernels, to new LKML. For a
long time we ported their 2.6.16 tree to 2.6.18. Now we do ports of their
2.6.18 tree to 2.6.21/22/23, etc.  At the same time, upstream Linux gained
Xen support for i386 DomU, and shortly x86_64  DomU, and is generally
getting ever more virtualization capabilities.
&lt;/p&gt;
&lt;p&gt;
As everyone knows, we have tended to lag behind Fedora's state-of-the-art 
bare metal kernels by several releases due to the effort required to port
Xen to newer LKML releases. Despite our best efforts, this lag has been 
getting worse, not better.
&lt;/p&gt;
&lt;p&gt;
We have taken the decision, that this situation is unacceptable for Fedora 9.
We simply cannot spend more time forward porting Xen kernels. Either Xen has
to be dropped entirely, or we need a different strategy for dealing with the
kernels. Since people seeem to use Xen, we have decided not to drop it :-)
&lt;/p&gt;
&lt;p&gt;
So the plan is to re-focus 100% of all Xen kernel efforts onto paravirt_ops.
LKML already has i386 pv_ops + Xen DomU. We intend to build on this to
add:
&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;x64_64 pv_ops&lt;/li&gt;
  &lt;li&gt;x86_64 Xen DomU on pv_ops&lt;/li&gt;
  &lt;li&gt;i386 &amp;amp; x86_64  Xen Dom0  on pv_ops&lt;/li&gt;
  &lt;li&gt;memory balloon&lt;/li&gt;
  &lt;li&gt;paravirt framebuffer&lt;/li&gt;
  &lt;li&gt; save/restore&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
All of this based on same LKML release as Fedora bare metal. If all goes to
plan it may even be in the base kernel RPM, instead of kernel-xen, but thats
a minor concern compared to the actual coding.
&lt;/p&gt;
&lt;p&gt;
Getting all this done for Fedora 9 is seriously ambitious, but it is the only
long term sustainable option, other than dropping Xen entirely.
&lt;/p&gt;
&lt;p&gt;
What this means though, is that Fedora 9 Xen will certainly be going through
periods of instability and will certainly be even buggier than normal. F9
may well end up lacking features compared to Xen in Fedora 8 &amp; earlier (eg no
PCI device passthrough, or CPU hotplug). On the plus side though we will be
100% back in sync with bare metal kernel versions &amp; hopefully even have a
lot of this stuff merged in LKML to make ongoing maintainence sustainable.
Short term pain; Long term gain!
&lt;/p&gt;
&lt;p&gt;
I have not got any ETA on when any of these kernel changes will appear in
rawhide - some time before the F9 feature freeze date is best guesstimate.
We will alert people when the time comes. There is a &lt;a href="http://fedoraproject.org/wiki/Features/XenPvops"&gt;F9 feature page&lt;/a&gt;
with some amount of info about the plan.
&lt;/p&gt;

&lt;p&gt;
In terms of Fedora 6/7/8 maintainence... The kernel-xen in these existing 
releases already lags behind the bare metal kernel version by 2-3 releases.
We do not intend to continue trying to rebase the kernel-xen in existing
Fedora releases. It will be essentially important bug-fix mode only. This
is neccessary to enable maximum resources to be focused on the critical
Fedora 9 Xen work.
&lt;/p&gt;
&lt;p&gt;
This broadcast was on behalf of some very busy Fedora Xen kernel developers :-)
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/5291104927250988108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=5291104927250988108' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/5291104927250988108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/5291104927250988108'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/11/plan-for-xen-kernels-in-fedora-9' title='The plan for Xen kernels in Fedora 9'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-3350215080810959529</id><published>2007-11-05T18:44:00.000Z</published><updated>2007-11-06T00:26:29.253Z</updated><title type='text'>Announcing a libvirt CIM provider</title><content type='html'>&lt;p&gt;
For the short story, &lt;a href="http://www.redhat.com/archives/libvir-list/2007-November/msg00023.html"&gt;read the announcement&lt;/a&gt;. For the long story, read on.....
&lt;/p&gt;

&lt;p&gt;
The &lt;a href="http://libvirt.org/"&gt;libvirt&lt;/a&gt; project provides a hypervisor agnostic API for managing virtual machines (and their associated resources like their network &amp; storage). The libvirt API has 3 core characteristics - simplicity - minimal code required to get useful work done; standard - the same API can be used across any virtualization backend; stable - guarenteed stable public API and XML descriptions across releases. In the short time it has been around, libvirt has proved impressively popular, finding its way in all the main Linux distributions, as well as Open Solaris. There are drivers in libvirt for Xen, QEMU, KVM, OpenVZ and soon Linux-VServer. If someones contributes VMWare, UML, and VirtualBox support we'll basically have complete coverage for all common Linux virtualization platforms in a single open source API, usable by open &amp; closed source apps alike (libvirt is LGPL licensed explicitly to enable use by closed source apps).
&lt;/p&gt;
&lt;p&gt;
In the enterprise world, people like to form committees to come up with comprehensive standards to cover everything you can think of, and then go off and write multiple implementations of these standards ;-) For virtualization, the 'standard' is based around the DMTF / CIM specification. Pretty much since the start of the libvirt project, people have asked why we didn't just implement the CIM APIs directly. We always wanted the core of our public APIs to be simpler to use though. At the same time, we recognise that some people really want to use a CIM API for their virtualization management tools. Thus we've always supported the idea of writing a CIM provider on top of libvirt. Not only would this mean only a single CIM provider implementation is needed for all of the virt platforms supported in libvirt, but it gives good interoperability between tools using libvirt vs CIM.
&lt;/p&gt;
&lt;p&gt;
Over the past year &amp; a half (or more), the Xen project has developed a CIM provider using the Xen-API as the underlying implementation. Indeed at one time this actually used libvirt instead of Xen-API, but back when the switch was made to Xen-API, KVM wasn't around so the benefits of a hypervisor agnositic libvirt API were more hypothetical than tangible.  KVM does eventually appear on the scene &amp; sure enough, the topic of developing CIM providers for KVM soon comes up. KVM though doesn't have any form of existing management API to deal with - a KVM guest is 'managed' by running a QEMU process, and killing it when you're done. QEMU provides a mini admin shell for controlling various aspects of its behaviour. Turning this into a formal API is hard work - libvirt has already done it once and you don't want to have to duplicate that :-)
&lt;/p&gt;
&lt;p&gt;
At the recent KVM forum, IBM announced that they were going to develop a CIM provider based on libvirt, and release it to the open source community. Fast forward a few months and I'm happy to &lt;a href="http://www.redhat.com/archives/libvir-list/2007-November/msg00023.html"&gt;announce their plans have come to fruition&lt;/a&gt;. Furthermore, this is not just a 3rd party add-on, the CIM provider is to be a core part of the libvirt project &amp; ecosystem. We're collaborating on ideas, API requirements, hosting for our infrastructure (websites, SCM repos, mailing lists, IRC channels, etc) and above all working towards the common goal of providing &lt;em&gt;&lt;strong&gt;state-of-the-art open source management APIs, capable of working across any virtualization platform.&lt;/strong&gt;&lt;/em&gt;
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/3350215080810959529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=3350215080810959529' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/3350215080810959529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/3350215080810959529'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/11/announcing-libvirt-cim-provider' title='Announcing a libvirt CIM provider'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-4161717974607937844</id><published>2007-11-05T00:29:00.000Z</published><updated>2007-11-05T01:04:28.027Z</updated><title type='text'>VNC sessions on a 3-d spinning cube</title><content type='html'>&lt;p&gt;
In his &lt;a href="http://hoegsberg.blogspot.com/2007/08/redirected-direct-rendering.html"&gt;  recent blog posting&lt;/a&gt; on redirected direct renderering, Kristian happened to mention &lt;a href="http://clutter-project.org/"&gt;Clutter&lt;/a&gt;, a toolkit which allows you to do 3d graphics without first needing to acquire a PhD in OpenGL. I made a mental note to give it a try sometime. 
&lt;/p&gt;

&lt;p&gt;
On saturday I spent a few hours doing the major upgrade from Fedora 6 to Fedora 8 on my laptop &amp; desktop (skipping F7). I did it the crazy way, just changing my YUM config files &amp; letting it upgrade everything. I can't say it was a painless process, but I do finally have two working boxes on F8 now. I also took the opportunity to switch my IBM T60p laptop over to the Avivo driver, instead of the VESA driver &amp; which worked without a hitch.
&lt;/p&gt;

&lt;p&gt;
Back on topic. After the upgrade to F8, I poked at the repos and found that (nearly) all the Clutter related bits are packaged &amp; available to Fedora users already. There is just an annoying &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=365981"&gt;buildrequires missing&lt;/a&gt; in the python bindings spec file, which meant the RPM is missing the GTK &amp; GST APIs for clutter. A quick rebuild fixed that issue. You may remember I've been working on a &lt;a href="http://gtk-vnc.sourceforge.net/"&gt;GTK widget&lt;/a&gt; for displayed VNC sessions. One evil thought, led to another even more evil thought, and thus I ended up writing a &lt;a href="/~dan/gvncclutter.py"&gt;VNC viewer program&lt;/a&gt; which displays multiple VNC sessions on a spinning cube. To make it even more evil, I decided to not restrict it to a cube, and instead generalized to an arbitrary number of sides. 
&lt;/p&gt;
&lt;p&gt;
The results are spectacular, though a static screenshot doesn't really do it justice...&lt;br/&gt;
&lt;a href="/~dan/gvncclutter.png"&gt;&lt;img border="0" src="/~dan/gvncclutter-small.png" alt="VNC sessions on a 3d spinning hexagon"/&gt;&lt;/a&gt;
&lt;br/&gt;
Ctrl+Alt+PageUp/PageDown lets you rotate to the previous/next session respectively. The mouse &amp; keyboard events are fully plumbed in so you can actually interact with each session. In this example I just started 6 VNC server instances running TWM at 500x500 pixels, but they could have been real GNOME desktops too. The only issue is that I've not yet figured out how todo correct depth sorting of each desktops. You don't notice this problem in the screenshot, since I've just got them all rendering at 50% opacity ;-) It is impressively slow &amp; impressively fast at the same time. Slow because I'm using Avivo which doesn't have any real 3d rendering support yet; fast because I'm amazed it is actually working at all :-)
&lt;/p&gt;
&lt;p&gt;
Now to hook this all up into the next version of &lt;a href="http://virt-manager.org/"&gt;virt-manager&lt;/a&gt;..... just kidding ;-P
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/4161717974607937844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=4161717974607937844' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/4161717974607937844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/4161717974607937844'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/11/vnc-sessions-on-3-d-spinning-cube' title='VNC sessions on a 3-d spinning cube'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-1245100596584899172</id><published>2007-11-02T01:32:00.000Z</published><updated>2007-11-02T01:47:50.359Z</updated><title type='text'>News from the libvirt / virtualization universe</title><content type='html'>&lt;p&gt;
Alot has been going on in the libvirt universe recently as it continues on its path to world domination. A couple of days ago Daniel Hokka Zakrisson  (that's the 4th Daniel involved in libvirt!) surprised us all by &lt;a href="http://www.redhat.com/archives/libvir-list/2007-October/msg00273.html"&gt;announcing the start&lt;/a&gt; of a Linux-VServer driver for libvirt. This is the second container based virtualization driver, following on from the previous OpenVZ driver work. On the KVM front we now have support for save &amp; restore thanks to Jim Paris, and the Xen &amp; KVM drivers can also do CDROM media changes which will make Windows guest installs much more friendly. A bunch of work is taking place around NUMA to allow guests to be intelligently placed to take advantage of the capabilities of large NUMA boxes.
&lt;/p&gt;

&lt;p&gt;
I've been working on integrating SASL support into the remote management driver. This will augment our existing SSL/TLS + x509 security model, to provide fun stuff like Kerberos integration (single sign on!) and plain old username/password auth (with data encryption thrown in too though). This will tie in very nicely with the &lt;a href="http://freeipa.org/"&gt;FreeIPA&lt;/a&gt; project which is providing a way to get a pre-integrated Kerberos + LDAP solution for Linux users to compet with ActiveDirectory. I installed FreeIPA in a Fedora 7 guest a few weeks back and can say it is looking very impressive indeed.
&lt;/p&gt;

&lt;p&gt;
There have been lengthy discussions &amp; arguments about how to represent &amp; manage storage from within libvirt, which is a key requirement for being able to provision guest OS from a remote host. Once this all gets fleshed out we'll be able to manage plain old files, QCow/VMDK files,  LVM volumes, iSCSI volumes, disks/partitions and even FiberChannel with NPIV from within virt-manager and other libvirt based apps. This will improve the admin experiance significantly.
&lt;/p&gt;

&lt;p&gt;
&lt;a href="http://annexia.org/"&gt;Rich Jones&lt;/a&gt; has put together all sorts of fun apps ontop of libvirt in recent months. &lt;a href="http://et.redhat.com/~rjones/virt-top/"&gt;virt-top&lt;/a&gt; is a command line tool to provide a 'top' like display of CPU, disk &amp; network activity in all guest machines on a host. &lt;a href="http://et.redhat.com/~rjones/virt-p2v/"&gt;Virt-P2V&lt;/a&gt; is a Live CD based on Fedora which allows you to take an existing physical machine and turn its disk images into a virtual guest running under Xen / KVM fullvirt. &lt;a href="http://et.redhat.com/~rjones/nagios-virt/"&gt;Nagios-Virt&lt;/a&gt; is a plugin for the Nagios monitoring system which gives status on virtual machines. There are various other interesting admin tools along these lines in the works, so watch this space....
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/1245100596584899172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=1245100596584899172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/1245100596584899172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/1245100596584899172'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/11/news-from-libvirt-virtualization' title='News from the libvirt / virtualization universe'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-7235618952718864022</id><published>2007-09-05T21:54:00.000Z</published><updated>2007-09-05T22:23:17.266Z</updated><title type='text'>Remotely setting up remote access to a GNOME session</title><content type='html'>&lt;p&gt;
I've got many boxes for testing purposes and while often I can run graphical apps over SSH, every so often I really do need to run the app within a full GNOME session. For example, the incredible new PolicyKit app in Fedora 8 enables desktop applications to authenticate to gain extra privileges. PolicyKit uses ConsoleKit for its session tracking &amp; the ConsoleKit sessions are created by GDM when you initially login. Thus to test an application using PolicyKit you really do need to login via GDM and run a full GNOME session, not merely a X tunnel over SSH.  
&lt;/p&gt;
&lt;p&gt;
Now of course the critical times when I need to do this testing are when I'm not physically anywhere near the machine I need to test on. And invariably I've not left a login session active, nor even GNOME's 'remote desktop' access enabled. Traditionally I've just created a suitable VNC server startup file containing
&lt;/p&gt;
&lt;pre&gt;
$ cat $HOME/.vnc/xstartup
#!/bin/sh

[ -x /etc/vnc/xstartup ] &amp;&amp; exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] &amp;&amp; xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &amp;

unset DBUS_SESSION_BUS_ADDRESS
eval `dbus-launch --sh-syntax --exit-with-session`
exec  gnome-session
&lt;/pre&gt;
&lt;p&gt;
This gets me a full GNOME login session. Unfortunately there's no ConsoleKit session associated with this &amp; thus no possibility of using PolicyKit. GNOME itself though does come with VINO which can export your regular X session using the VNC protocol. If only I were logged into X on the machine's console &amp; running VINO. Argh.
&lt;/p&gt;
&lt;p&gt;
After much poking around I finally figured out a solution. First off, SSH to the box in question as your regular desktop user. Now we can use gconftool-2 to enable VINO. We need to enable it, enable authentication, set a password, turn off incoming connection prompts and possibily set an explicit port (if you have something else on the regular port 5900 - eg a Xen guest). 
&lt;/p&gt;
&lt;pre&gt;
# Disable local confirmation dialog for incoming connections
gconftool-2 --type bool --set /desktop/gnome/remote_access/prompt_enabled false

# Change VNC port to :9 instead of :0
gconftool-2 --type bool --set /desktop/gnome/remote_access/use_alternative_port true
gconftool-2 --type int --set /desktop/gnome/remote_access/alternative_port 5909

# Enable password auth
gconftool-2 --type list --list-type string --set /desktop/gnome/remote_access/authentication_methods '[vnc]'
PW=`echo 'mypassword' | base64`
gconftool-2 --type string --set /desktop/gnome/remote_access/vnc_password $PW

# Enable the VINO server
gconftool-2 --type bool --set /desktop/gnome/remote_access/enabled true
&lt;/pre&gt;

&lt;p&gt;
So that has the VINO server configured to run when I'm logged in, but as I mentioned already - I'm typically not logged in on the console when I need to be. For this challenge GDM comes to the rescue. It is possible change its config file to specify that a particular user will be automatically logged in the moment GDM starts. To do this edit /etc/gdm/custom.conf and add
&lt;/p&gt;
&lt;pre&gt;
[daemon]
AutomaticLogin=yourusername
AutomaticLoginEnable=true
&lt;/pre&gt;
&lt;p&gt;
A quick restart of GDM later, and I'm automatically logged into the remote box with a full GNOME session, including all the neccessary ConsoleKit magic. I can now connect with VNC and properly test virt-manager / PolicyKit integration. Yay.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/7235618952718864022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=7235618952718864022' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/7235618952718864022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/7235618952718864022'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/09/remotely-setting-up-remote-access-to' title='Remotely setting up remote access to a GNOME session'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-82219365109347682</id><published>2007-08-16T22:58:00.000Z</published><updated>2007-08-17T00:11:20.497Z</updated><title type='text'>How I learned to stop worrying and love IPv6</title><content type='html'>&lt;p&gt;
Any OS running Fedora Core 6 or later has IPv6 networking support enabled out of the box. Most people will never notice and/or care since they're only ever connected to IPv4 networks. A few months back now though I decided it was time to give IPv6 a try for real....
&lt;/p&gt;
&lt;p&gt;
I've got two servers on the Internet running in UserModeLinux guests, one running Debian, the other Fedora Core 6, and then a home network provided by a LinkSys router running OpenWRT White Russian. My goal was provide full IPv6 connectivity to all of them. 
&lt;/p&gt;
&lt;h3&gt;Home Router&lt;/h3&gt;
&lt;p&gt;
I tackled the problem of the home router first. The OpenWRT wiki has an &lt;a href="http://wiki.openwrt.org/IPv6_howto"&gt;IPv6 Howto&lt;/a&gt;, describing various setups. I decided to get a tunnel from the fine folks at &lt;a href="http://sixxs.net/"&gt;SixXS&lt;/a&gt;. My Verizon DSL only provides a dynamic IPv4 address and regular IPv6 over IPv4 tunnels require the server end to know the IPv4 address of your local endpoint. Obviously this is a bit of a problem with a dynamic IPv4 endpoint. SixXS though have a funky way around this in the form of their AICCU daemon which sets up a heartbeat from your local endpoint to their server. Thus should your IPv4 address ever change it can (securely with SSL) inform the server of your changed configuration. So I registered with SixXS, requested an IPv6 tunnel and a short while later they approved me. The service is open to anyone who wants IPv6 connectivity - the approval process is mainly to help avoid abuse &amp; frivilous requests. I was fortunate in that OCCAID are providing an IPv6 tunnel server just a few miles away in Boston - there's other tunnel servers dotted around but mostly concentrated in America or Europe at this time.
&lt;/p&gt;
&lt;p&gt;
With my IPv6 address allocated it and the OpenWRT guide handy my router was up &amp; running with IPv6 connectivity - I could do ping sites over IPv6 eg
&lt;/p&gt;
&lt;pre&gt;
# ping6 www.kame.net
PING www.kame.net (2001:200:0:8002:203:47ff:fea5:3085): 56 data bytes
64 bytes from 2001:200:0:8002:203:47ff:fea5:3085: icmp6_seq=0 ttl=50 time=513.2 ms
64 bytes from 2001:200:0:8002:203:47ff:fea5:3085: icmp6_seq=1 ttl=50 time=512.5 ms
64 bytes from 2001:200:0:8002:203:47ff:fea5:3085: icmp6_seq=2 ttl=50 time=519.5 ms
&lt;/pre&gt;
&lt;p&gt;
OpenWRT only ships with an IPv4 firewall as standard, so I quickly added ip6tables rules to deny all incoming traffic to the router. Even though port-scanning the entire IPv6 address space is not practical, only a tiny portion is active, and nearly all tunnels end up using addresses ending in :1 and :2, so a firewall is a must no matter what.
&lt;/p&gt;
&lt;h3&gt;Home Network&lt;/h3&gt;
&lt;p&gt;
To ensure you are serious about making use of their services, SixXS operate a credit system for admin requests. You start off with enough credits to request a IPv6 tunnel, but not enough to request an IPv6 subnet. To gain credits you have to prove you can keep the tunnel operational 24 hours a day for 7 days in a row - you then start gaining credits for each day's uptime. So I had a slight pause before I could move onto setting up the home network.
&lt;/p&gt;
&lt;p&gt;
Fortunately the LinkSys router is very reliable and so after a week I had enough uptime and thus enough credits to request an IPv6 subnet. In the brave new world of 128 bit addressing there's no shortage of addresses, so to simplify routing, whenever someone needs a block of addresses they'll typically be allocated an entire /48. That's right /48 - you'll be given more global IPv6 addresses for your personal use, than there are total IPv4 addresses in existance. Another interesting difference is that IPv6 subnets are not technically 'sold' - they are merely 'loaned' to end users. The upshot is that there's no issue of having to pay your stinkin' DSL/Cable ISP $$$ per month for one or two extra addresses.
&lt;/p&gt;
&lt;p&gt;
Having got the subnet allocated, the first step is to configure an IP address on the LAN interface of the LinkSys box. With OpenWRT this just required editing /etc/init.d/S40network to add  "ip -6 addr add 2001:XXXX:XXXX:XXXX::1/64 dev br0" (where 2001:XXXX:XXXX:XXXX is my subnet's prefix). When the various IPv6 protocols were specced out a big deal was made of the fact that there would be no NAT anywhere, and that client configuration would be completely automatic &amp; be able to dynamically reconfigure itself on the fly. The key to this is what they call a 'router advertisment daemon'. On Linux this is the 'radvd' program. If you only have a single outgoing net connection, and a single local network, then configuring it is incredibly easy. Simply edit /etc/radvd.conf file and fill in the IPv6 address prefix for your subnet as allocated by SixXS. Then start the daemon. 
&lt;/p&gt;
&lt;p&gt;
Remember I just mentioned network configuration would be automatic - well look at any Fedora box plugged into your local network at this point. You'll see they all just got globally routable IPv6 addresses assigned to their active network interfaces. Pop up a web browser and visit &lt;a href="http://kame.net/"&gt;Kame&lt;/a&gt; and you'll see an animated dancing turtle logo! IPv4 users only see a static image...
&lt;/p&gt;
&lt;h3&gt;Bytemark Server&lt;/h3&gt;
&lt;p&gt;
One of my web servers is running Debian in a User Mode Linux instance at &lt;a href="http://bytemark.co.uk"&gt;Bytemark&lt;/a&gt; in the UK. The good news is that Bytemark have already taken care of getting IPv6 connectivity into their network, so there's no need to use a tunnel on any server hosted by them. Simply ask their helpdesk to allocate you an IPv6 address from their pool, and add it to your primary ethernet address. Again don't forget to setup ip6tables firewall rules before doing this.
For Debian configuring the eth0 was a mere matter of editing /etc/network/interfaces and adding
&lt;/p&gt;
&lt;pre&gt;
iface eth0 inet6 static
        address 2001:XXXX:XXXX:XXXX::2
        netmask 64
        up ip route add 2000::/3 via 2001:XXXX:XXXX:XXXX::1
&lt;/pre&gt;
&lt;p&gt;
Again, with '2001:XXXX:XXXX:XXXX' being the address they allocated to your server.
Since SSH listens for IPv6 connections by default, with the interface address configured I could now SSH from my laptop at home to my server using IPv6. Type 'who' and you'll see a big long IPv6 address against your username if its working correctly.
&lt;/p&gt;
&lt;h3&gt;Linode Server&lt;/h3&gt;
&lt;p&gt;
My other web server is hosted by &lt;a href="http://linode.com/"&gt;Linode&lt;/a&gt;. Unfortunately they don't provide direct IPv6 connectivity so I had to use a tunnel. Since I do have a permanent static IPv4 address though I could use a regular IPv6-over-IPv4 tunnel rather than the dynamic heartbeat one I used at home with SixXS. For the sake of redundancy I decided to get my tunnel from a different provider, this time choosing &lt;a href="http://tunnelbroker.net/"&gt;Hurricane&lt;/a&gt;. When registering with them you provide a little contact info and the IPv4 address of your server. A short while later they'll typically approve the request &amp; activate their end of the tunnel. It is then a matter of configuring your end. This machine was running Fedora Core 6, so creating a tunnel requires adding a file /etc/sysconfig/network-scripts/ifcfg-sit1 containing something like
&lt;/p&gt;
&lt;pre&gt;
DEVICE=sit1
BOOTPROTO=none
ONBOOT=yes
IPV6INIT=yes
IPV6TUNNELIPV4=YY.YY.YY.YY
IPV6ADDR=2001:XXXX:XXXX:XXXX::2/64
&lt;/pre&gt;
&lt;p&gt;
Where YY.YY.YY.YY was the IPv4 address of hurricane's tunnel server, and 2001:XXXX:XXXX:XXXX was the IPv6 address prefix they allocated for my server. A quick ifup later and this server too has IPv6 connectivity.
&lt;/p&gt;
&lt;h3&gt;The summary&lt;/h3&gt;
&lt;p&gt;
This was all spread out over a couple of weeks, but by the end of it I had got both servers and my entire home network all operational with fully routable, global IPv6 connectivity. I have three differents types of IPv6 connectivity - direct (from Bytemark), static tunnel (from Hurricane), and a dynamic tunnel (from SixXS - they offer static tunnels too). If you have a static IPv4 address there's a fourth way to get connected called 6-to-4 which maps your Ipv4 address into the IPv6 space and uses anycast routing. With so many ways to get IPv6 connectivity it doesn't matter if your crappy DSL/Cable ISP doesn't offer IPv6 - simply take them out of the equation.
&lt;/p&gt;
&lt;p&gt;
One of the great things about being rid of NAT is that I can directly SSH into any machine at home from outside my network - no need for VPNs, or special reverse proxy rules through the NAT gateway. IPv6 addresses are crazily long, so the one final thing I did was to setup DNS entries for all my boxes, including a DNS zone for my home network. Remember how all clients on the home network auto-configure themselves, well this is done based on their network prefix and their MAC address, so they'll always auto-configure themselves to the same IPv6 address. Makes it easy to give them permanent DNS mappings, without needing to manually administer a DHCP server.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/82219365109347682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=82219365109347682' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/82219365109347682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/82219365109347682'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/08/how-i-learned-to-stop-worrying-and-love' title='How I learned to stop worrying and love IPv6'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4121334.post-3752357339509440991</id><published>2007-08-16T01:55:00.000Z</published><updated>2007-08-16T02:13:05.055Z</updated><title type='text'>Fedora 8 virtualization work-in-progress</title><content type='html'>&lt;p&gt;
For Fedora 8 we have quite an &lt;a href="http://fedoraproject.org/wiki/Releases/FeatureVirtSecurity"&gt;ambitious set of goals&lt;/a&gt; to improve security of the virtualization management stack. With the test2 date fast approaching things are starting to fall into place, although as ever its taken longer than expected. Should really have expected this since it requires getting code accepted in 3 upstream projects (Xen, QEMU, KVM), releases several brand new pieces of new software (GTK-VNC and Virt Viewer), and updating many others (Virt Manager &amp; virt-install).
&lt;/p&gt;
&lt;p&gt;
A couple of weeks ago &lt;a href="http://www.advogato.org/person/DV/"&gt;DV&lt;/a&gt; released an update of libvirt which includes support for secure remote management, either tunnelled over SSH, or directly connecting with TLS/SSL and x509 certificate authentication. This was the culmination of many months work by &lt;a href="http://libvirt.org/"&gt;Rich Jones&lt;/a&gt;, and review &amp; feedback by the rest of the &lt;a href="http://libvirt.org/"&gt;libvirt&lt;/a&gt; team. Oh, it also supports IPv6 out of the box - the only open source virtualization management software to support IPv6 for remote management.
&lt;/p&gt;
&lt;p&gt;
Yesterday I &lt;a href="http://lists.gnu.org/archive/html/qemu-devel/2007-08/msg00149.html"&gt;submitted&lt;/a&gt; another iteration of the my patches to add password authentication and the VeNCrypt extension to QEMU's VNC server. The latter allows VNC to be encrypted with SSL/TLS and authenticated with x509 certificates.
&lt;/p&gt;
&lt;p&gt;
Today I &lt;a href="http://lists.xensource.com/archives/html/xen-devel/2007-08/msg00351.html"&gt;submitted&lt;/a&gt; changes to Xen to remove the horrible VNC server implementation based on LibVNCServer . For those who don't know, LibVNCServer is a horrible hack which turns the vncserver code into a shared library for embedding in applications which need VNC server support. Unfortunately the code is utterly unintelligable, and has been retrofitted with multi-thread support which is completely and utterly broken. We've made countless fixes to the thread synchronization to address deadlocks &amp; crashes and still have no confidence that it is truely working correctly. So I'll be glad to see the back of LibVNCServer.
&lt;/p&gt;
&lt;p&gt;
Staying on the VNC theme, we announced the first official release of &lt;a href="http://gtk-vnc.sourceforge.net/"&gt;GTK-VNC&lt;/a&gt;. This is a GTK widget which provides a VNC client viewer. It provides a core library written in C, using coroutines to allow it to be completely asynchronous while remaining single threaded. A wrapper library using PyGTK provides access to the widget functionality from Python. Two example programs illustrate use of the widget by re-implementing the traditional 'vncviewer' in a few 10's of lines of code. The client is fully IPv6 aware, and as well as the traditional VNC authentication protocol, implements the VeNCrypt extension to provide secure TLS/SSL encrypted communications, optionally using x509 certificates to authenticate.
&lt;/p&gt;
&lt;p&gt;
Finally also announced the first release of &lt;a href="http://virt-manager.org"&gt;Virtual Machine Viewer&lt;/a&gt;, a lightweight, minimal UI for interacting with the graphical console from virtual machines. It is intended as a replacement for vncviewer, since it integrates with libvirt there is no need to tell it the VNC display address - just tell it the guest name, ID or UUID and it'll figure out the rest.
&lt;/p&gt;
&lt;p&gt;
There's still plenty of work to be done before Fedora 8 is released, but its starting to come together nicely. The forthcoming Fedora 8 release will again be leading the pack when it comes to open source virtualization management.
&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/3752357339509440991/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=4121334&amp;postID=3752357339509440991' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/3752357339509440991'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4121334/posts/default/3752357339509440991'/><link rel='alternate' type='text/html' href='http://berrange.com/personal/diary/2007/08/fedora-8-virtualization-work-in' title='Fedora 8 virtualization work-in-progress'/><author><name>Daniel</name><uri>http://www.blogger.com/profile/01271212689239436789</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>2</thr:total></entry></feed>