diff --git a/README b/README index cc0e63e..2113f2a 100644 --- a/README +++ b/README @@ -1,22 +1,21 @@ # Overview -The nova-compute-power charm deploys OpenStack to a set IBM Power8 servers running PowerKVM. +The nova-compute-power charm deploys openstack to a given Power8 compute node. # Usage To deploy a nova-compute-power service you have to have the following: * Generate a ssh key that the charm can use to login to the compute node - to start installing RPMS and configuration file. -* A yum repository which contains the appropriate IBM Openstack Icehouse + to start installing RPMS and configuration file +* A yum repository which contains the appropriate IBM Openstack Icehouse RPMs. -* sudo password-less configuration for the user on the compute node. +* Sudo password-less configured for the user on the compute node. Once you have this setup you must configure the charm as follow: 1. Place the key to the nova-compute node in the files directory of the charm. - 2. Create a config.yaml that has the following: * power-user: username used to access and configure the power node. diff --git a/config.yaml b/config.yaml index e1f95ce..1c08a61 100644 --- a/config.yaml +++ b/config.yaml @@ -7,6 +7,10 @@ options: type: string default: description: Username used to access POWER hypervisors. + power-key: + type: string + default: + description: SSH key to use to accesss POWER hypervisors. power-repo: type: string default: @@ -14,7 +18,7 @@ options: power-hosts: type: string default: - description: POWER hosts to manager; space delimited and must be IP addresses. + description: POWER hosts to manager; space delimited. power-password: type: string default: diff --git a/hooks/fabfile.py b/hooks/fabfile.py index 3c643d5..580746d 100644 --- a/hooks/fabfile.py +++ b/hooks/fabfile.py @@ -38,9 +38,8 @@ def add_bridge(bridge_name): def add_bridge_port(bridge_name, port): - sudo('ovs-vsctl -- --may-exist ' - 'add-port %s %s' % (bridge_name, - port)) + sudo('ovs-vsctl -- --may-exist add-port %s %s' % (bridge_name, + port)) sudo('ip link set %s up' % port) sudo('ip link set %s promisc on' % port) diff --git a/hooks/nova_compute_hooks.py b/hooks/nova_compute_hooks.py index 77ecbb8..a502dc6 100755 --- a/hooks/nova_compute_hooks.py +++ b/hooks/nova_compute_hooks.py @@ -28,6 +28,7 @@ from nova_compute_proxy import ( hooks = Hooks() CONFIGS = register_configs() proxy = POWERProxy(user=config('power-user'), + ssh_key=config('power-key'), hosts=config('power-hosts'), repository=config('power-repo'), password=config('power-password')) @@ -35,7 +36,7 @@ proxy = POWERProxy(user=config('power-user'), @hooks.hook() def install(): - apt_install('fabric', fatal=True) + apt_install(['fabric'], fatal=True) proxy.install() diff --git a/hooks/nova_compute_proxy.py b/hooks/nova_compute_proxy.py index 1d2eea7..59bfb66 100644 --- a/hooks/nova_compute_proxy.py +++ b/hooks/nova_compute_proxy.py @@ -56,24 +56,29 @@ CONFIG_FILES = [ class POWERProxy(): - def __init__(self, user, hosts, + def __init__(self, user, ssh_key, hosts, repository, password): - if None in [user, hosts, repository]: - raise ValueError('Missing configuration') + if None in [user, ssh_key, hosts, repository]: + raise Exception('Missing configuration') self.user = user + self.ssh_key = ssh_key self.hosts = hosts.split() self.repository = repository self.password = password + self.key_filename = self._write_key() self._init_fabric() + def _write_key(self): + return os.path.join(charm_dir(), 'files', self.ssh_key) + def _init_fabric(self): env.warn_only = True env.connection_attempts = 10 env.timeout = 10 env.user = self.user + env.key_filename = self.key_filename env.hosts = self.hosts env.password = self.password - env.use_ssh_config = True def install(self): self._setup_yum()