Can anyone tell me the function of these two files(IDS and LEASE)?


发件人: Qixiaozhen
发送时间: 2013年6月13日 21:57
收件人: ''
抄送: Luohao (brian); Wangshen (C); Xujunxi
主题: [About the IDS and LEASE file in VDSM] Why don't merge those two files into 
one file with the different file offset?

Hi, all

I hava a question about the IDS and lease file in the VDSM. In the demo code of 
sanlock, these two files are contained in the same file.

In the VDSM 4.09, the offset of IDS is 0. However, the value of offset in 
version 4.10 is 'SDM_LEASE_OFFSET = 512 * 2048'. The comment in the code 
explains that the differences for them are just for upgrade.

According to my understanding, the content of IDS file contains the current 
cluster lock of the domain, and those in Lease file are the heart-beat info.

Why don't merge those two files into one file with the different file offset? 
In 4.09/4.10, we maintance two files. I think that 'two files' is much more 
complex than 'one file'.

Could anyone explain this for me?


sample code in sanlock(version 2.7), the cluster lock and heart-beat info are 
contained in 'disk':

LOCKSPACE_NAME = "lockspace1"
RESOURCE_NAME = "resource1"

def main():
    print "Creating the sanlock disk"
    fd, disk = tempfile.mkstemp()                        # the lease file and 
ids file are contained in ‘disk’

    offset = sanlock.get_alignment(disk)

    SNLK_DISKS = [(disk, offset)]

    print "Registering to sanlock"
    fd = sanlock.register()

    print "Initializing '%s'" % (LOCKSPACE_NAME,)
    sanlock.write_lockspace(LOCKSPACE_NAME, disk)

    print "Initializing '%s' on '%s'" % (RESOURCE_NAME, LOCKSPACE_NAME)
    sanlock.write_resource(LOCKSPACE_NAME, RESOURCE_NAME, SNLK_DISKS)

    print "Acquiring the id '%i' on '%s'" % (HOST_ID, LOCKSPACE_NAME)
    sanlock.add_lockspace(LOCKSPACE_NAME, HOST_ID, disk)

        print "Acquiring '%s' on '%s'" % (RESOURCE_NAME, LOCKSPACE_NAME)
        sanlock.acquire(LOCKSPACE_NAME, RESOURCE_NAME, SNLK_DISKS, slkfd=fd,
        print "Releasing '%s' on '%s'" % (RESOURCE_NAME, LOCKSPACE_NAME)
        sanlock.release(LOCKSPACE_NAME, RESOURCE_NAME, SNLK_DISKS, slkfd=fd)
        print "Releasing the id '%i' on '%s'" % (HOST_ID, LOCKSPACE_NAME)
        sanlock.rem_lockspace(LOCKSPACE_NAME, HOST_ID, disk)

    print "Removing the sanlock disk"

if __name__ == '__main__':
vdsm-devel mailing list

Reply via email to