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?
+    @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..:-)
+    if options:
+        cmd += " %s " % options
+    return command(cmd, **dargs)
+


--
Regards,
--------------------------------------------------
Li Yang
No. 6 Wenzhu Road, Nanjing, 210012, China
TEL:+86+25-86630566-8526
FUJITSU INTERNAL:7998-8526
FAX:+86+25-83317685
EMail:[email protected]
--------------------------------------------------
This communication is for use by the intended recipient(s) only and may contain 
information that is privileged, confidential and exempt from disclosure under 
applicable law. If you are not an intended recipient of this communication, you 
are hereby notified that any dissemination, distribution or copying hereof is 
strictly prohibited.  If you have received this communication in error, please 
notify me by reply e-mail, permanently delete this communication from your 
system, and destroy any hard copies you may have printed



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

Reply via email to