summaryrefslogtreecommitdiffstats
path: root/patches/fuel-library/0004-Make-TestVM-creation-architecture-aware.patch
blob: 417727ecb09d0c45b7b75ea7f44658949e1f1076 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

@media only all and (prefers-color-scheme: dark) {
.highlight .hll { background-color: #49483e }
.highlight .c { color: #75715e } /* Comment */
.highlight .err { color: #960050; background-color: #1e0010 } /* Error */
.highlight .k { color: #66d9ef } /* Keyword */
.highlight .l { color: #ae81ff } /* Literal */
.highlight .n { color: #f8f8f2 } /* Name */
.highlight .o { color: #f92672 } /* Operator */
.highlight .p { color: #f8f8f2 } /* Punctuation */
.highlight .ch { color: #75715e } /* Comment.Hashbang */
.highlight .cm { color: #75715e } /* Comment.Multiline */
.highlight .cp { color: #75715e } /* Comment.Preproc */
.highlight .cpf { color: #75715e } /* Comment.PreprocFile */
.highlight .c1 { color: #75715e } /* Comment.Single */
.highlight .cs { color: #75715e } /* Comment.Special */
.highlight .gd { color: #f92672 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gi { color: #a6e22e } /* Generic.Inserted */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #75715e } /* Generic.Subheading */
.highlight .kc { color: #66d9ef } /* Keyword.Constant */
.highlight .kd { color: #66d9ef } /* Keyword.Declaration */
.highlight .kn { color: #f92672 } /* Keyword.Namespace */
.highlight .kp { color: #66d9ef } /* Keyword.Pseudo */
.highlight .kr { color: #66d9ef } /* Keyword.Reserved */
.highlight .kt { color: #66d9ef } /* Keyword.Type */
.highlight .ld { color: #e6db74 } /* Literal.Date */
.highlight .m { color: #ae81ff } /* Literal.Number */
.highlight .s { color: #e6db74 } /* Literal.String */
.highlight .na { color: #a6e22e } /* Name.Attribute */
.highlight .nb { color: #f8f8f2 } /* Name.Builtin */
.highlight .nc { color: #a6e22e } /* Name.Class */
.highlight .no { color: #66d9ef } /* Name.Constant */
.highlight .nd { color: #a6e22e } /* Name.Decorator */
.highlight .ni { color: #f8f8f2 } /* Name.Entity */
.highlight .ne { color: #a6e22e } /* Name.Exception */
.highlight .nf { color: #a6e22e } /* Name.Function */
.highlight .nl { color: #f8f8f2 } /* Name.Label */
.highlight .nn { color: #f8f8f2 } /* Name.Namespace */
.highlight .nx { color: #a6e22e } /* Name.Other */
.highlight .py { color: #f8f8f2 } /* Name.Property */
.highlight .nt { color: #f92672 } /* Name.Tag */
.highlight .nv { color: #f8f8f2 } /* Name.Variable */
.highlight .ow { color: #f92672 } /* Operator.Word */
.highlight .w { color: #f8f8f2 } /* Text.Whitespace */
.highlight .mb { color: #ae81ff } /* Literal.Number.Bin */
.highlight .mf { color: #ae81ff } /* Literal.Number.Float */
.highlight .mh { color: #ae81ff } /* Literal.Number.Hex */
.highlight .mi { color: #ae81ff } /* Literal.Number.Integer */
.highlight .mo { color: #ae81ff } /* Literal.Number.Oct */
.highlight .sa { color: #e6db74 } /* Literal.String.Affix */
.highlight .sb { color: #e6db74 } /* Literal.String.Backtick */
.highlight .sc { color: #e6db74 } /* Literal.String.Char */
.highlight .dl { color: #e6db74 } /* Literal.String.Delimiter */
.highlight .sd { color: #e6db74 } /* Literal.String.Doc */
.highlight .s2 { color: #e6db74 } /* Literal.String.Double */
.highlight .se { color: #ae81ff } /* Literal.String.Escape */
.highlight .sh { color: #e6db74 } /* Literal.String.Heredoc */
.highlight .si { color: #e6db74 } /* Literal.String.Interpol */
.highlight .sx { color: #e6db74 } /* Literal.String.Other */
.highlight .sr { color: #e6db74 } /* Literal.String.Regex */
.highlight .s1 { color: #e6db74 } /* Literal.String.Single */
.highlight .ss { color: #e6db74 } /* Literal.String.Symbol */
.highlight .bp { color: #f8f8f2 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #a6e22e } /* Name.Function.Magic */
.highlight .vc { color: #f8f8f2 } /* Name.Vari
From ec3299c72eae195106092a646409564b5b3eb560 Mon Sep 17 00:00:00 2001
From: Stanislaw Kardach <stanislaw.kardach@caviumnetworks.com>
Date: Wed, 24 Feb 2016 20:08:24 +0100
Subject: [PATCH 10/20] Make TestVM creation architecture aware

This depends on cirros-testvm package to contain both amd64 and arm64
images.
---
 deployment/puppet/openstack/manifests/img/cirros.pp       |  8 ++++++--
 .../osnailyfacter/manifests/generate_vms/vm_config.pp     | 11 +++++++++++
 deployment/puppet/osnailyfacter/templates/vm_libvirt.erb  | 15 ++++++++++++++-
 files/fuel-migrate/fuel-migrate                           |  5 ++++-
 4 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/deployment/puppet/openstack/manifests/img/cirros.pp b/deployment/puppet/openstack/manifests/img/cirros.pp
index 84e202e..cff06e0 100644
--- a/deployment/puppet/openstack/manifests/img/cirros.pp
+++ b/deployment/puppet/openstack/manifests/img/cirros.pp
@@ -9,6 +9,10 @@ class openstack::img::cirros (
   $img_name = 'cirros',
   $os_name = 'cirros',
 ) {
+  $arch = $::architecture ? {
+      /(arm64|aarch64)/ => 'aarch64',
+      default           => 'x86_64',
+  }
 
   package { 'cirros-testvm':
     ensure => "present"
@@ -17,14 +21,14 @@ class openstack::img::cirros (
 case $::osfamily {
   'RedHat': {
   exec { 'upload-img':
-    command => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} add name=${img_name} is_public=${public} container_format=${container_format} disk_format=${disk_format} distro=${os_name} < /opt/vm/cirros-x86_64-disk.img",
+    command => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} add name=${img_name} is_public=${public} container_format=${container_format} disk_format=${disk_format} distro=${os_name} < /opt/vm/cirros-${arch}-disk.img",
     unless => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index && (/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index | grep ${img_name})",
 
     }
   }
   'Debian': {
   exec { 'upload-img':
-    command => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} add name=${img_name} is_public=${public} container_format=${container_format} disk_format=${disk_format} distro=${os_name} < /usr/share/cirros-testvm/cirros-x86_64-disk.img",
+    command => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} add name=${img_name} is_public=${public} container_format=${container_format} disk_format=${disk_format} distro=${os_name} < /usr/share/cirros-testvm/cirros-${arch}-disk.img",
     unless => "/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index && (/usr/bin/glance -N ${os_auth_url} -T ${os_tenant_name} -I ${os_username} -K ${os_password} index | grep ${img_name})",
 
     }
diff --git a/deployment/puppet/osnailyfacter/manifests/generate_vms/vm_config.pp b/deployment/puppet/osnailyfacter/manifests/generate_vms/vm_config.pp
index 70fef32..dfefcbe 100644
--- a/deployment/puppet/osnailyfacter/manifests/generate_vms/vm_config.pp
+++ b/deployment/puppet/osnailyfacter/manifests/generate_vms/vm_config.pp
@@ -4,6 +4,17 @@ define osnailyfacter::generate_vms::vm_config(
   $details = $name
   $id = $details['id']
 
+  case $::architecture {
+    'arm64', 'aarch64': {
+      $machine_arch = 'aarch64'
+      $machine_type = 'virt'
+    }
+    default: {
+      $machine_arch = 'x86_64'
+      $machine_type = 'pc-i440fx-trusty'
+    }
+  }
+
   file { "${template_dir}/template_${id}_vm.xml":
     owner   => 'root',
     group   => 'root',
diff --git a/deployment/puppet/osnailyfacter/templates/vm_libvirt.erb b/deployment/puppet/osnailyfacter/templates/vm_libvirt.erb
index ae2ba5b..64e716d 100644
--- a/deployment/puppet/osnailyfacter/templates/vm_libvirt.erb
+++ b/deployment/puppet/osnailyfacter/templates/vm_libvirt.erb
@@ -3,14 +3,23 @@
   <memory unit='GiB'><%= @details['mem'] %></memory>
   <vcpu placement='static'><%= @details['cpu'] %></vcpu>
   <os>
-    <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
+    <type arch='<%= @machine_arch %>' machine='<%= @machine_type %>'>hvm</type>
+  <% if  == 'aarch64' %>
+    <kernel>/var/lib/nova/<%= @details['id'] %>_vm.kernel</kernel>
+    <initrd>/var/lib/nova/<%= @details['id'] %>_vm.initramfs</initrd>
+    <cmdline>root=/dev/vda1 rw rootwait console=tty0 console=ttyS0 console=ttyAMA0</cmdline>
+  <% else %>
     <boot dev='network'/>
     <boot dev='hd'/>
+  <% end %>
   </os>
   <features>
     <acpi/>
     <apic/>
     <pae/>
+  <% if $machine_arch == 'aarch64' %>
+    <gic version='host' />
+  <% end %>
   </features>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>
@@ -57,7 +66,11 @@
     <input type='keyboard' bus='ps2'/>
     <graphics type='vnc' port='-1' autoport='yes'/>
     <video>
+<% if $machine_arch == 'aarch64' %>
+      <model type='vga' vram='9216' heads='1'/>
+<% else %>
       <model type='cirrus' vram='9216' heads='1'/>
+<% end %>
     </video>
     <memballoon model='virtio'>
     </memballoon>
diff --git a/files/fuel-migrate/fuel-migrate b/files/fuel-migrate/fuel-migrate
index a215e0a..7d5b6cd 100755
--- a/files/fuel-migrate/fuel-migrate
+++ b/files/fuel-migrate/fuel-migrate
@@ -176,6 +176,8 @@ create_vm(){
             exit 1
         fi
     fi
+    # figure out atchitecture of the destination
+    arch="$(virsh -c "${dkvm_uri}" nodeinfo | awk '/CPU model:/ { print $3}')"
     # create disk
     ssh "${dkvm_ip}" qemu-img create -f raw "${dkvm_folder}/${fvm_name}.img" "${fvm_disk_size}"
     # make template for virsh
@@ -185,13 +187,14 @@ create_vm(){
   <memory unit='MiB'>${fvm_ram}</memory>
   <vcpu >${fvm_cpu}</vcpu>
   <os>
-    <type arch='x86_64' >hvm</type>
+    <type arch='${arch}' >hvm</type>
     <boot dev='hd'/>
     <boot dev='network'/>
  </os>
   <features>
     <acpi/>
     <apic/>
+    ${arch/aarch64/<gic version='3'\/>}
   </features>
   <clock offset='utc'/>
   <on_poweroff>destroy</on_poweroff>