You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pd...@apache.org on 2015/03/08 15:32:56 UTC

[6/7] cloudstack-docs-admin git commit: split templates.rst

split templates.rst


Project: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/commit/9d3aae6f
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/tree/9d3aae6f
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/diff/9d3aae6f

Branch: refs/heads/master
Commit: 9d3aae6fbdac6a222d37604ff7ac3815336c6668
Parents: 04505ca
Author: Pierre-Luc Dion <pd...@apache.org>
Authored: Sun Mar 8 10:31:43 2015 -0400
Committer: Pierre-Luc Dion <pd...@apache.org>
Committed: Sun Mar 8 10:31:43 2015 -0400

----------------------------------------------------------------------
 source/templates/_convert_hyperv.rst |  88 ++++++++++++++
 source/templates/_import_ami.rst     | 192 ++++++++++++++++++++++++++++++
 source/templates/_password.rst       |  79 ++++++++++++
 3 files changed, 359 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/9d3aae6f/source/templates/_convert_hyperv.rst
----------------------------------------------------------------------
diff --git a/source/templates/_convert_hyperv.rst b/source/templates/_convert_hyperv.rst
new file mode 100644
index 0000000..9e15490
--- /dev/null
+++ b/source/templates/_convert_hyperv.rst
@@ -0,0 +1,88 @@
+Converting a Hyper-V VM to a Template
+-------------------------------------
+
+To convert a Hyper-V VM to a XenServer-compatible CloudStack template,
+you will need a standalone XenServer host with an attached NFS VHD SR.
+Use whatever XenServer version you are using with CloudStack, but use
+XenCenter 5.6 FP1 or SP2 (it is backwards compatible to 5.6).
+Additionally, it may help to have an attached NFS ISO SR.
+
+For Linux VMs, you may need to do some preparation in Hyper-V before
+trying to get the VM to work in XenServer. Clone the VM and work on the
+clone if you still want to use the VM in Hyper-V. Uninstall Hyper-V
+Integration Components and check for any references to device names in
+/etc/fstab:
+
+#. From the linux\_ic/drivers/dist directory, run make uninstall (where
+   "linux\_ic" is the path to the copied Hyper-V Integration Components
+   files).
+
+#. Restore the original initrd from backup in /boot/ (the backup is
+   named \*.backup0).
+
+#. Remove the "hdX=noprobe" entries from /boot/grub/menu.lst.
+
+#. Check /etc/fstab for any partitions mounted by device name. Change
+   those entries (if any) to mount by LABEL or UUID. You can get that
+   information with the blkid command.
+
+The next step is make sure the VM is not running in Hyper-V, then get
+the VHD into XenServer. There are two options for doing this.
+
+Option one:
+
+#. Import the VHD using XenCenter. In XenCenter, go to Tools>Virtual
+   Appliance Tools>Disk Image Import.
+
+#. Choose the VHD, then click Next.
+
+#. Name the VM, choose the NFS VHD SR under Storage, enable "Run
+   Operating System Fixups" and choose the NFS ISO SR.
+
+#. Click Next, then Finish. A VM should be created.
+
+Option two:
+
+#. Run XenConvert, under From choose VHD, under To choose XenServer.
+   Click Next.
+
+#. Choose the VHD, then click Next.
+
+#. Input the XenServer host info, then click Next.
+
+#. Name the VM, then click Next, then Convert. A VM should be created.
+
+Once you have a VM created from the Hyper-V VHD, prepare it using the
+following steps:
+
+#. Boot the VM, uninstall Hyper-V Integration Services, and reboot.
+
+#. Install XenServer Tools, then reboot.
+
+#. Prepare the VM as desired. For example, run sysprep on Windows VMs.
+   See `“Creating a Windows
+   Template” <#creating-a-windows-template>`_.
+
+Either option above will create a VM in HVM mode. This is fine for
+Windows VMs, but Linux VMs may not perform optimally. Converting a Linux
+VM to PV mode will require additional steps and will vary by
+distribution.
+
+#. Shut down the VM and copy the VHD from the NFS storage to a web
+   server; for example, mount the NFS share on the web server and copy
+   it, or from the XenServer host use sftp or scp to upload it to the
+   web server.
+
+#. In CloudStack, create a new template using the following values:
+
+   -  URL. Give the URL for the VHD
+
+   -  OS Type. Use the appropriate OS. For PV mode on CentOS, choose
+      Other PV (32-bit) or Other PV (64-bit). This choice is available
+      only for XenServer.
+
+   -  Hypervisor. XenServer
+
+   -  Format. VHD
+
+The template will be created, and you can create instances from it.

