Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Dave Allan
On Wed, May 05, 2010 at 02:49:44PM -0600, Eric Blake wrote: > On 05/05/2010 02:48 PM, Dave Allan wrote: > >> > >> Great for SCSI, not so great for USB sticks: > >> > >> # hdparm -i /dev/sdb > > > > What does the following give you? > > > > scsi_id --whitelisted --replace-whitespace --device=/dev/

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Eric Blake
On 05/05/2010 02:48 PM, Dave Allan wrote: >> >> Great for SCSI, not so great for USB sticks: >> >> # hdparm -i /dev/sdb > > What does the following give you? > > scsi_id --whitelisted --replace-whitespace --device=/dev/sdb # scsi_id --whitelisted --replace-whitespace --device=/dev/sdb # echo $?

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Dave Allan
On Wed, May 05, 2010 at 01:56:20PM -0600, Eric Blake wrote: > On 05/05/2010 01:31 PM, Jim Meyering wrote: > >> Can we provide the option to specify the device serial number so that > >> it's really impossible to trash the wrong device? > > > > Given that this is a good idea, next question is obvio

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Eric Blake
On 05/05/2010 02:21 PM, Jim Paris wrote: >> Great for SCSI, not so great for USB sticks: >> >> # hdparm -i /dev/sdb >> >> /dev/sdb: >> HDIO_DRIVE_CMD(identify) failed: Invalid exchange >> HDIO_GET_IDENTITY failed: Invalid argument >> # echo $? >> 22 > > Using a device path in /dev/disk/by-id/ wo

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Jim Paris
Eric Blake wrote: > On 05/05/2010 01:31 PM, Jim Meyering wrote: > >> Can we provide the option to specify the device serial number so that > >> it's really impossible to trash the wrong device? > > > > Given that this is a good idea, next question is obviously > > how to get the serial number. On

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Jim Meyering
Eric Blake wrote: > On 05/05/2010 12:54 PM, Jim Meyering wrote: >>> +if (!defined $device) { >>> + $device = $self->config("host_block_devices/[$devindex]", undef); >>> +} >> >> This can be equivalently (idiomatically) written as: >> >>$device ||= $self->config("host_block_device

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Eric Blake
On 05/05/2010 12:54 PM, Jim Meyering wrote: >> +if (!defined $device) { >> +$device = $self->config("host_block_devices/[$devindex]", undef); >> +} > > This can be equivalently (idiomatically) written as: > >$device ||= $self->config("host_block_devices/[$devindex]", undef);

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Eric Blake
On 05/05/2010 01:31 PM, Jim Meyering wrote: >> Can we provide the option to specify the device serial number so that >> it's really impossible to trash the wrong device? > > Given that this is a good idea, next question is obviously > how to get the serial number. One way seems to be via hdparm,

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Jim Meyering
Dave Allan wrote: > On Wed, May 05, 2010 at 08:54:35PM +0200, Jim Meyering wrote: >> Eric Blake wrote: >> > I was getting failures of domain/103-blockdev-save-restore.t when >> > connecting as qemu:///session, since my uid could stat /dev/sdb >> > but not open it. That test now skips for unprivile

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Jim Meyering
Dave Allan wrote: > On Wed, May 05, 2010 at 08:54:35PM +0200, Jim Meyering wrote: >> Eric Blake wrote: >> > I was getting failures of domain/103-blockdev-save-restore.t when >> > connecting as qemu:///session, since my uid could stat /dev/sdb >> > but not open it. That test now skips for unprivil

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Dave Allan
On Wed, May 05, 2010 at 08:54:35PM +0200, Jim Meyering wrote: > Eric Blake wrote: > > I was getting failures of domain/103-blockdev-save-restore.t when > > connecting as qemu:///session, since my uid could stat /dev/sdb > > but not open it. That test now skips for unprivileged users, as well > > a

Re: [libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Jim Meyering
Eric Blake wrote: > I was getting failures of domain/103-blockdev-save-restore.t when > connecting as qemu:///session, since my uid could stat /dev/sdb > but not open it. That test now skips for unprivileged users, as well > as adds a layer of sanity checking against expected size to avoid > trash

[libvirt] [TCK PATCH] block devices: allow specification of size for safety

2010-05-05 Thread Eric Blake
I was getting failures of domain/103-blockdev-save-restore.t when connecting as qemu:///session, since my uid could stat /dev/sdb but not open it. That test now skips for unprivileged users, as well as adds a layer of sanity checking against expected size to avoid trashing the wrong device. * con