summaryrefslogtreecommitdiff
path: root/kolla/cmd
diff options
context:
space:
mode:
authorJeffrey Zhang <jeffrey.zhang@99cloud.net>2016-03-27 00:39:07 +0800
committerJeffrey Zhang <jeffrey.zhang@99cloud.net>2016-04-03 07:21:17 +0000
commit42420830f65c0a76ba8e7e1b6a8d2974dabb9cfa (patch)
tree750a6b81d5809f325e7ca45cc5944b84350dae64 /kolla/cmd
parent808d6baa448533b7dca98eca728c06d4323de22b (diff)
downloadkolla-42420830f65c0a76ba8e7e1b6a8d2974dabb9cfa.tar.gz
kolla-42420830f65c0a76ba8e7e1b6a8d2974dabb9cfa.zip
Implement nova-ssh container
Add a nova-ssh container to handle the `nova migrate` and `nova resize` case, in which the nova will use ssh to copy files between machines. Change-Id: Ie6675943f3aeabfbba8589d308d55b9c89d732db Closes-Bug: #1562141
Diffstat (limited to 'kolla/cmd')
-rwxr-xr-xkolla/cmd/genpwd.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/kolla/cmd/genpwd.py b/kolla/cmd/genpwd.py
index 728dd458b..70dbc0357 100755
--- a/kolla/cmd/genpwd.py
+++ b/kolla/cmd/genpwd.py
@@ -12,16 +12,29 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os
import random
import string
import uuid
import yaml
+from Crypto.PublicKey import RSA
+
+
+def generate_RSA(bits=2048):
+ new_key = RSA.generate(bits, os.urandom)
+ private_key = new_key.exportKey("PEM")
+ public_key = new_key.publickey().exportKey("OpenSSH")
+ return private_key, public_key
+
def main():
# These keys should be random uuids
uuid_keys = ['ceph_cluster_fsid', 'rbd_secret_uuid']
+ # SSH key pair
+ ssh_keys = ['nova_ssh_key']
+
# If these keys are None, leave them as None
blank_keys = ['docker_registry_password']
@@ -32,6 +45,16 @@ def main():
passwords = yaml.load(f.read())
for k, v in passwords.items():
+ if (k in ssh_keys and
+ (v is None
+ or v.get('public_key') is None
+ and v.get('private_key') is None)):
+ private_key, public_key = generate_RSA()
+ passwords[k] = {
+ 'private_key': private_key,
+ 'public_key': public_key
+ }
+ continue
if v is None:
if k in blank_keys and v is None:
continue