http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/9d3aae6f/source/templates/_import_ami.rst
----------------------------------------------------------------------
diff --git a/source/templates/_import_ami.rst b/source/templates/_import_ami.rst
new file mode 100644
index 0000000..b81829f
--- /dev/null
+++ b/source/templates/_import_ami.rst
@@ -0,0 +1,192 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information#
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+
+Importing Amazon Machine Images
+-------------------------------
+
+The following procedures describe how to import an Amazon Machine Image
+(AMI) into CloudStack when using the XenServer hypervisor.
+
+Assume you have an AMI file and this file is called CentOS\_6.2\_x64.
+Assume further that you are working on a CentOS host. If the AMI is a
+Fedora image, you need to be working on a Fedora host initially.
+
+You need to have a XenServer host with a file-based storage repository
+(either a local ext3 SR or an NFS SR) to convert to a VHD once the image
+file has been customized on the Centos/Fedora host.
+
+.. note:: 
+   When copying and pasting a command, be sure the command has pasted as 
+   a single line before executing. Some document viewers may introduce 
+   unwanted line breaks in copied text.
+
+To import an AMI:
+
+#. Set up loopback on image file:
+
+   .. code:: bash
+
+      # mkdir -p /mnt/loop/centos62
+      # mount -o loop  CentOS_6.2_x64 /mnt/loop/centos54
+
+#. Install the kernel-xen package into the image. This downloads the PV
+   kernel and ramdisk to the image.
+
+   .. code:: bash
+
+      # yum -c /mnt/loop/centos54/etc/yum.conf --installroot=/mnt/loop/centos62/ -y install kernel-xen
+
+#. Create a grub entry in /boot/grub/grub.conf.
+
+   .. code:: bash
+
+      # mkdir -p /mnt/loop/centos62/boot/grub
+      # touch /mnt/loop/centos62/boot/grub/grub.conf
+      # echo "" > /mnt/loop/centos62/boot/grub/grub.conf
+
+#. Determine the name of the PV kernel that has been installed into the
+   image.
+
+   .. code:: bash
+
+      # cd /mnt/loop/centos62
+      # ls lib/modules/
+      2.6.16.33-xenU  2.6.16-xenU  2.6.18-164.15.1.el5xen  2.6.18-164.6.1.el5.centos.plus  2.6.18-xenU-ec2-v1.0  2.6.21.7-2.fc8xen  2.6.31-302-ec2
+      # ls boot/initrd*
+      boot/initrd-2.6.18-164.6.1.el5.centos.plus.img boot/initrd-2.6.18-164.15.1.el5xen.img
+      # ls boot/vmlinuz*
+      boot/vmlinuz-2.6.18-164.15.1.el5xen  boot/vmlinuz-2.6.18-164.6.1.el5.centos.plus  boot/vmlinuz-2.6.18-xenU-ec2-v1.0  boot/vmlinuz-2.6.21-2952.fc8xen
+
+   Xen kernels/ramdisk always end with "xen". For the kernel version you
+   choose, there has to be an entry for that version under lib/modules,
+   there has to be an initrd and vmlinuz corresponding to that. Above,
+   the only kernel that satisfies this condition is
+   2.6.18-164.15.1.el5xen.
+
+#. Based on your findings, create an entry in the grub.conf file. Below
+   is an example entry.
+
+   .. code:: bash
+
+      default=0
+      timeout=5
+      hiddenmenu
+      title CentOS (2.6.18-164.15.1.el5xen)
+         root (hd0,0)
+         kernel /boot/vmlinuz-2.6.18-164.15.1.el5xen ro root=/dev/xvda 
+         initrd /boot/initrd-2.6.18-164.15.1.el5xen.img
+
+#. Edit etc/fstab, changing “sda1” to “xvda” and changing “sdb” to
+   “xvdb”.
+
+   .. code:: bash
+
+      # cat etc/fstab
+      /dev/xvda  /         ext3    defaults        1 1
+      /dev/xvdb  /mnt      ext3    defaults        0 0
+      none       /dev/pts  devpts  gid=5,mode=620  0 0
+      none       /proc     proc    defaults        0 0
+      none       /sys      sysfs   defaults        0 0
+
+#. Enable login via the console. The default console device in a
+   XenServer system is xvc0. Ensure that etc/inittab and etc/securetty
+   have the following lines respectively:
+
+   .. code:: bash
+
+      # grep xvc0 etc/inittab 
+      co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav
+      # grep xvc0 etc/securetty 
+      xvc0
+
+#. Ensure the ramdisk supports PV disk and PV network. Customize this
+   for the kernel version you have determined above.
+
+   .. code:: bash
+
+      # chroot /mnt/loop/centos54
+      # cd /boot/
+      # mv initrd-2.6.18-164.15.1.el5xen.img initrd-2.6.18-164.15.1.el5xen.img.bak
+      # mkinitrd -f /boot/initrd-2.6.18-164.15.1.el5xen.img --with=xennet --preload=xenblk --omit-scsi-modules 2.6.18-164.15.1.el5xen
+
+#. Change the password.
+
+   .. code:: bash
+
+      # passwd
+      Changing password for user root.
+      New UNIX password: 
+      Retype new UNIX password: 
+      passwd: all authentication tokens updated successfully.
+
+#. Exit out of chroot.
+
+   .. code:: bash
+
+      # exit
+
+#. Check `etc/ssh/sshd_config` for lines allowing ssh login using a
+   password.
+
+   .. code:: bash
+
+      # egrep "PermitRootLogin|PasswordAuthentication" /mnt/loop/centos54/etc/ssh/sshd_config  
+      PermitRootLogin yes
+      PasswordAuthentication yes
+
+#. If you need the template to be enabled to reset passwords from the
+   CloudStack UI or API, install the password change script into the
+   image at this point. See :ref:`adding-password-management-to-templates`.
+
+#. Unmount and delete loopback mount.
+
+   .. code:: bash
+
+      # umount /mnt/loop/centos54
+      # losetup -d /dev/loop0
+
+#. Copy the image file to your XenServer host's file-based storage
+   repository. In the example below, the Xenserver is "xenhost". This
+   XenServer has an NFS repository whose uuid is
+   a9c5b8c8-536b-a193-a6dc-51af3e5ff799.
+
+   .. code:: bash
+
+      # scp CentOS_6.2_x64 xenhost:/var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799/
+
+#. Log in to the Xenserver and create a VDI the same size as the image.
+
+   .. code:: bash
+
+      [root@xenhost ~]# cd /var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799
+      [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]#  ls -lh CentOS_6.2_x64
+      -rw-r--r-- 1 root root 10G Mar 16 16:49 CentOS_6.2_x64
+      [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-create virtual-size=10GiB sr-uuid=a9c5b8c8-536b-a193-a6dc-51af3e5ff799 type=user name-label="Centos 6.2 x86_64"
+      cad7317c-258b-4ef7-b207-cdf0283a7923
+
+#. Import the image file into the VDI. This may take 10–20 minutes.
+
+   .. code:: bash
+
+      [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-import filename=CentOS_6.2_x64 uuid=cad7317c-258b-4ef7-b207-cdf0283a7923
+
+#. Locate a the VHD file. This is the file with the VDI’s UUID as its
+   name. Compress it and upload it to your web server.
+
+   .. code:: bash
+
+      [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# bzip2 -c cad7317c-258b-4ef7-b207-cdf0283a7923.vhd > CentOS_6.2_x64.vhd.bz2
+      [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# scp CentOS_6.2_x64.vhd.bz2 webserver:/var/www/html/templates/

http://git-wip-us.apache.org/repos/asf/cloudstack-docs-admin/blob/9d3aae6f/source/templates/_password.rst
----------------------------------------------------------------------
diff --git a/source/templates/_password.rst b/source/templates/_password.rst
new file mode 100644
index 0000000..90a1b60
--- /dev/null
+++ b/source/templates/_password.rst
@@ -0,0 +1,79 @@
+.. Licensed to the Apache Software Foundation (ASF) under one
+   or more contributor license agreements.  See the NOTICE file
+   distributed with this work for additional information#
+   regarding copyright ownership.  The ASF licenses this file
+   to you under the Apache License, Version 2.0 (the
+   "License"); you may not use this file except in compliance
+   with the License.  You may obtain a copy of the License at
+   http://www.apache.org/licenses/LICENSE-2.0
+   Unless required by applicable law or agreed to in writing,
+   software distributed under the License is distributed on an
+   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+   KIND, either express or implied.  See the License for the
+   specific language governing permissions and limitations
+   under the License.
+
+
+.. _adding-password-management-to-templates:
+
+Adding Password Management to Your Templates
+--------------------------------------------
+
+CloudStack provides an optional password reset feature that allows users
+to set a temporary admin or root password as well as reset the existing
+admin or root password from the CloudStack UI.
+
+To enable the Reset Password feature, you will need to download an
+additional script to patch your template. When you later upload the
+template into CloudStack, you can specify whether reset admin/root
+password feature should be enabled for this template.
+
+The password management feature works always resets the account password
+on instance boot. The script does an HTTP call to the virtual router to
+retrieve the account password that should be set. As long as the virtual
+router is accessible the guest will have access to the account password
+that should be used. When the user requests a password reset the
+management server generates and sends a new password to the virtual
+router for the account. Thus an instance reboot is necessary to effect
+any password changes.
+
+If the script is unable to contact the virtual router during instance
+boot it will not set the password but boot will continue normally.
+
+
+Linux OS Installation
+~~~~~~~~~~~~~~~~~~~~~
+
+Use the following steps to begin the Linux OS installation:
+
+#. Download the script file cloud-set-guest-password:
+
+   -  `http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-password.in 
+      <http://download.cloud.com/templates/4.2/bindir/cloud-set-guest-password.in>`_
+
+#. Copy this file to /etc/init.d.
+
+   On some Linux distributions, copy the file to ``/etc/rc.d/init.d``.
+
+#. Run the following command to make the script executable:
+
+   .. code:: bash
+
+      chmod +x /etc/init.d/cloud-set-guest-password
+
+#. Depending on the Linux distribution, continue with the appropriate
+   step.
+
+   On Fedora, CentOS/RHEL, and Debian, run:
+
+   .. code:: bash
+
+      chkconfig --add cloud-set-guest-password
+
+
+Windows OS Installation
+~~~~~~~~~~~~~~~~~~~~~~~
+
+Download the installer, CloudInstanceManager.msi, from the `Download
+page <http://sourceforge.net/projects/cloudstack/files/Password%20Management%20Scripts/CloudInstanceManager.msi/download>`_
+and run the installer in the newly created Windows VM.