-When detaching an SR, we detach the slaves first
-When reattaching the SR, we attach the master first
This fix was required by thin provisioning, but it does worth to use the same logic regardless of the provisioning method.
1. Changed definition of IsDetached property in SR.cs: SR is detached when it has no PBDs or when all its PBDs are unplugged.
2. Added bool HasPBDs property in SR.cs (replaced previous IsDetached property definition).
3. Reviewed all usages of sr.IsDetached property.
Signed-off-by: Adrian Jachacy <Adrian.Jachacy@citrix.com>