"""
return (self.GetActualSize(), self.GetActualSpindles())
+ def GetUserspaceAccessUri(self, hypervisor):
+ """Return URIs hypervisors can use to access disks in userspace mode.
+
+ @rtype: string
+ @return: userspace device URI
+ @raise errors.BlockDeviceError if userspace access is not supported
+
+ """
+ ThrowError("Userspace access with %s block device and %s hypervisor is not "
+ "supported." % (self.__class__.__name__,
+ hypervisor))
+
def __repr__(self):
return ("<%s: unique_id: %s, children: %s, %s:%s, %s>" %
(self.__class__, self.unique_id, self._children,
raise ValueError("Invalid configuration data %s" % str(unique_id))
self.driver, self.rbd_name = unique_id
+ self.rbd_pool = params[constants.LDP_POOL]
self.major = self.minor = None
self.Attach()
base.ThrowError("rbd resize failed (%s): %s",
result.fail_reason, result.output)
+ def GetUserspaceAccessUri(self, hypervisor):
+ """Generate KVM userspace URIs to be used as `-drive file` settings.
+
+ @see: L{BlockDev.GetUserspaceAccessUri}
+
+ """
+ if hypervisor == constants.HT_KVM:
+ return "rbd:" + self.rbd_pool + "/" + self.rbd_name
+ else:
+ base.ThrowError("Hypervisor %s doesn't support RBD userspace access" %
+ hypervisor)
+
class ExtStorageDevice(base.BlockDev):
"""A block device provided by an ExtStorage Provider.