Changeset 1661:8273ceb1c759

Show
Ignore:
Timestamp:
06/13/08 16:19:41 (2 months ago)
Author:
klai@…
Branch:
default
Message:

Bring up IPv4Address resources during boot process rather than after, thus speeding up boot

Location:
src/Tycoon/Virtualization
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • src/Tycoon/Virtualization/Resources.py

    r1636 r1661  
    5858 
    5959        self.__accumulated_resources = {} 
     60        self.last_share = {} 
     61 
     62    def set_last_share(self, account_name): 
     63        self.set_share(*((account_name,) + self.last_share[account_name])) 
     64         
     65    def clear_shares(self): 
     66        self.last_share = {} 
    6067 
    6168    def verify(self): 
  • src/Tycoon/Virtualization/Xen.py

    r1637 r1661  
    648648    def set_share_start(self): 
    649649        self.resources['CPU'].clear_shares() 
     650        self.resources['IPv4Address'].clear_shares() 
    650651 
    651652    def configure_file_system( 
  • src/Tycoon/Virtualization/XenResources.py

    r1655 r1661  
    6464            capacity = cpu_info['cpu_khz'] * 1000 
    6565        self.set_min_capacity(capacity) 
    66         self.__last_share = {} 
    6766         
    6867    def is_available(self, requested_id, pref): 
     
    9897 
    9998    def set_share(self, account_name, share, num_vcpus=None): 
    100         self.__last_share[account_name] = share 
     99        self.last_share[account_name] = (share, num_vcpus) 
    101100        domain_info = self.__get_domain_info(account_name) 
    102101        # Must set vcpus before checking if the domain is running 
     
    122121            x = domain_info['cpu_time'] 
    123122        return x 
    124  
    125     def set_last_share(self, account_name): 
    126         self.set_share(account_name, self.__last_share[account_name]) 
    127          
    128     def clear_shares(self): 
    129         self.__last_share = {} 
    130123 
    131124    def get_total_capacity(self): 
     
    558551    def __init__( 
    559552        self, __reactor, __instances, __get_domain_info, __get_account_status, 
    560         __write_account, __get_state, __shutdown_vm, __xen_main, 
    561         __xen_server): 
     553        __write_account, __get_state, __shutdown_vm, __xen_main, __xen_server): 
    562554        """ 
    563555        """ 
     
    666658         
    667659    def set_share(self, account_name, share, resource_id): 
     660        self.last_share[account_name] = (share, resource_id) 
    668661        domain_info = self.__get_domain_info(account_name) 
    669662 
  • src/Tycoon/Virtualization/XenUtil.py

    r1648 r1661  
    214214class Boot(object): 
    215215    """Boot the virtual machine. 
    216     If necessary, temporarily reserve memory to 
    217     be able to boot, and then drop reservation. 
    218216    """ 
    219217    def __init__( 
     
    279277                    config_file, i + 1), 'error_value': d.result} 
    280278            return 
    281  
     279         
     280        # Some resources need to be allocated after the boot is initiated 
    282281        self.__resources['CPU'].set_last_share(account_name) 
     282        self.__resources['IPv4Address'].set_last_share(account_name) 
    283283        d = defer.Deferred() 
    284284        self.__reactor.callLater(