[libvirt-users] Use libvirt-python to attach cdrom
Osier Yang
jyang at redhat.com
Tue Feb 15 05:19:46 UTC 2011
于 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
More information about the libvirt-users
mailing list