On 08/25/2013 07:20 AM, Edison Su wrote:
There is a "bug" in libvirt 0.10.2+:

  /* Short-circuit if already mounted */
385<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l385>
     if ((rc = virStorageBackendFileSystemIsMounted(pool)) != 0) {
386<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l386>
         if (rc == 1) {
387<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l387>
             virReportError(VIR_ERR_OPERATION_INVALID,
388<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l388>
                            _("Target '%s' is already mounted"),
389<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l389>
                            pool->def->target.path);
390<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l390>
         }
391<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l391>
         return -1;
392<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l392>
     }
393<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=d305b063ffd9dd01683e9105cfc6902948537ca4;hb=HEAD#l393>

If the NFS mount point exists on KVM host, and if the libvirt storage is 
missing for some reason(BUG CLOUDSTACk-2729), then the storage pool will never 
be created in libvirt unless you stop all the VMs, and umount the mount point.

While, on libvirt 0.9.10, the code handles the situation is different:
    /* Short-circuit if already mounted */
409<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=1af12e67469bb4911067ed541a04bcf2d43251e3;hb=bca060a363d3679c37ecc8bfd17f25dfa0781abb#l409>
     if ((ret = virStorageBackendFileSystemIsMounted(pool)) != 0) {
410<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=1af12e67469bb4911067ed541a04bcf2d43251e3;hb=bca060a363d3679c37ecc8bfd17f25dfa0781abb#l410>
         if (ret < 0)
411<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=1af12e67469bb4911067ed541a04bcf2d43251e3;hb=bca060a363d3679c37ecc8bfd17f25dfa0781abb#l411>
             return -1;
412<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=1af12e67469bb4911067ed541a04bcf2d43251e3;hb=bca060a363d3679c37ecc8bfd17f25dfa0781abb#l412>
         else
413<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=1af12e67469bb4911067ed541a04bcf2d43251e3;hb=bca060a363d3679c37ecc8bfd17f25dfa0781abb#l413>
             return 0;
414<http://libvirt.org/git/?p=libvirt.git;a=blob;f=src/storage/storage_backend_fs.c;h=1af12e67469bb4911067ed541a04bcf2d43251e3;hb=bca060a363d3679c37ecc8bfd17f25dfa0781abb#l414>
     }

So please stay on libvirt 0.9.10, or ask Redhat to fix the issue.

I noticed this while testing with Ceph and libvirt 1.0.6 and I also had a NFS primary storage.

I don't know why the RedHat guys did this, but CloudStack users shouldn't encounter this when everything works as expected.

I worked around this a couple of times by placing the XML definition of the pool in /etc/libvirt/storage and then restarting libvirt. On startup it will read the pools and start them mounted or not.

Wido

Reply via email to