[one-users] Possible bug in /var/lib/one/lib/sh/scripts_common.sh , while having Ubuntu 12.4 as iSCSI target

cloud.b.lab cloud.b.lab at zoho.com
Tue Jul 24 08:19:10 PDT 2012


Hi,

With reference to:

File name :  /var/lib/one/lib/sh/scripts_common.sh
Function  :   function tgt_admin_dump_config
Line #     : echo "$TGTADMIN --dump |sudo tee $FILE_PATH >/dev/null" 

Snippet from the code:
                                     function tgt_admin_dump_config {
                                     FILE_PATH="$1"
                                     echo "$TGTADMIN --dump |sudo tee $FILE_PATH >/dev/null"
                                      }
Scenario:
1. OpenNebula front-end       :       CentOS 6.3 server   
2. OpenNebula node              :       Centos 6.3 Server
3. iSCSI Target in                    :       Ubuntu 12.04 server  [192.168.1.7]
4. iSCSI  Initiator in               :      OpenNebula Front end (CentOS 6.3 Server)

5. Create a iSCSI datastore in front end with following definition 
NAME = production
BASE_IQN="iqn.2012-02.org.opennebula"
DISK_TYPE="block"
DS_MAD="iscsi"
HOST="192.168.1.7"
TM_MAD="iscsi"
VG_NAME="vg-one"

   ID NAME                      CLUSTER         IMAGES TYPE   TM
   0 system                     -                    0         -        shared
   1 default                     -                    1         fs       shared
 101 production               -                    2         iscsi    iscsi

6. Creates a new Image (ttylinux.img) with the below template contents in to the iSCSI datastore
NAME = ttylinuxiscsi-3
PATH = "/var/lib/images/ttylinux.img"
TYPE = OS

Problem definition:
While copying the image to the iSCSI target, error  ">/dev/null" failed: sh: 12: Syntax error: Bad fd number" is reported.

Extract from oned.log:
Tue Jul 24 02:51:24 2012 [ImM][I]: sudo tgtadm --lld iscsi --op new --mode logicalunit --tid $TID  --lun 1 --backing-store /dev/vg-one/lv-one-13
Tue Jul 24 02:51:24 2012 [ImG][D]: Message received: LOG I 13 sudo tgt-admin --dump |sudo tee /etc/tgt/targets.conf >& /dev/null" failed: sh: 12: Syntax error: Bad fd number

Tue Jul 24 02:51:24 2012 [ImM][I]: sudo tgt-admin --dump |sudo tee /etc/tgt/targets.conf >& /dev/null" failed: sh: 12: Syntax error: Bad fd number
Tue Jul 24 02:51:24 2012 [ImG][D]: Message received: LOG E 13 Error registering 192.168.1.7:/dev/vg-one/lv-one-13

Tue Jul 24 02:51:24 2012 [ImM][E]: Error registering 192.168.1.7:/dev/vg-one/lv-one-13
Tue Jul 24 02:51:24 2012 [ImG][D]: Message received: LOG I 13 ExitCode: 2

Tue Jul 24 02:51:24 2012 [ImM][I]: ExitCode: 2
Tue Jul 24 02:51:24 2012 [ImG][D]: Message received: CP FAILURE 13 Error registering 192.168.1.7:/dev/vg-one/lv-one-13

Reason : It happens Ubuntu 12.04 , because , Ubuntu has dash (/bin/sh) and not bash. 


If I change  ">& /dev/null" to   ">/dev/null 2>&1"" , the image copies smoothly to the iSCSI target with no FD number error.

Corrected version:

function tgt_admin_dump_config {
    FILE_PATH="$1"
    echo "$TGTADMIN --dump |sudo tee $FILE_PATH >/dev/null 2>&1"
}

Tue Jul 24 02:55:22 2012 [ImG][D]: Message received: STAT SUCCESS 2 40

Tue Jul 24 02:55:22 2012 [ImM][I]: Copying /var/lib/images/ttylinux.img to repository for image 14
Tue Jul 24 02:55:26 2012 [ImG][D]: Message received: LOG I 14 cp: Copying local image /var/lib/images/ttylinux.img to the image repository

Tue Jul 24 02:55:26 2012 [ImM][I]: cp: Copying local image /var/lib/images/ttylinux.img to the image repository
Tue Jul 24 02:55:26 2012 [ImG][D]: Message received: LOG I 14 ExitCode: 0

Tue Jul 24 02:55:26 2012 [ImM][I]: ExitCode: 0
Tue Jul 24 02:55:26 2012 [ImG][D]: Message received: CP SUCCESS 14 iqn.2012-02.org.opennebula:192.168.1.7.vg-one.lv-one-14



Regards,
Anil.
cloud-b-lab

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20120724/493d6c2e/attachment-0003.htm>


More information about the Users mailing list