WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Virtualization project idea

Am Freitag, den 27.08.2010, 14:53 +0530 schrieb Dhananjay Goel:
> This won't be straight forward. Think about USB memory/flash stick.
> If every VM sees it, and simultaneously writes to it, the filesystem
> in it will get corrupted immediately!
> 
> Why would it get corrupted immediately. Might be we can just lock a
> specific file which is being edited? Please suggest.


Hello Dhananjay,


in short: You can't do that.

Well, you may share the blockdevice itself quite easily this way
(AoE,iSCSI and FCoE could also be a simple way to do it).

But a Filesystem on a blockdevice is a totaly other beast than what you
know as shared access to a filesystem over NFS or CIFS/SMB[2].

There is a thing called "filesystem-cache".

Every OS that connects to your "shared-usb-flash-drive" reads the
filesystem-metadata (what data is where to find on the block device and
what name has it, what folders are there and what is in it) and places
this data into its local cache.

And here the things start to get nasty.

OS 1 adds a Folder but don't write the metadata for it to the device.
OS 2 don't know about the Folder and stores a file to the exact same
place on the device where OS 1 placed its new folder.
OS 1 writes its Data to the device.
Your filesystem gone nuts by here.

Even if OS 1 wrote the metadata to the device in the first place, there
is no notification that data was changed on the device for OS 2. OS 2
doesn't know anything about it because no one talked to OS 2 about the
write to the device.

The meta-information about the writes are local to the 2 VM's because
the filesystem isn't designed to be aware of datachages origination from
remote sources. There is no information exchange about what to write
where an when between the VM's. The filesystem on your device is not
"cluster-aware".

So:

Access to a "non cluster-aware block device filesystem" is exclusive to
only one OS instance. Period. There is no way around this.

Network shares are protocols only that are served by a server and this
server has the exclusive access to the storage block device and the
filesystem on it. NFS and CIFS/SMB[2] are a level higher (a network
protocol) and are only serving the access to files over the network.
The protocols have messages that make the clients aware that new data
has arrived on the server if the client cares and asks for such
notifications.

That said, you might want to take a look at GFS2 or OCFS2 to get more
information about what it takes to use the same filesystem on more than
one OS-Instance.



That's just the filesystem case. All other things have also problems to
get things right when data changes under its feet without notification. 

You can't share an usbcam because one host might change the format that
the cam sends its data (eg. the resolution) the other hosts don't know
about that change and thus show only invalid data...

You would have to write drivers for every device that are aware of other
players on the same device and you also would need a
communication-channel for the players on the device.

As far as i know this is impossible.

The only possible way i know of for "sharing" usb devices (a bus with
only one Host and thus only one OS-driver for each device) is to have an
interface where it is possible to attach usb devices to only one vm at a
time and detach it afterwards before you can attach it to another vm.


Marc



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel