The storage_pool_host_ref table is usually used to build the relationship 
between storage pool and hypervisor host only. The local path in this table is 
not used by other code any more.
If you have specific requirement, such as store a path in this table, we can 
add it DefaultHostListener, or you subclass DefaultHostListener.
HypervisorHostListener is a callback you can use, in case of host up and down. 
If you don't care about this events, you don't need to use the 
DefaultHostListener at all.
>From cloudstack's point of view, the only requirement is that, there should be 
>one entry in storage_pool_host_ref for each host and its primary storage. As 
>you pointed out, we should remove the entry when hostDisconnected is called.
From: Mike Tutkowski [mailto:mike.tutkow...@solidfire.com]
Sent: Tuesday, October 22, 2013 12:28 PM
To: dev@cloudstack.apache.org; Edison Su
Subject: Question about StoragePoolHostVO

Hi Edison (or anyone else viewing this :) ),

I'm looking at the DefaultHostListener class you had written up a while ago.

A couple questions:

1) In the "else" below, it does not appear we update the DB with the local 
path. Is this correct behavior (this is just a snippet of the method, of 
course, but I didn't see any DB update related to this)?

2) As you know, my storage is zone wide. Should I be adding a row to this table 
for each host that connects to the management server that's in the same zone as 
my storage? Assuming I should, should I implement the hostDisconnected method 
to remove the row? The DefaultHostListener just returns true for the 
hostDisconnected method.

        StoragePoolHostVO poolHost = 
storagePoolHostDao.findByPoolHost(pool.getId(), hostId);
        if (poolHost == null) {
            poolHost = new StoragePoolHostVO(pool.getId(), hostId, 
mspAnswer.getPoolInfo().getLocalPath()
                    .replaceAll("//", "/"));
            storagePoolHostDao.persist(poolHost);
        } else {
            
poolHost.setLocalPath(mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", 
"/"));
        }
Thanks!

--
Mike Tutkowski
Senior CloudStack Developer, SolidFire Inc.
e: mike.tutkow...@solidfire.com<mailto:mike.tutkow...@solidfire.com>
o: 303.746.7302
Advancing the way the world uses the 
cloud<http://solidfire.com/solution/overview/?video=play>(tm)

Reply via email to