Redhat or CentOS VMware Image Migration to Fujitsu K5 Platform

The following procedure can be used to assist in migrating an existing vmware Redhat or CentOS virtual machine to be ready for use within the Fujitsu K5 OpenStack IaaS platform. Once the process is complete the VM should be exported to an OVF format file and can then be imported into K5 using the process…

The following procedure can be used to assist in migrating an existing vmware Redhat or CentOS virtual machine to be ready for use within the Fujitsu K5 OpenStack IaaS platform.

Once the process is complete the VM should be exported to an OVF format file and can then be imported into K5 using the process defined in this blog.

Procedure to Migrate CentOS or RedHat vmware image to Fujitsu K5 OpenStack IaaS platform.

  1. Uninstallation of VMware Tools
    If VMware Tools is installed on the virtual server that you intend to migrate, uninstall it.

    # vmware-uninstall-tools.pl
    
  2. Installation of an SSH server
    Install an SSH server by following the procedure below.

    # yum install openssh-server
    # chkconfig sshd on
    # /etc/init.d/sshd restart
    
  3. Installation of cloud-init
    1. Installation of cloud-init

      # yum install http://download.fedoraproject.org/pub/epel/6/x86_64/epelrelease-6-8.noarch.rpm
      # yum -y install cloud-init.noarch cloud-utils-gworpart
      # yum -y install dracut-modules-growroot
      
    2. Editing of cloud-init configuration file “/etc/cloud/cloud.cfg”
      An example configuration is shown below.

      # cat /etc/cloud/cloud.cfg
      users:
      - default
      disable_root: 1
      ssh_pwauth: 1
      locale_configfile: /etc/sysconfig/i18n
      mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2' ]
      resize_rootfs_tmp: /dev
      ssh_deletekeys: 0
      ssh_genkeytypes: ~
      syslog_fix_perms: ~
      hostname: localhost.localdomain
      manage_etc_hosts: cloud-init_host
      user: vmimport
      cloud_init_modules:
      - migrator
      - bootcmd
      - write-files
      <--omitted-->
      system_info:
      default_user:
      name: centos
      lock_passwd: true
      gecos: Cloud User
      groups: [wheel, adm]
      sudo: ["ALL=(ALL) NOPASSWD:ALL"]
      shell: /bin/bash
      distro: rhel
      paths:
      cloud_dir: /var/lib/cloud
      templates_dir: /etc/cloud/templates
      ssh_svcname: sshd
      # vim:syntax=yaml
      

      Example of setting the host:

      hostname: <host name>
      manage_etc_hosts: cloud-init_host
      

      Example of specifying a general user name that connects via SSH:

      user: <user name>
      

       

      Important
      The user password that you specified for cloud-init and the created key pair are set for this user when you create a virtual server.

     

  4. Setting of the output destination of the boot log
    Change the setting so that the Kernel can write the boot logs to the ttyS0 device.

    1. Save /boot/grub.grub.conf.

      # cp -p /boot/grub/grub.conf /root/grub.conf.bak
      
    2. Edit /boot/grub/grub.conf and add the definition that enables the Kernel to write boot logs to the ttyS0 device to grub.

      # vi /boot/grub/grub.conf
      

      Add or change the serial definition as shown below:

      (Before) kernel /vmlinuz&lt;string omitted&gt; rhgb quiet
      (After) kernel /vmlinuz&lt;string omitted&gt; console=tty0 console=ttyS0,115200n8
      
  5. Setting of network (DHCP connection)
        Tip
    To connect a virtual server via a network using DHCP after importing the image, configure the settings shown below. When the fixed IP address is set, the same IP address is used for startup after importing the image.

    1. Enable NetworkManager.

      # yum -y install NetworkManager
      # chkconfig NetworkManager on
      # /etc/rc.d/init.d/NetworkManager start
      
    2. Check the setting of /etc/sysconfig/network-scripts/ifcfg-
      BOOTPROTO=dhcp
    3. Restart the network.

      # /etc/rc.d/init.d/NetworkManager restart
      
  6. Deletion of the MAC address
    1. Save the configuration file. If no configuration file exists, this operation is not required.

      # cp /etc/udev/rules.d/70-persistent-net.rules /etc/udev/rules.d/70-persistent-net.rules.bak
      # cp /lib/udev/rules.d/75-persistent-net-generator.rules /lib/udev/rules.d/75-persistent-net-generator.rules.bak
      
    2. Delete the MAC address information.

      # rm /etc/udev/rules.d/70-persistent-net.rules
      # rm /lib/udev/rules.d/75-persistent-net-generator.rules
      # touch /etc/udev/rules.d/70-persistent-net.rules
      # touch /lib/udev/rules.d/75-persistent-net-generator.rules
      
    3. Delete the MAC address information (the line that starts with “HWADDR=”) from /etc/sysconfig/network-scripts/ifcfg-.
    4. Restart the OS.

      # reboot
      
  7. Disabling of the firewall
    Disable the iptables service and the ipchains service.

    # service ipchains stop
    # service iptables stop
    # chkconfig ipchains off
    # chkconfig iptables off
    

Now, you can capture the virtual server images in ovf-format from the migration source environment and follow this post to upload the new image to K5 –  https://allthingscloud.eu/2016/07/29/uploading-a-custom-image-to-fujitsu-k5-uk-based-public-cloud/

 

Tags:

Leave a comment