Re: Use libvirt-python to attach cdrom

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



于 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


[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux