[OmniOS-discuss] Omios, hvm and AWS

Tomasz Kłoczko kloczko.tomasz at gmail.com
Tue Aug 1 11:18:30 UTC 2017


I'll share my method of importing images :)

AWS API provides uploading VHD image (for some reasons using other formats
is not working).
All what you need is create such image. On top of the Solaris is it quite
easy. All what you need is VBox.
Such method is quite handy because using VboxManage command is possible to
create, setup blank VM and boot it in batch mode.

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)

--
#
http://www.perkin.org.uk/posts/create-virtualbox-vm-from-the-command-line.html
VBoxManage setproperty hwvirtexclusive off

VM=$1
MAC_ADDR="$2"

echo "Unregister $VM"
VBoxManage unregistervm $VM \
--delete
rm -rf $VM.vhd

echo "Create $VM.vhd image"
VBoxManage createmedium disk \
--size 5120 \
--format VHD \
--filename $VM.vhd

echo "Register $VM.vmdk image as Linux_64 VM"
VBoxManage createvm \
--name $VM \
--ostype "Linux_64" \
--register

echo "Add SATA controller to $VM"
VBoxManage storagectl $VM \
--name "SATA Controller" \
--add sata \
--controller IntelAHCI

VBoxManage storageattach $VM \
--storagectl "SATA Controller" \
--port 0 \
--device 0 \
--type hdd \
--medium $VM.vhd

echo "Add APIC"
VBoxManage modifyvm $VM --ioapic on

echo "Add boot sequence order"
VBoxManage modifyvm $VM --boot1 net --boot2 disk

echo "Add RAM, VRAM and enable RDP access"
VBoxManage modifyvm $VM \
--memory 4096 \
--vram 128 \
--vrde on

echo "Create $VM0 VNIC with exact MAC: $MAC_ADDR"
dladm create-vnic -l aggr0 -m $MAC_ADDR $VM0

echo "Network card"
VBoxManage modifyvm $VM \
--nic1 bridged \
--bridgeadapter1 $VM0 \
--macaddress1 080027f3399d

VBoxHeadless -startvm $VM

echo "Delete VM0 VNIC"
dladm delete-vnic $VM0

echo "Unregister $VM"
VBoxManage unregistervm $VM
mv $VM.vhd ready

ec2-import-instance $VM.vhd –f VHD -t m3.xlarge -a x86_64 -b myawsbucket -o
AKIAIOSFODNN7EXAMPLE –w wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY -p Linux
-- 

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.
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).
http://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-image-import.html#upload-image

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.
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.

So .. you don't need to sit down upside down on you chair or use ISO images
:)
All what is needed is possible to do in batch mode and/or using
regular/native OS install services.

kloczek

Tomasz Kłoczko | Tel: 0774 1209067 | LinkedIn: *http://lnkd.in/FXPWxH
<http://lnkd.in/FXPWxH>*

On 31 July 2017 at 21:51, Al Slater <al.slater at scluk.com> wrote:

> On 31/07/17 21:30, Eric Sproul wrote:
> > On Mon, Jul 31, 2017 at 4:05 PM, Al Slater <al.slater at scluk.com> wrote:
> >> One more question though, is there any way to enable an SMF service for
> >> the next reboot, but not immediately.  Specifically, I want to enable
> >> the initial-boot service with a .initialboot file in place, then create
> >> a new AMI.
> >>
> >> I wist to use .initialboot to grab the instance configuration from
> >> amazon (hostname, root keys etc) and configure appropriately when the
> >> new instance starts.
> >
> > Hi Al,
> > The initial-boot service isn't really suitable for this sort of thing.
> > You might want to check out
> > pkg://omnios/system/management/ec2-credential which specifically
> > handles setting up the credentials at first boot.  That could be
> > trivially extended[1] to set the system hostname and probably any
> > other "standard" thing that operators want.
> >
> > Eric
> >
> > [1] https://github.com/omniosorg/omnios-build/blob/master/
> build/ec2-credential/files/install-ec2-credential
>
> Thanks for the pointer Eric.
>
> --
> Al Slater
>
> _______________________________________________
> OmniOS-discuss mailing list
> OmniOS-discuss at lists.omniti.com
> http://lists.omniti.com/mailman/listinfo/omnios-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://omniosce.org/ml-archive/attachments/20170801/8aa48284/attachment.html>


More information about the OmniOS-discuss mailing list