Skip to contentSkip to conversation

Add syntax checking for xm block-attach

PATCH Superseded Masaki Kanno 2 participants 3 messages Sep 6, 2006 – Sep 8, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add syntax checking for xm block-attach

Hi,

Currently, xm block-attach command doesn't have syntax checking about the mode('r' or 'w'). Even if wrong characters to the mode are specified, VBD is attached to VM with the read-only mode.

# xm block-list vm1
Vdev  BE handle state evt-ch ring-ref BE-path
769    0    0     4      6      8     /local/domain/0/backend/vbd/2/769  
# xm block-attach vm1 phy:ram2 hdb1 xyz
# xm block-list vm1
Vdev  BE handle state evt-ch ring-ref BE-path
769    0    0     4      6      8     /local/domain/0/backend/vbd/2/769  
833    0    0     4      8      585   /local/domain/0/backend/vbd/2/833  

This patch adds syntax checking for xm block-attach command.

# xm block-list vm1
Vdev  BE handle state evt-ch ring-ref BE-path
769    0    0     4      6      8     /local/domain/0/backend/vbd/2/769  
# xm block-attach vm1 phy:ram2 hdb1 xyz
Error: Invalid mode
# xm block-list vm1
Vdev  BE handle state evt-ch ring-ref BE-path
769    0    0     4      6      8     /local/domain/0/backend/vbd/2/769  

Best regards,
Kan

tools/python/xen/xend/server/blkif.py +5 -1
diff -r 5fa9b746d24f tools/python/xen/xend/server/blkif.py
@@ -64,10 +64,14 @@ class BlkifController(DevController):
             except ValueError:
                 (typ, params) = ("", "")
 
+        mode = sxp.child_value(config, 'mode', 'r')
+        if mode != 'r' and mode != 'w':
+            raise VmError('Invalid mode')
+
         back = { 'dev'    : dev,
                  'type'   : typ,
                  'params' : params,
-                 'mode'   : sxp.child_value(config, 'mode', 'r')
+                 'mode'   : mode
                }
 
         if security.on():

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

On Wed, Sep 06, 2006 at 08:49:05PM +0900, Masaki Kanno wrote:

Content-Description: Mail message body

Quoted 6 lines

Hi,

Currently, xm block-attach command doesn't have syntax checking about the mode('r' or 'w'). Even if wrong characters to the mode are specified, VBD is attached to VM with the read-only mode.

Hi Kan,

We also currently use the mode "w!", which means "read-write and it is safe to have multiple writers on this device". Could you respin your patch?

Thanks,

Ewan.

#2 lore raw
Quoted 11 lines · Masaki Kanno

Content-Description: Mail message body

Quoted 6 lines

Hi,

Currently, xm block-attach command doesn't have syntax checking about the mode('r' or 'w'). Even if wrong characters to the mode are specified, VBD is attached to VM with the read-only mode.

Quoted 5 lines

Hi Kan,

We also currently use the mode "w!", which means "read-write and it is safe to have multiple writers on this device". Could you respin your patch?

Hi Ewan,

Thanks for your comment.
I will fix this.

Best regards,
Kan

Quoted 9 lines

Thanks,

Ewan.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel