Ask Your Question
0

attach HDD to /dev/sda?

asked 2019-02-06 08:10:38 -0500

Hitesh Bajaj gravatar image

Hi All,

I want to upload an iso image and create instance and install from this. I want to attach volume to /dev/sda and not /dev/vda to the instance. Please note that the iso has custom OS and it expects to find the had drive to be present in /dev/sda

Any suggestions....

TIA

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
1

answered 2019-02-07 03:30:58 -0500

eblock gravatar image

updated 2019-02-08 03:04:56 -0500

I just tried the following with Ocata (and Ceph as backend): I added image properties hw_scsi_model=virtio-scsi and hw_disk_bus=scsi to an ISO image. Launching that ISO without attached disks results in /dev/sda device name in the partitioner. Then I attach new (empty) volumes to that instance, both are recognized as sdb and sdc.

EDIT: Here's the command I'm using to create an instance from ISO attached with two volumes. Please note: this worked for me only with the already mentioned image properties for the ISO. Without them, the build fails because libvirt tries to allocate one volume as vda, the other as sda. This could be the result from the bug I created almost three years ago, which is still open.

nova boot --block-device source=image,id=<ISO_IMAGE>,dest=volume,size=5,shutdown=preserve,device=sda,bootindex=0 --block-device source=blank,dest=volume,size=5,shutdown=preserve,device=sdb,bootindex=1 --nic net-id=<NET_ID> --flavor 2 test1

This results in a running instance, trying to install from ISO, two volumes are attached: image description

edit flag offensive delete link more

Comments

OK, this is contrary to what i thought. Now that I think about it, of course image properties determine VM properties, so that this VM should indeed use SCSI instead of virtio.

Bernd Bausch gravatar imageBernd Bausch ( 2019-02-07 08:22:26 -0500 )edit

I tried setting image properties as shown. My volume wont connect to the instance. It tries to connect using /dev/sda and fails with error.

Hitesh Bajaj gravatar imageHitesh Bajaj ( 2019-02-07 08:40:19 -0500 )edit
0

answered 2019-02-06 08:35:05 -0500

When you boot an instance, you have a lot of flexibility how to attach a volume, including the driver. For example this should work (I didn't check):

nova boot ... --block-device id=IMAGE_ID,source=image,dest=local,bus=scsi,bootindex=0

Perhaps the openstack client has similar options.

edit flag offensive delete link more

Comments

You can also set global properties for that image (after upload) with openstack image set --property hw_scsi_model=virtio-scsi --property hw_disk_bus=scsi <IMAGE>, all instances are then started with /dev/sd* as hard disk.

eblock gravatar imageeblock ( 2019-02-06 09:46:53 -0500 )edit

Or you create that image with these properties: openstack image create --property hw_scsi_model=virtio-scsi --property hw_disk_bus=scsi ... <IMAGE>

eblock gravatar imageeblock ( 2019-02-06 09:47:33 -0500 )edit

I created an image of iso format with said properties: properties | hw_disk_bus='scsi', hw_scsi_model='virtio-scsi'

I then created an instance out of it to start the boot from iso. I then attached a empty volume already created.

It got attached to /dev/vda... Am i doing something wrong?

Hitesh Bajaj gravatar imageHitesh Bajaj ( 2019-02-06 11:58:30 -0500 )edit

The image properties don’t impact volume attachments. nova volume-attach and openstack server add volume don’t seem to provide that much control, but the API does.

Bernd Bausch gravatar imageBernd Bausch ( 2019-02-06 16:33:21 -0500 )edit

Or you attach the volume at boot time, using nova boot --block-device .... You can repeat the block-device option.

Bernd Bausch gravatar imageBernd Bausch ( 2019-02-06 16:34:32 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2019-02-06 08:10:38 -0500

Seen: 92 times

Last updated: Feb 08