Changeset 1661:8273ceb1c759
- 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:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1636
|
r1661
|
|
| 58 | 58 | |
| 59 | 59 | 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 = {} |
| 60 | 67 | |
| 61 | 68 | def verify(self): |
-
|
r1637
|
r1661
|
|
| 648 | 648 | def set_share_start(self): |
| 649 | 649 | self.resources['CPU'].clear_shares() |
| | 650 | self.resources['IPv4Address'].clear_shares() |
| 650 | 651 | |
| 651 | 652 | def configure_file_system( |
-
|
r1655
|
r1661
|
|
| 64 | 64 | capacity = cpu_info['cpu_khz'] * 1000 |
| 65 | 65 | self.set_min_capacity(capacity) |
| 66 | | self.__last_share = {} |
| 67 | 66 | |
| 68 | 67 | def is_available(self, requested_id, pref): |
| … |
… |
|
| 98 | 97 | |
| 99 | 98 | 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) |
| 101 | 100 | domain_info = self.__get_domain_info(account_name) |
| 102 | 101 | # Must set vcpus before checking if the domain is running |
| … |
… |
|
| 122 | 121 | x = domain_info['cpu_time'] |
| 123 | 122 | 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 = {} |
| 130 | 123 | |
| 131 | 124 | def get_total_capacity(self): |
| … |
… |
|
| 558 | 551 | def __init__( |
| 559 | 552 | 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): |
| 562 | 554 | """ |
| 563 | 555 | """ |
| … |
… |
|
| 666 | 658 | |
| 667 | 659 | def set_share(self, account_name, share, resource_id): |
| | 660 | self.last_share[account_name] = (share, resource_id) |
| 668 | 661 | domain_info = self.__get_domain_info(account_name) |
| 669 | 662 | |
-
|
r1648
|
r1661
|
|
| 214 | 214 | class Boot(object): |
| 215 | 215 | """Boot the virtual machine. |
| 216 | | If necessary, temporarily reserve memory to |
| 217 | | be able to boot, and then drop reservation. |
| 218 | 216 | """ |
| 219 | 217 | def __init__( |
| … |
… |
|
| 279 | 277 | config_file, i + 1), 'error_value': d.result} |
| 280 | 278 | return |
| 281 | | |
| | 279 | |
| | 280 | # Some resources need to be allocated after the boot is initiated |
| 282 | 281 | self.__resources['CPU'].set_last_share(account_name) |
| | 282 | self.__resources['IPv4Address'].set_last_share(account_name) |
| 283 | 283 | d = defer.Deferred() |
| 284 | 284 | self.__reactor.callLater( |