Diff
Not logged in

Differences From Artifact [b6f31d3d5f]:

To Artifact [73ceee4773]:


336
337
338
339
340
341
342




343
344
345
346
347










348
349
350
351
352
353
354
336
337
338
339
340
341
342
343
344
345
346





347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363







+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+







        cmd_stop(options)

def cmd_cdrom(options):
    """ vws cdrom """
    if options.id  is None:
        # Search for devices which could be interpreted as CDROM
        devlist = send_command(options.sock, "info block")
        idx = devlist.find("info block")
        if idx != -1:
            devlist=devlist[devlist.find("\n",idx)+1:]
        for dev in  devlist.split("\r\n\r\n"):
        for dev in  re.findall("([-\\w]+): [^\n]+\n    Removable device:",
                               devlist):
            if re.search("cd", dev):
                options.id = dev
                break
            if dev.find("\n    Removable device: ") == -1:
                continue
            if dev.startswith("floppy"):
                continue
            dev_id = dev[:dev.find(":")]    
            idx = dev_id.find(" ")
            if idx !=  -1:
                dev_id = dev[:idx]
            options.id = dev_id    
            break    
    if options.id is None:
        print("No CDROM device found among:\n" + devlist, file=sys.stderr)
        return 1
    if options.file == "":
        print("Please specify either --eject or iso image", file=sys.stderr)
        return 1
    if options.file is None: