Bug 694357

Summary: virsh attach-disk failed after libvirt update
Product: Red Hat Enterprise Linux 5 Reporter: Takashi Sato <tsato>
Component: libvirtAssignee: Scott Radvan <sradvan>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.5CC: dallan, dyuan, eblake, jyang, mzhan, rlandman, weizhan
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-11 14:03:59 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Takashi Sato 2011-04-07 05:40:18 UTC
Description of problem:

After libvirt package was updated from 0.6.3 to 0.8.2 and restarted libvirtd, virsh attack-disk command failed with following error.

---
virsh # attach-disk hachi-test /root/disk.iso hdc --type cdrom
error: Failed to attach disk
error: internal error missing disk device alias name for hdc
---

This continues until guest OS reboots.

Version-Release number of selected component (if applicable):
libvirt-0.8.2

How reproducible:


Steps to Reproduce:
. Set up KVM environment with libvirt-0.6.3 (and
libvirtd-python-0.6.3) and configure guest OS and
run it.

2. Update libvirt and libvirt-python packages to 0.8.2
without stopping guest OS instance.

3. Restart libvirtd

# service libvirtd restart

4. Now virsh attach-disk command fails.  

virsh # attach-disk hachi-test /root/disk.iso hdc --type cdrom

Actual results:

error: Failed to attach disk
error: internal error missing disk device alias name for hdc

Expected results:

No error.

Additional info:

Comment 1 Takashi Sato 2011-04-07 05:43:19 UTC
static int qemudDomainChangeEjectableMedia(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,

{ unsigned long long qemuCmdFlags)
:
origdisk = NULL;
for (i = 0 ; i < vm->def->ndisks ; i++) {
if (vm->def->disks[i]->bus == disk->bus &&
STREQ(vm->def->disks[i]->dst, disk->dst)) {
origdisk = vm->def->disks[i];
break;
}
}

if (!origdisk) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("No device with bus '%s' and target '%s'"),
virDomainDiskBusTypeToString(disk->bus),
disk->dst);
return -1;
}

if (!origdisk->info.alias) {
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("missing disk device alias name for %s"), origdisk-
>dst);
return -1;
}
}
==

That is, origdisk->info.alias was not available.
And this data structure is defined as follows:

==
struct _virDomainDiskDef {
int type;
int device;
int bus;
char *src;
char *dst;
char *driverName;
char *driverType;
char *serial;
int cachemode;
int error_policy;
unsigned int readonly : 1;
unsigned int shared : 1;
virDomainDeviceInfo info; <<<<<<<<<<<<<<<<<
virStorageEncryptionPtr encryption;
};
==

This is the version of libvirt-0.8.2.
And I found that the member "virDomainDeviceInfo info"
does not exist on the version of libvirt-0.6.3:

==
struct _virDomainDiskDef {
int type;
int device;
int bus;
char *src;
char *dst;
char *driverName;
char *driverType;
int cachemode;
unsigned int readonly : 1;
unsigned int shared : 1;
int slotnum; /* pci slot number for unattach */
};
==

So there might be a compatibility issue between
libvirtd and kvm after the update.