Lines Matching refs:self
1318 def __init__(self, task):
1321 Thread.__init__(self)
1323 self.task = task
1324 self.node = task.node
1325 self._state = states.DEPLOYWAIT
1326 self._error = None
1327 self.ssh_connection = None
1328 self.running = True
1331 def state(self):
1333 return self._state
1336 def error(self):
1338 return self._error
1340 def run(self):
1349 client = utils.ssh_connect(self._get_ssh_dict())
1355 self._state = states.DEPLOYFAIL
1356 self._error = str(err)
1357 self.stop()
1360 self._state = states.DEPLOYFAIL
1361 self._error = "Failed to establish SSH Connection with node."
1362 self.stop()
1371 while self.running:
1384 if self._string_in_file(tf, AI_SUCCESS_STRING):
1385 self._state = states.DEPLOYDONE
1388 self._state = states.DEPLOYFAIL
1389 self.stop()
1404 elif self._string_in_file(tf, AI_SUCCESS_STRING):
1406 self._state = states.DEPLOYDONE
1407 self.stop()
1411 elif self._string_in_file(tf, AI_FAILURE_STRING):
1413 self._state = states.DEPLOYFAIL
1414 self.stop()
1417 elif self._string_in_file(tf, AI_DEPLOY_STRING):
1420 self._state = states.DEPLOYING
1424 def stop(self):
1427 self.running = False
1429 def _string_in_file(self, fp, string):
1449 def _get_ssh_dict(self):
1456 driver_info = _parse_driver_info(self.node)
1480 def get_properties(self):
1484 def validate(self, task):
1595 def deploy(self, task):
1640 def tear_down(self, task):
1657 def prepare(self, task):
1858 def clean_up(self, task):
1926 def take_over(self, _task):
1935 def get_properties(self):
1939 def __init__(self):
1945 driver=self.__class__.__name__,
1950 def validate(self, task):
1964 def get_supported_boot_devices(self, task=None):
1989 def set_boot_device(self, task, device, persistent=False):
2021 if device not in self.get_supported_boot_devices(task=task):
2084 def get_boot_device(self, task):
2162 def get_sensors_data(self, task):
2190 def get_properties(self):
2194 def validate(self, task):
2207 def inspect_hardware(self, task):
2221 ipmi_props = self._get_ipmi_properties(task)
2251 cpu_props = self._get_cpu_cores(task, propdict['cpus'])
2267 self._create_port_if_not_exist(task.node, node_properties['mac'])
2271 def _get_ipmi_properties(self, task):
2297 def _get_cpu_cores(self, task, cpus):
2323 def _create_port_if_not_exist(self, node, mac):
2344 def __init__(self, task, name):
2351 self.task = task
2352 self.name = name
2353 self._clients = list()
2354 self._image_path = None
2355 self._manifests = list()
2356 self._profiles = list()
2357 self._ssh_obj = None
2358 self._derived_manifest = None
2361 def ssh_obj(self):
2364 if self._ssh_obj is None:
2365 self._ssh_obj = self._get_ssh_connection()
2366 return self._ssh_obj
2369 def manifests(self):
2372 if not self._manifests:
2373 self._manifests = self._get_manifest_names()
2374 return self._manifests
2377 def profiles(self):
2380 if not self._profiles:
2381 self._profiles = self._get_profile_names()
2382 return self._profiles
2385 def clients(self):
2388 if not self._clients:
2389 self._clients = self._get_all_client_names()
2390 return self._clients
2393 def exists(self):
2396 ai_cmd = "/usr/bin/pfexec /usr/sbin/installadm list -n " + self.name
2398 stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2402 if self.name != self._parse_service_name(stdout):
2408 def image_path(self):
2411 if self._image_path is None:
2412 self._image_path = self._get_image_path()
2413 return self._image_path
2416 def derived_manifest(self):
2419 if not self._derived_manifest:
2420 self._derived_manifest = CONF.ai.derived_manifest
2421 return self._derived_manifest
2423 def create_service(self, archive_uri):
2429 LOG.debug("AIService.create_service(): %s" % (self.name))
2433 mount_dir, temp_uar = _mount_archive(self.task, archive_uri)
2437 temp_uar = _fetch_uri(self.task, archive_uri)
2443 self.copy_remote_file(iso, remote_iso)
2463 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2464 self.name = uuid
2465 self._clients = []
2466 self._manifests = []
2467 self._profiles = []
2470 self.delete_remote_file(remote_iso)
2479 self.delete_remote_file(remote_iso)
2489 def delete_service(self):
2491 LOG.debug("AIService.delete_service():name: %s" % (self.name))
2493 " -r -y -n " + self.name
2496 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2499 _("Failed to delete AI Service %s") % (self.name))
2501 def create_client(self, mac, cpu_arch, archive_uri, auth_token,
2515 mac + " -n " + self.name
2538 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2550 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2558 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2563 self.delete_remote_file(custom_grub)
2565 self._clients = self._get_all_client_names()
2567 def delete_client(self, mac):
2576 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2582 self._clients = self._get_all_client_names()
2584 def create_manifest(self, manifest_name, manifest_path, mac):
2596 self.name + " -m " + manifest_name + " -f " + manifest_path + \
2599 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2605 self._manifests = self._get_manifest_names()
2607 def delete_manifest(self, manifest_name):
2616 manifest_name + " -n " + self.name
2618 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2624 self._manifests = self._get_manifest_names()
2626 def create_profile(self, profile_name, profile_path, mac, env):
2640 self.name + " -p " + profile_name + " -f " + profile_path + \
2647 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2653 self._profiles = self._get_profile_names()
2655 def delete_profile(self, profile_name):
2664 profile_name + " -n " + self.name
2666 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2672 self._profiles = self._get_profile_names()
2674 def copy_remote_file(self, local, remote):
2684 scp = SCPClient(self.ssh_obj.get_transport())
2690 def delete_remote_file(self, path):
2701 _stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2706 def _get_image_path(self):
2712 ai_cmd = "/usr/bin/pfexec /usr/sbin/installadm list -vn " + self.name
2713 stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd)
2722 def _parse_client(self, list_out):
2744 def _parse_service_name(self, list_out):
2761 def _get_ssh_connection(self):
2767 return utils.ssh_connect(self._get_ssh_dict())
2769 def _get_ssh_dict(self):
2812 def _get_manifest_names(self):
2818 ai_cmd = "/usr/bin/pfexec /usr/sbin/installadm list -mn " + self.name
2819 stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd,
2821 " for service %s") % (self.name))
2822 return self._parse_names(stdout)
2824 def _get_profile_names(self):
2830 ai_cmd = "/usr/bin/pfexec /usr/sbin/installadm list -pn " + self.name
2831 stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd,
2833 "service %s") % (self.name))
2834 return self._parse_names(stdout)
2836 def _get_all_client_names(self):
2843 stdout, _rc = _ssh_execute(self.ssh_obj, ai_cmd,
2845 "service %s") % (self.name))
2847 return [client.lower() for client in self._parse_names(stdout)]
2849 def _parse_names(self, list_out):