* VTL emulation, no barcodes shown in mtx
@ 2021-01-06 18:58 Michael Ablassmeier
2021-01-06 19:01 ` Michael Ablassmeier
2021-01-06 22:08 ` Michael Ablassmeier
0 siblings, 2 replies; 5+ messages in thread
From: Michael Ablassmeier @ 2021-01-06 18:58 UTC (permalink / raw)
To: stgt
hi,
im trying to create a virtual tape library based on the DVD/CD example,
the commands used are:
> tgtadm --op new --mode logicalunit --tid 1 --lun 1 --device-type tape
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 1 --params vendor_id=IBM,product_id=LTO1,product_rev=0010,scsi_sn=IBMLTO1,removable=1
> tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 2 --backing-store $HOME/smc --device-type changer
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params vendor_id=STK,product_id=L700,product_rev=0010,scsi_sn=XYZZY_0,removable=1
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=4,start_address=1,quantity=1
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=4,address=1,tid=1,lun=1
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=1,start_address=16,quantity=1
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params media_home=${VTL}
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=2,start_address=1024,quantity=8
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=2,address=1024,barcode=TAPE001,sides=1
> tgtadm --lld iscsi --mode logicalunit --op update --tid 1 --lun 2 --params element_type=2,address=1025,barcode=TAPE002,sides=1
while the device seems to work (loading and unloading the vtl medias),
mtx and other tools i used to query the VTL do not show any barcodes:
> mtx -f /dev/sg8 status
> Storage Changer /dev/sg8:1 Drives, 8 Slots ( 0 Import/Export )
> Data Transfer Element 0:Empty
> Storage Element 1:Full
> Storage Element 2:Full
> Storage Element 3:Empty:VolumeTag=
(4.19.0, 1.0.74)
am i missing something?
thanks,
- michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: VTL emulation, no barcodes shown in mtx
2021-01-06 18:58 VTL emulation, no barcodes shown in mtx Michael Ablassmeier
@ 2021-01-06 19:01 ` Michael Ablassmeier
2021-01-06 22:08 ` Michael Ablassmeier
1 sibling, 0 replies; 5+ messages in thread
From: Michael Ablassmeier @ 2021-01-06 19:01 UTC (permalink / raw)
To: stgt
On Wed, Jan 06, 2021 at 07:58:25PM +0100, Michael Ablassmeier wrote:
> im trying to create a virtual tape library based on the DVD/CD example,
> the commands used are:
>
> > tgtadm --op new --mode logicalunit --tid 1 --lun 1 --device-type tape
> > [..]
The output is missing the relevant image commands which were used to
create the medias:
> tgtimg --op new --device-type tape --type DATA --barcode TAPE001 --size 500 --file ${VTL}/TAPE001
> tgtimg --op new --device-type tape --type DATA --barcode TAPE002 --size 500 --file ${VTL}/TAPE002
thanks,
- michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: VTL emulation, no barcodes shown in mtx
2021-01-06 18:58 VTL emulation, no barcodes shown in mtx Michael Ablassmeier
2021-01-06 19:01 ` Michael Ablassmeier
@ 2021-01-06 22:08 ` Michael Ablassmeier
2021-01-06 22:28 ` [PATCH] " Michael Ablassmeier
1 sibling, 1 reply; 5+ messages in thread
From: Michael Ablassmeier @ 2021-01-06 22:08 UTC (permalink / raw)
To: stgt
hi again,
On Wed, Jan 06, 2021 at 07:58:25PM +0100, Michael Ablassmeier wrote:
> > mtx -f /dev/sg8 status
> > Storage Changer /dev/sg8:1 Drives, 8 Slots ( 0 Import/Export )
> > Data Transfer Element 0:Empty
> > Storage Element 1:Full
> > Storage Element 2:Full
> > Storage Element 3:Empty:VolumeTag=
it seems this i a regression introduced by one of the following commits
to smc.c:
> commit 2de8bebe132e3b998bf4848d0bd22b50367ad4b8
> Author: Lee Duncan <lduncan@suse.com>
> Date: Sat Feb 16 10:29:19 2019 -0800
>
> Fix gcc7 string truncation warnings.
> commit 73cb8f355479d8f7cb402ca967b137d4a32c8f76
> Author: FUJITA Tomonori <tomof@acm.org>
> Date: Fri Jul 28 11:34:15 2017 +0900
> smc: fix snprintf warnings with gcc7
i reverted both commits and removed -WAll from the makefile to be
able to compile, and now mtx show the barcodes:
> Storage Changer /dev/sg8:1 Drives, 8 Slots ( 0 Import/Export )
> Data Transfer Element 0:Empty
> Storage Element 1:Full :VolumeTag=TAPE001
> Storage Element 2:Full :VolumeTag=TAPE002
bye,
- michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] VTL emulation, no barcodes shown in mtx
2021-01-06 22:08 ` Michael Ablassmeier
@ 2021-01-06 22:28 ` Michael Ablassmeier
2021-01-06 22:41 ` Michael Ablassmeier
0 siblings, 1 reply; 5+ messages in thread
From: Michael Ablassmeier @ 2021-01-06 22:28 UTC (permalink / raw)
To: stgt
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
hi,
attached patch should fix this regression.
On Wed, Jan 06, 2021 at 11:08:05PM +0100, Michael Ablassmeier wrote:
> > commit 73cb8f355479d8f7cb402ca967b137d4a32c8f76
> > Author: FUJITA Tomonori <tomof@acm.org>
> > Date: Fri Jul 28 11:34:15 2017 +0900
> > smc: fix snprintf warnings with gcc7
>
> i reverted both commits and removed -WAll from the makefile to be
> able to compile, and now mtx show the barcodes:
>
> > Storage Changer /dev/sg8:1 Drives, 8 Slots ( 0 Import/Export )
> > Data Transfer Element 0:Empty
> > Storage Element 1:Full :VolumeTag=TAPE001
> > Storage Element 2:Full :VolumeTag=TAPE002
>
>
> bye,
> - michael
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 424 bytes --]
diff --git a/usr/smc.c b/usr/smc.c
index bbc7b7f..5efcbd7 100644
--- a/usr/smc.c
+++ b/usr/smc.c
@@ -184,7 +184,7 @@ static int add_element_descriptor(uint8_t *data, struct slot *s,
{
char buf[sizeof(attr->scsi_sn) + 1];
memset(buf, 0, sizeof(buf));
- snprintf(buf, sizeof(buf), "%-s", attr->scsi_sn);
+ snprintf(buf, sizeof(buf), "%-10s", attr->scsi_sn);
memcpy((char *)&data[i + 28], buf, 10);
}
}
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] VTL emulation, no barcodes shown in mtx
2021-01-06 22:28 ` [PATCH] " Michael Ablassmeier
@ 2021-01-06 22:41 ` Michael Ablassmeier
0 siblings, 0 replies; 5+ messages in thread
From: Michael Ablassmeier @ 2021-01-06 22:41 UTC (permalink / raw)
To: stgt
On Wed, Jan 06, 2021 at 11:28:42PM +0100, Michael Ablassmeier wrote:
> attached patch should fix this regression.
please ignore, this was actually an issue with the old version i was
using, already beeing addressed in 1.0.80 :)
sorry for all the noise,
bye,
- michael
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-01-06 22:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 18:58 VTL emulation, no barcodes shown in mtx Michael Ablassmeier
2021-01-06 19:01 ` Michael Ablassmeier
2021-01-06 22:08 ` Michael Ablassmeier
2021-01-06 22:28 ` [PATCH] " Michael Ablassmeier
2021-01-06 22:41 ` Michael Ablassmeier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).