How about use `change-media` command to eject media of cdrom, easier than `attach-device`, no need to create a xml file.Although you have to execute the command twice, too:(