You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by Mike Tutkowski <mi...@solidfire.com> on 2013/10/22 21:27:30 UTC

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.tutkowski@solidfire.com
o: 303.746.7302
Advancing the way the world uses the
cloud<http://solidfire.com/solution/overview/?video=play>
*™*

Re: Question about StoragePoolHostVO

Posted by Mike Tutkowski <mi...@solidfire.com>.
Thanks, Edison.

What I was noticing is when I attach a disk to a Stopped VM on KVM and then
try to start it, the operation was failing because my data disk did not
have a row in this table tying the host ID to the storage pool ID.

I modified my SolidFireHostListener class to create such a row and now it
works.


On Tue, Oct 22, 2013 at 4:52 PM, Edison Su <Ed...@citrix.com> wrote:

>  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.tutkowski@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.tutkowski@solidfire.com****
>
> o: 303.746.7302****
>
> Advancing the way the world uses the cloud<http://solidfire.com/solution/overview/?video=play>
> *™*****
>



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

RE: Question about StoragePoolHostVO

Posted by Edison Su <Ed...@citrix.com>.
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.tutkowski@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.tutkowski@solidfire.com<ma...@solidfire.com>
o: 303.746.7302
Advancing the way the world uses the cloud<http://solidfire.com/solution/overview/?video=play>(tm)