Re: [PATCH] scsi: Need to translate disk source pool in config attach path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 06/12/2015 07:52 AM, Erik Skultety wrote:
> 
> 
> On 06/12/2015 01:10 PM, John Ferlan wrote:
>>
>>
>> On 06/12/2015 04:57 AM, Erik Skultety wrote:
>>>
>>>
>>> On 06/11/2015 11:15 PM, John Ferlan wrote:
>>>> https://bugzilla.redhat.com/show_bug.cgi?id=1228007
>>>>
>>>> When attaching a scsi volume lun via the attach-device --config or
>>>> --persistent options, there was no translation of the source pool
>>>> like there was for the live path, thus the attempt to modify the config
>>>> would fail since not enough was known about the disk.
>>>>
>>>> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
>>>> ---
>>>>  src/qemu/qemu_driver.c | 8 ++++++--
>>>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>>>> index 34e5581..6bb8549 100644
>>>> --- a/src/qemu/qemu_driver.c
>>>> +++ b/src/qemu/qemu_driver.c
>>>> @@ -8016,7 +8016,8 @@ qemuDomainUpdateDeviceLive(virConnectPtr conn,
>>>>  static int
>>>>  qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
>>>>                               virDomainDefPtr vmdef,
>>>> -                             virDomainDeviceDefPtr dev)
>>>> +                             virDomainDeviceDefPtr dev,
>>>> +                             virConnectPtr conn)
>>>>  {
>>>>      virDomainDiskDefPtr disk;
>>>>      virDomainNetDefPtr net;
>>>> @@ -8033,6 +8034,8 @@ qemuDomainAttachDeviceConfig(virQEMUCapsPtr qemuCaps,
>>>>                             _("target %s already exists"), disk->dst);
>>>>              return -1;
>>>>          }
>>>> +        if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
>>>> +            return -1;
>>>>          if (qemuCheckDiskConfig(disk) < 0)
>>>>              return -1;
>>>>          if (virDomainDiskInsert(vmdef, disk))
>>>> @@ -8501,7 +8504,8 @@ static int qemuDomainAttachDeviceFlags(virDomainPtr dom, const char *xml,
>>>>                                           VIR_DOMAIN_DEVICE_ACTION_ATTACH) < 0)
>>>>              goto endjob;
>>>>  
>>>> -        if ((ret = qemuDomainAttachDeviceConfig(qemuCaps, vmdef, dev)) < 0)
>>>> +        if ((ret = qemuDomainAttachDeviceConfig(qemuCaps, vmdef, dev,
>>>> +                                                dom->conn)) < 0)
>>>>              goto endjob;
>>>>      }
>>>>  
>>>>
>>> I think we should also update the docs in the way that we also support
>>> storage type 'volume' with disk device type 'lun'. And that is because
>>> we do not really care about the storage type when performing a device
>>> attach (we do care about this when doing snapshots), yet we still need
>>> to call virStorageDiskSourcePool which returns instantly for every
>>> storage type, except for volume. Documentation update should also imply
>>> updating our RNG schema (domaincommon I think), otherwise the use case
>>> described in the BZ won't validate. ACK if you also update both docs and
>>> RNG.
>>>
>>
>> Not sure I understand what the RNG updated requirement is... The RNG
>> already has all the proper formats defined when it was added in commit
>> id 'c00b2f0d' (if you use gitk you can see other similar commits around
>> that time as well).
>>
> What I meant is: "Using 'lun' (since 0.9.10) is only valid when type is
> 'block' or 'network' using iSCSI protocol..." should be updated to allow
> the source type 'volume' as well, to reflect the nice paragraph below.
> If you look at the BZ, the device definitions begins with:
> <disk type='volume' device='lun'> ===> that device is parsed and
> processed correctly and also will be attached successfully later on
> (provided that your patch is merged). However it fails the RNG
> validation right here (domaincommon.rng):
> <attribute name="device">
>   <value>lun</value>
> </attribute>
> <optional>
>   <ref name="rawIO"/>
> </optional>
> <optional>
>   <ref name="sgIO"/>
> </optional>
> <interleave>
>   <choice>
>     <ref name="diskSourceNetwork"/>
>     <ref name="diskSourceBlock"/>	<<<< diskSourceVolume missing
>   </choice>
>   <ref name="diskSpecsExtra"/>
> </interleave>
> 
> 
>> Using a LUN from an iSCSI source pool provides the same capabilities as
>> a <code>disk</code> configured using <code>type</code> 'block' or
>> 'network and <code>device</code> of 'lun' with respect to how the LUN is
>> presented to and may used by the guest.
>>
> ^^^ This one's nice.
>>
>> Possible replacement for "capabilities" - "features"? Or some other
>> suggestion.
> I like 'features', but that's just a matter of personal preference, so
> do as you wish.

OK - I'll squash the attached in

Thanks -

John

>From f76976620211c6922a5f8638e25db72fbaadbc01 Mon Sep 17 00:00:00 2001
From: John Ferlan <jferlan@xxxxxxxxxx>
Date: Fri, 12 Jun 2015 07:11:51 -0400
Subject: [PATCH] Fix issues

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 docs/formatdomain.html.in     | 13 +++++++++++--
 docs/schemas/domaincommon.rng |  1 +
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 0478cb2..b8af1d0 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1944,8 +1944,10 @@
             defaulting to "disk".
             <p>
             Using "lun" (<span class="since">since 0.9.10</span>) is only
-            valid when type is "block" or "network" using the iSCSI protocol,
-            and behaves identically to "disk",
+            valid when the <code>type</code> is "block" or "network" for
+            <code>protocol='iscsi'</code> or when the <code>type</code>
+            is "volume" when using an iSCSI source <code>pool</code>.
+            Configured in this manner, the LUN behaves identically to "disk",
             except that generic SCSI commands from the guest are accepted
             and passed through to the physical device. Also note that
             device='lun' will only be recognized for actual raw devices,
@@ -2062,6 +2064,13 @@
               Using "host" as the <code>mode</code> value indicates to use the
               LUN's path as it shows up on host (e.g.
               'file=/dev/disk/by-path/ip-example.com:3260-iscsi-iqn.2013-07.com.example:iscsi-pool-lun-1').
+
+              Using a LUN from an iSCSI source pool provides the same
+              features as a <code>disk</code> configured using
+              <code>type</code> 'block' or 'network and <code>device</code>
+              of 'lun' with respect to how the LUN is presented to and
+              may used by the guest.
+
               </p>
               </dd>
           </dl>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e38b927..f0f7400 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1218,6 +1218,7 @@
             <choice>
               <ref name="diskSourceNetwork"/>
               <ref name="diskSourceBlock"/>
+              <ref name="diskSourceVolume"/>
             </choice>
             <ref name="diskSpecsExtra"/>
           </interleave>
-- 
2.1.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]