@Override public boolean disconnectPhysicalDiskByPath(String localPath) { // we've only ever cleaned up ISOs that are NFS mounted String poolUuid = null; if (localPath != null && localPath.startsWith(_mountPoint) && localPath.endsWith(".iso")) { String[] token = localPath.split("/"); if (token.length > 3) { poolUuid = token[2]; } } else { return false; } if (poolUuid == null) { return false; } try { Connect conn = LibvirtConnection.getConnection(); conn.storagePoolLookupByUUIDString(poolUuid); deleteStoragePool(poolUuid); return true; } catch (LibvirtException ex) { return false; } catch (CloudRuntimeException ex) { return false; } }
protected String getMountPoint(NfsStoragePool storagePool) { StoragePool pool = null; String poolName = null; try { pool = LibvirtConnection.getConnection().storagePoolLookupByUUIDString(storagePool._poolUUID); if (pool != null) { StoragePoolInfo spi = pool.getInfo(); if (spi.state != StoragePoolState.VIR_STORAGE_POOL_RUNNING) { pool.create(0); } else { /* * Sometimes, the mount point is lost, even libvirt thinks * the storage pool still running */ } poolName = pool.getName(); } } catch (LibvirtException e) { s_logger.debug("Ignoring libvirt error.", e); } finally { try { if (pool != null) { pool.free(); } } catch (LibvirtException e) { s_logger.debug("Ignoring libvirt error.", e); } } return checkingMountPoint(storagePool, poolName); }
try { Connect conn = LibvirtConnection.getConnection(); storage = conn.storagePoolLookupByUUIDString(uuid); if (storage == null) { s_logger.debug("Libvirt storage pool " + uuid + " not found, removing from HA list");
sp = conn.storagePoolLookupByUUIDString(uuid); } catch (LibvirtException e) { s_logger.warn("Storage pool " + uuid + " doesn't exist in libvirt. Assuming it is already removed");
sp = conn.storagePoolLookupByUUIDString(name); if (sp != null && sp.isActive() == 0) { sp.undefine();
try { Connect conn = LibvirtConnection.getConnection(); storage = conn.storagePoolLookupByUUIDString(uuid);