[libvirt-users] Use libvirt-python to attach cdrom

seven lingjie at gyyx.cn
Wed Feb 16 03:20:41 UTC 2011


Osier Yang <jyang at ...> writes:

> 
> 于 2011年02月14日 16:37, seven 写道:
> > Hi all,
> >
> > I want to attach cdrom by libvirt.py .But can't find a func in
> > libvirt.py can finish this work.
> >
> > Who can help me ?
> >
> > Regard
> >
> >
> 
> # python
>  >>> import libvirt
>  >>> conn = libvirt.open('qemu:///system')
>  >>> dom = conn.lookupByName('f14')
>  >>> dir(dom)
> ['ID', 'OSType', 'UUID', 'UUIDString', 'XMLDesc', '__del__', '__doc__', 
> '__init__', '__module__', '_conn', '_o', 'abortJob', 'attachDevice', 
> 'attachDeviceFlags', 'autostart', 'blockInfo', 'blockPeek', 
> 'blockStats', 'connect', 'coreDump', 'create', 'createWithFlags', 
> 'destroy', 'detachDevice', 'detachDeviceFlags', 'hasCurrentSnapshot', 
> 'hasManagedSaveImage', 'info', 'interfaceStats', 'isActive', 
> 'isPersistent', 'isUpdated', 'jobInfo', 'managedSave', 
> 'managedSaveRemove', 'maxMemory', 'maxVcpus', 'memoryParameters', 
> 'memoryPeek', 'memoryStats', 'migrate', 'migrateSetMaxDowntime', 
> 'migrateToURI', 'name', 'openConsole', 'pinVcpu', 'reboot', 'resume', 
> 'revertToSnapshot', 'save', 'schedulerParameters', 'schedulerType', 
> 'setAutostart', 'setMaxMemory', 'setMemory', 'setMemoryParameters', 
> 'setSchedulerParameters', 'setVcpus', 'setVcpusFlags', 'shutdown', 
> 'snapshotCreateXML', 'snapshotCurrent', 'snapshotListNames', 
> 'snapshotLookupByName', 'snapshotNum', 'suspend', 'undefine', 
> 'updateDeviceFlags', 'vcpus', 'vcpusFlags']
>  >>>
> 
> see "attachDevice", "attachDeviceFlags", and "updateDeviceFlags", (in
> case of your guest already has CDROM device).
> 
> to get how to use them:
> 
>  >>> help(dom.attachDevice)
> 
> Regards
> Osier
> 
> _______________________________________________
> libvirt-users mailing list
> libvirt-users <at> redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users

--------------------------__

I'm sorry that I as you do,but I don't find the "attachDeviceFlags" and 
"updateDeviceFlags"

>>> dir(dom)
['ID', 'OSType', 'UUID', 'UUIDString', 'XMLDesc', '__del__', '__doc__', 
'__init__', '__module__', '_conn', '_o', 'attachDevice', 'autostart', 
'blockPeek', 'blockStats', 'connect', 'coreDump', 'create', 'destroy', 
'detachDevice', 'info', 'interfaceStats', 'maxMemory', 'maxVcpus', 'memoryPeek', 
'migrate', 'name', 'pinVcpu', 'reboot', 'ref', 'resume', 'save', 
'schedulerParameters', 'schedulerType', 'setAutostart', 'setMaxMemory', 
'setMemory', 'setSchedulerParameters', 'setVcpus', 'shutdown', 'suspend', 
'undefine', 'vcpus']

I think this is the version of the problem . My libvir.py's version is 0.6.3

And when I use "attachDevice" to attach cdrom , I get "no wrong"(return value is 
"0"),but the vm not find the cdrom.

Regards
Seven
 





More information about the libvirt-users mailing list