Export disk's userspace URI to OS scripts
authorDimitris Aragiorgis <dimitris.aragiorgis@gmail.com>
Thu, 30 Jul 2015 19:56:48 +0000 (22:56 +0300)
committerHrvoje Ribicic <riba@google.com>
Mon, 17 Aug 2015 15:12:01 +0000 (15:12 +0000)
In case of access=userspace, the hypervisor can access the disk
via its userspace URI.

Also export this URI to OS scripts, so that the OS definition may use
it to access the disk, if it so desires.

Signed-off-by: Dimitris Aragiorgis <dimitris.aragiorgis@gmail.com>
Reviewed-by: Hrvoje Ribicic <riba@google.com>

lib/backend.py

index d74d2e0..140c3cc 100644 (file)
@@ -4044,9 +4044,12 @@ def OSEnvironment(instance, inst_os, debug=0):
   # Disks
   for idx, disk in enumerate(instance.disks_info):
     real_disk = _OpenRealBD(disk)
+    uri = _CalculateDeviceURI(instance, disk, real_disk)
     result["DISK_%d_PATH" % idx] = real_disk.dev_path
     result["DISK_%d_ACCESS" % idx] = disk.mode
     result["DISK_%d_UUID" % idx] = disk.uuid
+    if uri:
+      result["DISK_%d_URI" % idx] = uri
     if disk.name:
       result["DISK_%d_NAME" % idx] = disk.name
     if constants.HV_DISK_TYPE in instance.hvparams: