entities.py 文件源码

python
阅读 38 收藏 0 点赞 0 评论 0

项目:cyris 作者: crond-jaist 项目源码 文件源码
def setEntryPoint(self, instance_id, port, host_id):
        for clone_guest in self.getCloneGuestList():
            #if clone_guest.getGuestId() == "desktop" and clone_guest.getIndex() == 1:
            if clone_guest.getIsEntryPoint() == True and clone_guest.getIndex() == 1:
                self.entry_point.setAddr(clone_guest.getNicAddrDict()["eth0"])
        self.entry_point.setPort(port) 
        # Generate random account and passwd for entry point.
        s = string.lowercase+string.digits
        # OLD VERSION: Random suffix of 5 digits
        #account = "trainee{0}".format(''.join(random.sample(s,5)))
        # NEW VERSION: Use instance id as suffix (add 1 so as to start from 1)
        # Use leading zeros (up to 2 digits) to match current Moodle settings
        account = "trainee{number:02d}".format(number=(instance_id+1))
        passwd = ''.join(random.sample(s,10))
        self.entry_point.setAccount(account)
        self.entry_point.setPasswd(passwd)
        self.entry_point.setHostId(host_id)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号