Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Xen: API

storage motion question

 

 

Xen api RSS feed   Index | Next | Previous | View Threaded


thomas at gazagnaire

Jun 25, 2012, 9:14 AM

Post #1 of 3 (183 views)
Permalink
storage motion question

Hi,

With the new storage architecture, I am wondering how xapi know if a vdi is activated or not. Previously he was looking the the attached VBD, but with storage motion it appears that some VDI can be activated while not attached to a VM. So what is the correct way to VDI activation within xapi ?

(currently, it seems that all VDI operations are allowed on disks created by storage motion, while the migration is in progress, including deletion which is not good)

--
Thomas
_______________________________________________
Xen-api mailing list
Xen-api [at] lists
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


Dave.Scott at eu

Jun 25, 2012, 10:44 AM

Post #2 of 3 (160 views)
Permalink
Re: storage motion question [In reply to]

Hi,

> With the new storage architecture, I am wondering how xapi know if a
> vdi is activated or not. Previously he was looking the the attached VBD,
> but with storage motion it appears that some VDI can be activated while
> not attached to a VM. So what is the correct way to VDI activation
> within xapi ?

There's a "high-level storage layer" (currently within xapi but it should be moved into a separate daemon) which tracks the state of each VDI. Check out this command:

[root [at] st3 ~]# xe host-get-sm-diagnostics uuid=846c23b0-6785-4922-bd50-9e9342e52110
DataPath information:
The following SRs are attached:
SR 80577daf-9ea3-40de-80ef-d077e3962540
VDI win7sp1-x86.iso
activated RO (device=Some {"params": "\/dev\/sm\/backend\/80577daf-9ea3-40de-80ef-d077e3962540\/1736a4e8-c55b-4846-b894-e176c6523177", "xenstore_data": {"scsi\/0x12\/0x80": "AIAAEjE3MzZhNGU4LWM1NWItNDggIA==", "scsi\/0x12\/0x83": "AIMAMQIBAC1YRU5TUkMgIDE3MzZhNGU4LWM1NWItNDg0Ni1iODk0LWUxNzZjNjUyMzE3NyA=", "vdi-uuid": "1736a4e8-c55b-4846-b894-e176c6523177"}})
DP: vbd/20/hdb: activated RO
SR bf20dbf4-2db4-4968-9d86-09aca7f8d9d4
SR 8a0eade3-713d-e13d-641c-8cfa5ac92094
SR 0e5b1dca-9fdc-c8ea-ffe7-9e02950e3804
SR 1244bde2-7762-c559-0a57-701128598f3e
SR cf0ee8a5-befb-d8d4-b0e7-614cf07f084c
VDI win7old.1
activated RW (device=Some {"params": "\/dev\/xen\/blktap-2\/tapdev0", "xenstore_data": {}})
DP: vbd/20/hda: activated RW

With my new experimental storage backend it also displays the .vhd relationships in graphviz format, but I digress ;)

> (currently, it seems that all VDI operations are allowed on disks
> created by storage motion, while the migration is in progress,
> including deletion which is not good)

Hm, looking in ocaml/xapi/storage_impl.ml:

let destroy context ~dbg ~sr ~vdi =
info "VDI.destroy dbg:%s sr:%s vdi:%s" dbg sr vdi;
with_vdi sr vdi
(fun () ->
remove_datapaths_andthen_nolock context ~dbg ~sr ~vdi Vdi.all
(fun () ->
Impl.VDI.destroy context ~dbg ~sr ~vdi
)
)

So it's currently deactivating and detaching the disk as part of the VDI.destroy. This could be changed, the only problem is that it *might* be working around leaking "attaches" or "activates". Arguably we should fix those resource leaks too though.

Cheers,
Dave

_______________________________________________
Xen-api mailing list
Xen-api [at] lists
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api


thomas at gazagnaire

Jun 26, 2012, 1:49 AM

Post #3 of 3 (159 views)
Permalink
Re: storage motion question [In reply to]

>> With the new storage architecture, I am wondering how xapi know if a
>> vdi is activated or not. Previously he was looking the the attached VBD,
>> but with storage motion it appears that some VDI can be activated while
>> not attached to a VM. So what is the correct way to VDI activation
>> within xapi ?
>
> There's a "high-level storage layer" (currently within xapi but it should be moved into a separate daemon) which tracks the state of each VDI. Check out this command:
>
> [root [at] st3 ~]# xe host-get-sm-diagnostics uuid=846c23b0-6785-4922-bd50-9e9342e52110
> DataPath information:
> The following SRs are attached:
> SR 80577daf-9ea3-40de-80ef-d077e3962540
> VDI win7sp1-x86.iso
> activated RO (device=Some {"params": "\/dev\/sm\/backend\/80577daf-9ea3-40de-80ef-d077e3962540\/1736a4e8-c55b-4846-b894-e176c6523177", "xenstore_data": {"scsi\/0x12\/0x80": "AIAAEjE3MzZhNGU4LWM1NWItNDggIA==", "scsi\/0x12\/0x83": "AIMAMQIBAC1YRU5TUkMgIDE3MzZhNGU4LWM1NWItNDg0Ni1iODk0LWUxNzZjNjUyMzE3NyA=", "vdi-uuid": "1736a4e8-c55b-4846-b894-e176c6523177"}})
> DP: vbd/20/hdb: activated RO
> SR bf20dbf4-2db4-4968-9d86-09aca7f8d9d4
> SR 8a0eade3-713d-e13d-641c-8cfa5ac92094
> SR 0e5b1dca-9fdc-c8ea-ffe7-9e02950e3804
> SR 1244bde2-7762-c559-0a57-701128598f3e
> SR cf0ee8a5-befb-d8d4-b0e7-614cf07f084c
> VDI win7old.1
> activated RW (device=Some {"params": "\/dev\/xen\/blktap-2\/tapdev0", "xenstore_data": {}})
> DP: vbd/20/hda: activated RW
>
> With my new experimental storage backend it also displays the .vhd relationships in graphviz format, but I digress ;)

Nice! So I guess the best wayt to query the storage layer about activations information for a particular vdi is to use DP.stat_vdi then.

I am wondering if it makes sense to modify Xapi_vdi.check_operation_error in the case when a vdi has no attached pbds to ask the storage layer if the vdi is activated or not, and to update the allowed operations accordingly.

>> (currently, it seems that all VDI operations are allowed on disks
>> created by storage motion, while the migration is in progress,
>> including deletion which is not good)
>
> Hm, looking in ocaml/xapi/storage_impl.ml:
>
> let destroy context ~dbg ~sr ~vdi =
> info "VDI.destroy dbg:%s sr:%s vdi:%s" dbg sr vdi;
> with_vdi sr vdi
> (fun () ->
> remove_datapaths_andthen_nolock context ~dbg ~sr ~vdi Vdi.all
> (fun () ->
> Impl.VDI.destroy context ~dbg ~sr ~vdi
> )
> )
>
> So it's currently deactivating and detaching the disk as part of the VDI.destroy. This could be changed, the only problem is that it *might* be working around leaking "attaches" or "activates". Arguably we should fix those resource leaks too though.

Can't we just throw an error if we try to destroy a vdi which is activated ?

--
Thomas
_______________________________________________
Xen-api mailing list
Xen-api [at] lists
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api

Xen api RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.