On 27/03/13 16:26, liyang wrote:
On 2013-3-27 13:53, [email protected] wrote:
From: whuang<[email protected]>

Signed-off-by: whuang<[email protected]>
---
  virttest/virsh.py | 17 +++++++++++++++++
  1 file changed, 17 insertions(+)

diff --git a/virttest/virsh.py b/virttest/virsh.py
index 21c6922..c560f14 100644
--- a/virttest/virsh.py
+++ b/virttest/virsh.py
@@ -1622,3 +1622,20 @@ def cpu_stats(name, options, **dargs):
          cmd += " %s" % options

      return command(cmd, **dargs)
+
+def change_media(name, device, source, options, **dargs):
+    """
+    Change media of CD or floppy drive.
+
+    @param: name: VM's name.
+    @param: path: Fully-qualified path or target of disk device
small issue..device?path?
thanks it should be  @param: device

+    @param: source: source of the media
+    @param: options: command change_media options.
+    @param: dargs: standardized virsh function API keywords
+    @return: CmdResult instance
+    """
+    cmd = "change-media %s %s %s" % (name, device, source)
Last few weeks I used this command to do something, and I found when guest is shutoff and device has source or it's fully-qualified path, and options is "--eject" that the source parameter is optional , it can be null (actually it can be anything, even xyz, perhaps it's a bug :-( )... So I suggest the source parameter is designed to be optional and do something in codes to make sure the source parameter is not null when option is not "--eject"..(--update option's action needs to be considered too)

Maybe I make this complicated, you can ignore this suggestion if it's useless..:-)
change-media do not check the patch whether valid ,it just instead the xml string ,maybe I can file a [RFE] bug for that :> yes ,source can be set optional , i will update my patch for that ,thanks for suggestion

+    if options:
+        cmd += " %s " % options
+    return command(cmd, **dargs)
+



--
Best Regards!
Wenlong Huang
IRC Account: wenlong
Phone: 62608117 / 15011214521

_______________________________________________
Virt-test-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virt-test-devel

Reply via email to