Fix passing existing disk to new VM option
authorMichal Novotny <minovotn@redhat.com>
Thu, 21 Jul 2011 16:09:39 +0000 (18:09 +0200)
committerMichal Novotny <minovotn@redhat.com>
Thu, 21 Jul 2011 16:09:39 +0000 (18:09 +0200)
Signed-off-by: Michal Novotny <minovotn@redhat.com>
\

classes/libvirt.php
data/test.dat
pages/domain-list.php

index be1ac05..02b48e3 100644 (file)
                                        if (!$this->create_image($disk['image'], $disk['size'], $disk['driver']))
                                                return false;
 
-                               $path = ini_get('libvirt.image_path');
+                               if ($disk['image'][0] != '/')
+                                       $path = ini_get('libvirt.image_path').'/'.$disk['image'];
+                               else
+                                       $path = $disk['image'];
+
                                $diskstr = "<disk type='file' device='disk'>
                                                <driver name='qemu' type='{$disk['driver']}' />
-                                                <source file='$path/{$disk['image']}'/>
+                                                <source file='$path'/>
                                                 <target bus='{$disk['bus']}' dev='hda' />
                                          </disk>";
                        }
index 94367c1..1b18725 100755 (executable)
@@ -3,4 +3,5 @@ Tab: connections
 START_TAB
 Local QEMU,qemu,0,ssh,0,,,
 Local Xen,xen,0,ssh,0,,,
+QEMU on mig,qemu,1,ssh,0,root,mig,,
 END_TAB
index 4c8fde9..5fac928 100644 (file)
                                        $id = '-';
                                $state = $lv->domain_state_translate($dom['state']);
                                $nics = $lv->get_network_cards($res);
+                               if (!$nics)
+                                       $nics = 0;
                                if (($diskcnt = $lv->get_disk_count($res)) > 0) {
                                        $disks = $diskcnt.' / '.$lv->get_disk_capacity($res);
                                        $diskdesc = $lang->get('cur_phys_size').': '.$lv->get_disk_capacity($res, true);