• O
    qemu: Fix a regression of attaching device · fab4f0c6
    Osier Yang 提交于
    The regression is introduced by Commit da1eba6b, the new
    codes with this commit doesn't reset "ret" to "-1" when
    it fails on parsing the device XML (live device attachment)
    
    This patch changes the codes to reset the "ret" and "-1",
    and also changes the codes so that it don't modify "ret"
    for condition checking.
    
    How to reproduce:
    
    % cat test.xml
    <disk type='oops' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/test.img'/>
      <target dev='vda' bus='virtio'/>
    </disk>
    
    % virsh attach-device $domain test.xml
    Device attached successfully
    
    The device attachment failed actually with error "unknown disk type 'oops'",
    however, it reports success.
    fab4f0c6
qemu_driver.c 263.4 KB