kvm: Add more log lines around storage pool operations

This commit is contained in:
Wido den Hollander 2014-04-17 17:42:17 +02:00
parent 74fe010db3
commit c9b22af6c7

View File

@ -338,12 +338,14 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
@Override @Override
public KVMStoragePool getStoragePool(String uuid) { public KVMStoragePool getStoragePool(String uuid) {
s_logger.debug("Trying to fetch storage pool " + uuid + " from libvirt");
StoragePool storage = null; StoragePool storage = null;
try { try {
Connect conn = LibvirtConnection.getConnection(); Connect conn = LibvirtConnection.getConnection();
storage = conn.storagePoolLookupByUUIDString(uuid); storage = conn.storagePoolLookupByUUIDString(uuid);
if (storage.getInfo().state != StoragePoolState.VIR_STORAGE_POOL_RUNNING) { if (storage.getInfo().state != StoragePoolState.VIR_STORAGE_POOL_RUNNING) {
s_logger.debug("Storage pool " + uuid + " was not found in libvirt. Attempting to create it");
storage.create(0); storage.create(0);
} }
LibvirtStoragePoolDef spd = getStoragePoolDef(conn, storage); LibvirtStoragePoolDef spd = getStoragePoolDef(conn, storage);
@ -437,6 +439,8 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
@Override @Override
public KVMStoragePool createStoragePool(String name, String host, int port, String path, String userInfo, StoragePoolType type) { public KVMStoragePool createStoragePool(String name, String host, int port, String path, String userInfo, StoragePoolType type) {
s_logger.info("Attempting to create storage pool " + name + " (" + type.toString() + ") in libvirt");
StoragePool sp = null; StoragePool sp = null;
Connect conn = null; Connect conn = null;
try { try {
@ -561,6 +565,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
@Override @Override
public boolean deleteStoragePool(String uuid) { public boolean deleteStoragePool(String uuid) {
s_logger.info("Attempting to remove storage pool " + uuid + " from libvirt");
Connect conn = null; Connect conn = null;
try { try {
conn = LibvirtConnection.getConnection(); conn = LibvirtConnection.getConnection();
@ -574,6 +579,7 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
try { try {
sp = conn.storagePoolLookupByUUIDString(uuid); sp = conn.storagePoolLookupByUUIDString(uuid);
} catch (LibvirtException e) { } catch (LibvirtException e) {
s_logger.debug("Storage pool " + uuid + " doesn't exist in libvirt. Assuming it is already removed");
return true; return true;
} }
@ -620,6 +626,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
public KVMPhysicalDisk createPhysicalDisk(String name, KVMStoragePool pool, public KVMPhysicalDisk createPhysicalDisk(String name, KVMStoragePool pool,
PhysicalDiskFormat format, Storage.ProvisioningType provisioningType, long size) { PhysicalDiskFormat format, Storage.ProvisioningType provisioningType, long size) {
s_logger.info("Attempting to create volume " + name + " (" + pool.getType().toString() + ") in pool "
+ pool.getUuid() + " with size " + size);
switch (pool.getType()){ switch (pool.getType()){
case RBD: case RBD:
return createPhysicalDiskOnRBD(name, pool, format, provisioningType, size); return createPhysicalDiskOnRBD(name, pool, format, provisioningType, size);
@ -718,6 +727,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
* To have RBD function properly we want RBD images of format 2 * To have RBD function properly we want RBD images of format 2
* libvirt currently defaults to format 1 * libvirt currently defaults to format 1
* *
* This has been fixed in libvirt 1.2.2, but that's not upstream
* in all distributions
*
* For that reason we use the native RBD bindings to create the * For that reason we use the native RBD bindings to create the
* RBD image until libvirt creates RBD format 2 by default * RBD image until libvirt creates RBD format 2 by default
*/ */
@ -800,6 +812,8 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
@Override @Override
public boolean deletePhysicalDisk(String uuid, KVMStoragePool pool) { public boolean deletePhysicalDisk(String uuid, KVMStoragePool pool) {
s_logger.info("Attempting to remove volume " + uuid + " from pool " + pool.getUuid());
/** /**
* RBD volume can have snapshots and while they exist libvirt * RBD volume can have snapshots and while they exist libvirt
* can't remove the RBD volume * can't remove the RBD volume
@ -870,6 +884,9 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
public KVMPhysicalDisk createDiskFromTemplate(KVMPhysicalDisk template, public KVMPhysicalDisk createDiskFromTemplate(KVMPhysicalDisk template,
String name, PhysicalDiskFormat format, Storage.ProvisioningType provisioningType, long size, KVMStoragePool destPool, int timeout) { String name, PhysicalDiskFormat format, Storage.ProvisioningType provisioningType, long size, KVMStoragePool destPool, int timeout) {
s_logger.info("Creating volume " + name + " from template " + template.getName() + " in pool " + destPool.getUuid() +
" (" + destPool.getType().toString() + ") with size " + size);
KVMPhysicalDisk disk = null; KVMPhysicalDisk disk = null;
if (destPool.getType() == StoragePoolType.RBD) { if (destPool.getType() == StoragePoolType.RBD) {