예제 #1
0
    def run(self):
        debug("run start")
        ChallengeBase.run(self)
        
        if self.check() is False:
            self.usage()
            sys.exit(-1)

        log("Building %d cloud servers" % self.cs_count)
        
        mycs=CloudServers(self.cs_count, "challenge7")
        self.servers = mycs.get_servers()

        log("Building and configuring lb ...")
        self.build_lb()

        wait = WaitingForTask(self.check_lb, [self.lb_name], sleep_time=5, max_timeout=1)
        if wait.wait_for_tasks() == False: 
            log("Aborting as the build of lb is taking too long; created lb and cloud servers will be deleted")
            self.delete_all()
            sys.exit(-1)

        self.show()
예제 #2
0
    def run(self):
        debug("run start")
        ChallengeBase.run(self)
        
        if self.check() is False:
            self.usage()
            sys.exit(-1)

        log("Building %d cloud servers" % self.cs_count)
        files={'/root/.ssh/authorized_keys': self.ssh_public_key }
        mycs=CloudServers(self.cs_count, self.server_prefix, image=self.image_id, flavor=self.flavor_id, 
                files=files )
        self.servers = mycs.get_servers()

        log("Building and configuring lb ...")
        self.build_lb()

        log("Building and configuring dns domain ...")
        self.build_dns()

        log("Backuping files to cloud files ...")
        self.backup_to_cloud_files()

        self.show()
예제 #3
0
    def build_cs(self):
        debug("build_cs start")

        self.network=self.cnw.create(self.network_name, cidr=self.network_range)
        self.network_id = self.network.get_server_networks(public=True, private=True)

        vols=[]
        for i in range(0, self.cs_count) :
            name="%s-%d" % (self.storage_name, i)
            vol = self.cbs.create(name=name, size=100, volume_type="SATA")
            vols.append(vol)

        self.volumes = vols

        mycs=CloudServers(self.cs_count, self.server_prefix, image=self.image_id, 
                flavor=self.flavor_id,
                nics=self.network_id)
        self.servers = mycs.get_servers() 

        for s, v in zip(self.servers, vols) : 
            debug("attaching volume %s to server %s" % (v.name, s.name))
            v.attach_to_instance(s, mountpoint="/dev/xvdd")

        self.wait_for_storage_to_be_attached()