def _checkImageExists(self, imageId): self.printDetail('Checking image availability.') if self.noCheckImageUrl: printWarning('Image availability check is disabled.') return imageObject = Image(self.configHolder) imageObject.checkImageExists(imageId)
def _excludeTests(self, tests): if self.testsToExclude: for test in self.testsToExclude.split(","): try: tests.remove(test) except ValueError: printWarning("WARNING: Test '%s' not in a list of defined tests." % test)
def _addDefaultNetworkAcl(self): # * NET/#<id> USE (allow to use all networks by all users) for net_id in self._getVnetIdsFromVnetNames(): try: self.cloud.addNetworkAcl(hex(self.cloud.ACL_USERS["ALL"]), net_id, hex(self.cloud.ACL_RIGHTS["USE"])) except OneException, ex: printWarning("Couldn't add ACL on NET %i: %s" % (net_id, str(ex)))
def _assignCredentials(self): endpts_creds = json.loads(self.restEndpoints) try: creds = endpts_creds[self.msg_endpoint] except KeyError: printWarning("WARNING: no matching credentials for " + self.msg_endpoint) else: self.httpClient.addCredentials(creds["username"], creds["password"])
def _setupFrontend(self): if self._backupConfigFileExists(): printWarning("Policy validation backup file %s already exists, skipping configuration" % PolicyValidator.CONFIG_SAV) return printStep('Creating policy validation configuration file') self._backup() self._writeConfigFromTemplate()
def _addDefaultUserAcl(self): # * VM+IMAGE+TEMPLATE/* CREATE+INFO_POOL_MINE+INSTANTIATE __acls = "* VM+IMAGE+TEMPLATE/* CREATE+USE" users, resources, rights = self._getDefaultUserAcl() try: self.cloud.addUserAcl(users, resources, rights) except OneException, ex: printWarning("Couldn't add default user ACL [%s]. %s" % (__acls, str(ex)))
def _sunstoneService(self, action): cmd = 'su - %s -c "sunstone-server %s"' % (self.oneUsername, action) rc, output = self.system.executeCmdWithOutput(cmd, shell=True) if rc != 0: msg = "Failed to %s sunstone-server: %s" % (action, output) if action == 'start': printError(msg) else: printWarning(msg)
def _addCloudNode(self): # This just assumes that a node can't be added because it exists # already. A better implementation would check to see if it # really does exists and if so, returns the existing node id. try: return self.cloud.hostCreate(self.nodeAddr, self.infoDriver, self.virtDriver, self.transfertDriver) except OneException: printWarning('Couldn\'t add host, already present?') # The id is actually ignored, so this should be ok. return -1
def _createNetwork(self, networks, builder): for vnet in networks: try: self.cloud.networkCreate(builder(vnet)) except OneException as ex: printWarning("Couldn't create virtual network. Already present? %s" % str(ex))
def _setFrontendSystem(self): if not self.frontendIp or self.frontendIp == "127.0.0.1": printWarning("frontend_ip configuration parameter is %s, this is very likely not to work" % self.frontendIp) self.frontend = SystemFactory.getSystem(self.frontendSystem, self.configHolder)
def _startServicesFrontend(self): printWarning('No service to start on node for %s' % self.__class__.__name__)
def _setupFrontend(self): printWarning('Nothing to setup on frontend for %s' % self.__class__.__name__)
def _setupNode(self): printWarning('Nothing to setup on node for %s' % self.__class__.__name__)
def _installFrontend(self): printWarning('Nothing to install on frontend for %s' % self.__class__.__name__)
def _installNode(self): printWarning('Nothing to install on node for %s' % self.__class__.__name__)
def _warmXenNeedReboot(self): if self.hypervisor == 'xen': printWarning('\tPlease reboot the node on the Xen kernel to complete the installation')