Andrew Bogott has submitted this change and it was merged.

Change subject: Revert "Set up a keypair for cold migration" and all followups.
......................................................................


Revert "Set up a keypair for cold migration" and all followups.

I'm going to try this via proper nova calls rather than our
current duct-tape-and-chewing-gum approach.

Change-Id: Icf249e79c0608cd368952619b0e180d1c7220d6c
---
M manifests/role/nova.pp
M modules/openstack/files/icehouse/virtscripts/cold-migrate
M modules/openstack/manifests/adminscripts.pp
D modules/openstack/manifests/nova/migrate.pp
4 files changed, 20 insertions(+), 95 deletions(-)

Approvals:
  Andrew Bogott: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/manifests/role/nova.pp b/manifests/role/nova.pp
index 5d72faa..603a1db4e 100644
--- a/manifests/role/nova.pp
+++ b/manifests/role/nova.pp
@@ -429,11 +429,6 @@
     class { 'openstack::spreadcheck':
         novaconfig => $novaconfig
     }
-
-    class { 'openstack::nova::migrate':
-        novaconfig => $novaconfig,
-        is_controller => true,
-    }
 }
 
 class role::nova::api {
@@ -582,10 +577,6 @@
             ensure => link,
             target => '/usr/bin/qemu-system-x86_64',
         }
-    }
-
-    class { 'openstack::nova::migrate':
-        novaconfig => $novaconfig
     }
 }
 
diff --git a/modules/openstack/files/icehouse/virtscripts/cold-migrate 
b/modules/openstack/files/icehouse/virtscripts/cold-migrate
index 00866b5..1f64726 100755
--- a/modules/openstack/files/icehouse/virtscripts/cold-migrate
+++ b/modules/openstack/files/icehouse/virtscripts/cold-migrate
@@ -3,16 +3,15 @@
 ### THIS FILE IS MANAGED BY PUPPET
 ### puppet:///modules/openstack/icehouse/virtscripts/cold-migrate
 #####################################################################
-if [ `whoami` != 'novamigrate' ]; then
-    echo "This script must be run as user 'novamigrate'"
-    exit 1
+ssh-add -l > /dev/null
+if [ "$?" != "0" ]
+then
+       echo "You must have a forwarded agent to use this script"
+       exit 1
 fi
-
-source ~/novaenv.sh
-
 if [ "$#" -ne 2 ]; then
-    echo "Usage:  $0 <instance-id> <destination-host>"
-    exit 1
+       echo "Usage:  $0 <instance-id> <destination-host>"
+       exit 1
 fi
 INSTANCE=$1
 TOHOST=$2
@@ -116,7 +115,3 @@
 echo "Rebooting the instance"
 echo ""
 nova start ${INSTANCE}
-echo "  ----    note  ---  "
-echo "For safety, the instance files on the old host (${FROMHOST}) have not 
been removed."
-echo "After verifying that the migration has completed safely, ssh to 
${FROMHOST} and"
-echo "  rm -rf /var/lib/nova/instances/${INSTANCE}"
diff --git a/modules/openstack/manifests/adminscripts.pp 
b/modules/openstack/manifests/adminscripts.pp
index 8f43f10..a350dec 100644
--- a/modules/openstack/manifests/adminscripts.pp
+++ b/modules/openstack/manifests/adminscripts.pp
@@ -17,10 +17,21 @@
 
     # Script to cold-migrate instances between compute nodes
     file { '/root/cold-migrate':
-        ensure => absent,
+        ensure => present,
+        source => 
"puppet:///modules/openstack/${openstack_version}/virtscripts/cold-migrate",
+        mode   => '0755',
+        owner  => 'root',
+        group  => 'root',
     }
+
+    # Script to migrate instance from one dc to another
+    # (specifically, pmtpa to eqiad)
     file { '/root/dc-migrate':
-        ensure => absent,
+        ensure => present,
+        source => 
"puppet:///modules/openstack/${openstack_version}/virtscripts/dc-migrate",
+        mode   => '0755',
+        owner  => 'root',
+        group  => 'root',
     }
 
     # Log analysis tool
diff --git a/modules/openstack/manifests/nova/migrate.pp 
b/modules/openstack/manifests/nova/migrate.pp
deleted file mode 100644
index 17160fb..0000000
--- a/modules/openstack/manifests/nova/migrate.pp
+++ /dev/null
@@ -1,72 +0,0 @@
-class openstack::nova::migrate(
-    $is_controller=false,
-    $novaconfig,
-    $openstack_version=$::openstack::version,
-){
-    # Set up users and scripts to permit cold-migration between compute nodes.
-    # This requires a keypair for scp
-    user { 'novamigrate':
-        ensure     => present,
-        name       => 'novamigrate',
-        shell      => '/bin/sh',
-        comment    => 'nova user for cold-migration',
-        gid        => 'nova',
-        managehome => true,
-        require    => Package['nova-common'],
-        system     => true,
-    }
-    ssh::userkey { 'novamigrate':
-        content  => secret('novamigrate/novamigrate.pub'),
-        require  => user['novamigrate'],
-        ensure   => present,
-    }
-    file { '/home/novamigrate/.ssh':
-        ensure  => directory,
-        owner   => 'novamigrate',
-        group   => 'nova',
-        mode    => '0700',
-        require => user['novamigrate'],
-    }
-
-    file { '/home/novamigrate/.ssh/id_rsa':
-        content => secret('novamigrate/novamigrate'),
-        owner   => 'novamigrate',
-        group   => 'nova',
-        mode    => '0600',
-        require => File['/home/novamigrate/.ssh'],
-    }
-
-    if ($is_controller) {
-        include passwords::openstack::nova
-        $wikitech_nova_ldap_user_pass = 
$passwords::openstack::nova::nova_ldap_user_pass
-        $nova_controller_hostname = $novaconfig['controller_hostname']
-        $nova_region = $::site
-
-        # Script to cold-migrate instances between compute nodes
-        file { '/home/novamigrate/cold-migrate':
-            ensure => present,
-            source => 
"puppet:///modules/openstack/${openstack_version}/virtscripts/cold-migrate",
-            mode   => '0755',
-            owner  => 'novamigrate',
-            group  => 'nova',
-        }
-
-        # Script to migrate instance from one dc to another
-        # (specifically, pmtpa to eqiad)
-        file { '/home/novamigrate/dc-migrate':
-            ensure => present,
-            source => 
"puppet:///modules/openstack/${openstack_version}/virtscripts/dc-migrate",
-            mode   => '0755',
-            owner  => 'novamigrate',
-            group  => 'nova',
-        }
-
-        # Handy script to set up environment for commandline nova magic
-        file { '/home/novamigrate/novaenv.sh':
-            content => template('openstack/novaenv.sh.erb'),
-            mode    => '0755',
-            owner   => 'novamigrate',
-            group   => 'nova',
-        }
-    }
-}

-- 
To view, visit https://gerrit.wikimedia.org/r/225486
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icf249e79c0608cd368952619b0e180d1c7220d6c
Gerrit-PatchSet: 1
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Andrew Bogott <[email protected]>
Gerrit-Reviewer: Andrew Bogott <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to