Bug #1754

Fix syntax error in vmm/xen/attach_disk and use tap2:aio instead of tap:aio

Added by Laurent Grawet over 8 years ago. Updated over 8 years ago.

Status:ClosedStart date:02/02/2013
Priority:NormalDue date:
Assignee:Javi Fontan% Done:

0%

Category:Drivers - Auth
Target version:Release 4.0
Resolution:fixed Pull request:
Affected Versions:OpenNebula 3.8

Description

Hi,

There is a small problem in vmm/xen/attach_disk. Due to the way the DRIVER attribute is encoded in OpenNebula ("phy:", "tap2:aio:"), that is to say, a backend with trailing colon character, $FULL_DISK ends up having two colon characters which cause hotplug to fail with Xen.

The patch removes ANY trailing ":" from $DRIVER during $FILE_PREFIX assignation.

By the way, it is high time to use tap2:aio (blktap2) instead of tap:aio (blktap) which no more available since Xen 4.0.
Maybe you should update /etc/one/vmm_exec/vmm_exec_xen.conf the same way.

Cheers,

Laurent

xen-attach_disk.patch Magnifier - Fix syntax error in vmm/xen/attach_disk and use tap2:aio (495 Bytes) Laurent Grawet, 02/02/2013 12:48 AM

Associated revisions

Revision 7cdb954b
Added by Javi Fontan over 8 years ago

bug #1754: delete trailing : from xen attach_disk prefix

Revision 04f26768
Added by Javi Fontan over 8 years ago

bug #1754: change default attach prefix to file (compatible with xen 3 and 4)

History

#1 Updated by Ruben S. Montero over 8 years ago

  • Status changed from New to Assigned
  • Assignee set to Javi Fontan
  • Target version set to Release 4.0

#2 Updated by Javi Fontan over 8 years ago

This patch does not seem to work really well to me. I deletes the second part of the variable:

$ echo $VAR
tap2:tap

$ echo ${VAR%%:*}
tap2

$ echo ${VAR%:*}
tap2

I'd use this other version:

$ echo $VAR2
tap2:aio:

$ echo ${VAR%:}
tap2:tap

$ echo ${VAR2%:}
tap2:aio

#3 Updated by Laurent Grawet over 8 years ago

Hi Javi,

You're right. I've just noticed that too while doing some more testing. In fact, I wrote it like you first.
Then I came up with the idea to remove any colon at the end of $DRIVER (phy:: -> phy).

But the "%%" combined with "*" has the following effect according to bash man page : "If parameter is @ or *, the pattern removal operation is applied to each positional parameter in turn, and the expansion is the resultant list."

This is not what I intended, I should have tested with "tap2:aio:" first :-(

So, as long as the user has not mis-encoded the DRIVER variable (which is another problem), your version is OK.

Cheers,

Laurent

#4 Updated by Javi Fontan over 8 years ago

I've added the trailing space safeguard for all prefixes, just to be on the safe side. The default prefix is still not changed, I want to check with my colleagues but seems fine to me to change it.

Thanks for the patch and tips!

#5 Updated by Javi Fontan over 8 years ago

  • Status changed from Assigned to Closed
  • Resolution set to fixed

I've changed the hardcoded default prefix to file (that works in both xen 3 and 4). We are going to split vmm xen drivers in version 3 and 4 and sensible default will be provided in the configuration files.

http://dev.opennebula.org/issues/1761

Also available in: Atom PDF