`<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 1, 2017 at 12:18 PM, Tomasz Kłoczko <span dir="ltr"><<a href="mailto:kloczko.tomasz@gmail.com" target="_blank">kloczko.tomasz@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'll share my method of importing images :)<div><br>AWS API provides uploading VHD image (for some reasons using other formats is not working).</div></div></blockquote><div><br></div><div>Works for VMDK as well. With VirtualBox, you get the somewhat<br></div><div>misleading "unsupported compression algorithm 0" error, which actually<br></div><div>means that the VMDK is in OVA format whereas the AWS API only<br>supports the OVF format.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>All what you need is create such image. On top of the Solaris is it quite easy. All what you need is VBox.</div><div>Such method is quite handy because using VboxManage command is possible to create, setup blank VM and boot it in batch mode.</div><div><br></div><div>Below is fragment of my script which could be used as template. It is for install Linux inside but it can be adapted to install any OS (Solaris as well)</div></div></div></blockquote><div><br></div><div>Have you tried this with Solaris or illumos?<br><br></div><div>It doesn't work, because the root ZFS pool embeds the physical paths<br></div><div>to the disk inside the pool, and the emulated disk devices that VBox<br></div><div>provides don't match what comes in an EC2 instance. So yes, you can<br></div><div>create an image, but at some point you need to fix the pool to have the<br></div><div>correct metadata.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>--</div><div># <a href="http://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html" target="_blank">http://www.perkin.org.uk/<wbr>posts/create-virtualbox-vm-<wbr>from-the-command-line.html</a></div><div>VBoxManage setproperty hwvirtexclusive off<br></div><div><br></div><div>VM=$1</div><div>MAC_ADDR="$2"</div><div><br></div><div>echo "Unregister $VM"</div><div>VBoxManage unregistervm $VM \</div><div><span style="white-space:pre-wrap"> </span>--delete</div><div>rm -rf $VM.vhd</div><div><br></div><div>echo "Create $VM.vhd image"</div><div>VBoxManage createmedium disk \</div><div><span style="white-space:pre-wrap"> </span>--size 5120 \</div><div><span style="white-space:pre-wrap"> </span>--format VHD \</div><div><span style="white-space:pre-wrap"> </span>--filename $VM.vhd</div><div><br></div><div>echo "Register $VM.vmdk image as Linux_64 VM" </div><div>VBoxManage createvm \</div><div><span style="white-space:pre-wrap"> </span>--name $VM \</div><div><span style="white-space:pre-wrap"> </span>--ostype "Linux_64" \</div><div><span style="white-space:pre-wrap"> </span>--register</div><div><br></div><div>echo "Add SATA controller to $VM"</div><div>VBoxManage storagectl $VM \</div><div><span style="white-space:pre-wrap"> </span>--name "SATA Controller" \</div><div><span style="white-space:pre-wrap"> </span>--add sata \</div><div><span style="white-space:pre-wrap"> </span>--controller IntelAHCI</div><div><br></div><div>VBoxManage storageattach $VM \</div><div><span style="white-space:pre-wrap"> </span>--storagectl "SATA Controller" \</div><div><span style="white-space:pre-wrap"> </span>--port 0 \</div><div><span style="white-space:pre-wrap"> </span>--device 0 \</div><div><span style="white-space:pre-wrap"> </span>--type hdd \</div><div><span style="white-space:pre-wrap"> </span>--medium $VM.vhd</div><div><br></div><div>echo "Add APIC"</div><div>VBoxManage modifyvm $VM --ioapic on</div><div><br></div><div>echo "Add boot sequence order"</div><div>VBoxManage modifyvm $VM --boot1 net --boot2 disk</div><div><br></div><div>echo "Add RAM, VRAM and enable RDP access"</div><div>VBoxManage modifyvm $VM \</div><div><span style="white-space:pre-wrap"> </span>--memory 4096 \</div><div><span style="white-space:pre-wrap"> </span>--vram 128 \</div><div><span style="white-space:pre-wrap"> </span>--vrde on</div><div><br></div><div>echo "Create $VM0 VNIC with exact MAC: $MAC_ADDR"</div><div>dladm create-vnic -l aggr0 -m $MAC_ADDR $VM0</div><div><br></div><div>echo "Network card"</div><div>VBoxManage modifyvm $VM \</div><div><span style="white-space:pre-wrap"> </span>--nic1 bridged \</div><div><span style="white-space:pre-wrap"> </span>--bridgeadapter1 $VM0 \</div><div><span style="white-space:pre-wrap"> </span>--macaddress1 080027f3399d</div><div><br></div><div>VBoxHeadless -startvm $VM</div><div><br></div><div>echo "Delete VM0 VNIC"</div><div>dladm delete-vnic $VM0</div><div><br></div><div>echo "Unregister $VM"</div><div>VBoxManage unregistervm $VM</div><div>mv $VM.vhd ready</div><div><br></div><div>ec2-import-instance $VM.vhd –f VHD -t m3.xlarge -a x86_64 -b myawsbucket -o AKIAIOSFODNN7EXAMPLE –w wJalrXUtnFEMI/K7MDENG/<wbr>bPxRfiCYEXAMPLEKEY -p Linux</div></div><div>-- </div><div><br></div><div>If kickstart file or AI manifest at the end of installation will be powering off VM "VBoxHeadless -startvm $VM" command will be able to finish and next steps can be done in batch mode like uploading just generated image to VMware, OVM, Azure or AWS.</div><div>BTW ec2-import-instance command: this command is a bit odd because you need to pass two keys. First one is account key and second one is AWS bucket key (even if AWS account has RW access to bucket).</div><div><a href="http://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html#upload-image" target="_blank">http://docs.aws.amazon.com/vm-<wbr>import/latest/userguide/<wbr>vmimport-image-import.html#<wbr>upload-image</a></div><div><br></div><div>Real advantage of using this method is sharing the same Linux KS or Solaris AI manifest/profile (or even Windows install profiles) with bare metal installation descriptions in form of native install descriptions.</div><div>Knowing exact MAC address of the VM used to create exact image is possible on install server side associate those MAC addresses with KS or AI files.</div><div><br></div><div>So .. you don't need to sit down upside down on you chair or use ISO images :)</div><div>All what is needed is possible to do in batch mode and/or using regular/native OS install services.</div><div><br></div><div>kloczek</div></div></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div><div class="m_-6816058988213555377gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Tomasz Kłoczko | Tel: 0774 1209067 | LinkedIn: <b style="font-weight:normal"><a href="http://lnkd.in/FXPWxH" style="text-decoration:none" target="_blank"><span style="font-size:13px;font-family:Arial;color:rgb(17,85,204);background-color:transparent;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap">http://lnkd.in/<wbr>FXPWxH</span></a></b></div></div></div></font></span><div><div class="h5">
<br><div class="gmail_quote">On 31 July 2017 at 21:51, Al Slater <span dir="ltr"><<a href="mailto:al.slater@scluk.com" target="_blank">al.slater@scluk.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On 31/07/17 21:30, Eric Sproul wrote:<br>
> On Mon, Jul 31, 2017 at 4:05 PM, Al Slater <<a href="mailto:al.slater@scluk.com" target="_blank">al.slater@scluk.com</a>> wrote:<br>
>> One more question though, is there any way to enable an SMF service for<br>
>> the next reboot, but not immediately. Specifically, I want to enable<br>
>> the initial-boot service with a .initialboot file in place, then create<br>
>> a new AMI.<br>
>><br>
>> I wist to use .initialboot to grab the instance configuration from<br>
>> amazon (hostname, root keys etc) and configure appropriately when the<br>
>> new instance starts.<br>
><br>
> Hi Al,<br>
> The initial-boot service isn't really suitable for this sort of thing.<br>
> You might want to check out<br>
> pkg://omnios/system/management<wbr>/ec2-credential which specifically<br>
> handles setting up the credentials at first boot. That could be<br>
> trivially extended[1] to set the system hostname and probably any<br>
> other "standard" thing that operators want.<br>
><br>
> Eric<br>
><br>
> [1] <a href="https://github.com/omniosorg/omnios-build/blob/master/build/ec2-credential/files/install-ec2-credential" rel="noreferrer" target="_blank">https://github.com/omniosorg/o<wbr>mnios-build/blob/master/build/<wbr>ec2-credential/files/install-<wbr>ec2-credential</a><br>
<br>
</span>Thanks for the pointer Eric.<br>
<span class="m_-6816058988213555377HOEnZb"><font color="#888888"><br>
--<br>
Al Slater<br>
</font></span><div class="m_-6816058988213555377HOEnZb"><div class="m_-6816058988213555377h5"><br>
______________________________<wbr>_________________<br>
OmniOS-discuss mailing list<br>
<a href="mailto:OmniOS-discuss@lists.omniti.com" target="_blank">OmniOS-discuss@lists.omniti.co<wbr>m</a><br>
<a href="http://lists.omniti.com/mailman/listinfo/omnios-discuss" rel="noreferrer" target="_blank">http://lists.omniti.com/mailma<wbr>n/listinfo/omnios-discuss</a><br>
</div></div></blockquote></div><br></div></div></div>
<br>______________________________<wbr>_________________<br>
OmniOS-discuss mailing list<br>
<a href="mailto:OmniOS-discuss@lists.omniti.com">OmniOS-discuss@lists.omniti.<wbr>com</a><br>
<a href="http://lists.omniti.com/mailman/listinfo/omnios-discuss" rel="noreferrer" target="_blank">http://lists.omniti.com/<wbr>mailman/listinfo/omnios-<wbr>discuss</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">-Peter Tribble<br><a href="http://www.petertribble.co.uk/" target="_blank">http://www.petertribble.co.uk/</a> - <a href="http://ptribble.blogspot.com/" target="_blank">http://ptribble.blogspot.com/</a></div>
</div></div>
`