[one-users] Raw attributes not getting resolved

Ruben S. Montero rubensm at dacya.ucm.es
Thu Feb 4 14:42:40 PST 2010


Ok,

The file is src/vmm/LibVirtDriver.cc

You can move lines 539-559 (that's the part where the RAW attribute is
written) up to
486, before the

file << "\t</devices>" << endl;

statement

Cheers

Ruben
On Thu, Feb 4, 2010 at 10:42 PM, Jack Jill <jacknjill111 at gmail.com> wrote:
> The first option worked like a charm.
>
> The generated deployment descriptor was:
> <domain type='kvm'>
>     <name>one-33</name>
>     <memory>262144</memory>
>     <os>
>         <type>hvm</type>
>         <boot dev='hd'/>
>     </os>
>     <devices>
>         <emulator>/usr/bin/kvm</emulator>
>         <disk type='file' device='disk'>
>             <source file='/opt/nebula/ONE/var//33/images/disk.0'/>
>             <target dev='vda' bus='virtio'/>
>         </disk>
>         <interface type='bridge'>
>             <source bridge='br0'/>
>             <model type='virtio'/>
>         </interface>
>         <interface type='bridge'>
>             <source bridge='br0'/>
>             <mac address='00:03:0a:00:01:04'/>
>             <model type='virtio'/>
>         </interface>
>     </devices>
>     <features>
>         <pae/>
>         <acpi/>
>     </features>
>     <devices><serial type="pty"><source path="/dev/pts/5"/><target
> port="0"/></serial><console type="pty" tty="/dev/pts/5"><source
> path="/dev/pts/5"/><target port="0"/></console></devices>
> </domain>
>
> And the dumpxml reveals the correct configuration:
> <domain type='kvm' id='16'>
>   <name>one-33</name>
>   <uuid>f239ee68-f86a-6cfd-0f7c-87ccf0c8d57a</uuid>
>   <memory>262144</memory>
>   <currentMemory>262144</currentMemory>
>   <vcpu>1</vcpu>
>   <os>
>     <type arch='i686' machine='pc-0.11'>hvm</type>
>     <boot dev='hd'/>
>   </os>
>   <features>
>     <acpi/>
>     <pae/>
>   </features>
>   <clock offset='utc'/>
>   <on_poweroff>destroy</on_poweroff>
>   <on_reboot>restart</on_reboot>
>   <on_crash>destroy</on_crash>
>   <devices>
>     <emulator>/usr/bin/kvm</emulator>
>     <disk type='file' device='disk'>
>       <source file='/opt/nebula/ONE/var//33/images/disk.0'/>
>       <target dev='vda' bus='virtio'/>
>     </disk>
>     <interface type='bridge'>
>       <mac address='52:54:00:e8:39:7b'/>
>       <source bridge='br0'/>
>       <target dev='vnet4'/>
>       <model type='virtio'/>
>     </interface>
>     <interface type='bridge'>
>       <mac address='00:03:0a:00:01:04'/>
>       <source bridge='br0'/>
>       <target dev='vnet5'/>
>       <model type='virtio'/>
>     </interface>
>     <serial type='pty'>
>       <source path='/dev/pts/6'/>
>       <target port='0'/>
>     </serial>
>     <console type='pty' tty='/dev/pts/6'>
>       <source path='/dev/pts/6'/>
>       <target port='0'/>
>     </console>
>   </devices>
>   <seclabel type='dynamic' model='apparmor'>
>     <label>libvirt-f239ee68-f86a-6cfd-0f7c-87ccf0c8d57a</label>
>     <imagelabel>libvirt-f239ee68-f86a-6cfd-0f7c-87ccf0c8d57a</imagelabel>
>   </seclabel>
> </domain>
>
> I do like option 2. Could you point me to the source code file where I can
> make your suggested change. I suppose I can browse through the source and
> figure out the right file....
>
> Thanks,
> RS
>
>
> On Thu, Feb 4, 2010 at 3:15 PM, Ruben S. Montero <rubensm at dacya.ucm.es>
> wrote:
>>
>> Hi,
>>
>> It seems that the console attribute needs to be defined within the
>> devices element. We can try a couple of things:
>>
>> 1. Let see if libvirt can deal with two devices elements. Try to add:
>> RAW = [ type = "kvm",
>>              data = "</devices><serial type=\"pty\"><source
>>  path=\"/dev/pts/5\"/><target port=\"0\"/></serial><console type=\"pty\"
>>  tty=\"/dev/pts/5\"><source path=\"/dev/pts/5\"/><target
>>  port=\"0\"/></console></devices>" ]
>>
>> That is the same you have but within a device element
>>
>> 2. We can modify the KVM driver so the RAW attributes are generated
>> within the devices section. Or at least add an option to tell
>> OpenNebula where to put the RAW attributes.
>>
>> 3. If you need this for debugging purposes, you can always connect to
>> the VM through VNC with the GRAPHICS attribute...
>>
>> Cheers
>>
>> Ruben
>>
>> On Thu, Feb 4, 2010 at 7:16 PM, Jack Jill <jacknjill111 at gmail.com> wrote:
>> > I'm attempting to configure a console for my vm so I can connect to it
>> > via
>> > "virsh", but I believe I am screwing up the declaration in the template.
>> >
>> > <quote>
>> > RAW = [ type = "kvm", data = "<console type=\"stdio\"><target
>> > port=\"1\"/></console>" ]
>> > </quote>
>> >
>> > results in the following deployment descriptor:
>> >
>> > <domain type='kvm'>
>> >     <name>one-31</name>
>> >     <memory>262144</memory>
>> >     <os>
>> >         <type>hvm</type>
>> >         <boot dev='hd'/>
>> >     </os>
>> >     <devices>
>> >         <emulator>/usr/bin/kvm</emulator>
>> >         <disk type='file' device='disk'>
>> >             <source file='/opt/nebula/ONE/var//31/images/disk.0'/>
>> >             <target dev='vda' bus='virtio'/>
>> >         </disk>
>> >         <interface type='bridge'>
>> >             <source bridge='br0'/>
>> >             <model type='virtio'/>
>> >         </interface>
>> >         <interface type='bridge'>
>> >             <source bridge='br0'/>
>> >             <mac address='00:03:0a:00:01:04'/>
>> >             <model type='virtio'/>
>> >         </interface>
>> >     </devices>
>> >     <features>
>> >         <pae/>
>> >         <acpi/>
>> >     </features>
>> >     <console type="stdio"><target port="1"/></console>
>> > </domain>
>> >
>> > But when I attempt to connect to the console I get the following error:
>> >
>> > <quote>
>> > sudo virsh console one-31
>> > [sudo] password for xxxx:
>> > Connecting to uri: qemu:///system
>> > No console available for domain
>> > </quote>
>> >
>> > virsh dumpxml shows the following:
>> >
>> > <domain type='kvm' id='13'>
>> >   <name>one-31</name>
>> >   <uuid>89e69209-ba37-8ccf-832f-f637ab753710</uuid>
>> >   <memory>262144</memory>
>> >   <currentMemory>262144</currentMemory>
>> >   <vcpu>1</vcpu>
>> >   <os>
>> >     <type arch='i686' machine='pc-0.11'>hvm</type>
>> >     <boot dev='hd'/>
>> >   </os>
>> >   <features>
>> >     <acpi/>
>> >     <pae/>
>> >   </features>
>> >   <clock offset='utc'/>
>> >   <on_poweroff>destroy</on_poweroff>
>> >   <on_reboot>restart</on_reboot>
>> >   <on_crash>destroy</on_crash>
>> >   <devices>
>> >     <emulator>/usr/bin/kvm</emulator>
>> >     <disk type='file' device='disk'>
>> >       <source file='/opt/nebula/ONE/var//31/images/disk.0'/>
>> >       <target dev='vda' bus='virtio'/>
>> >     </disk>
>> >     <interface type='bridge'>
>> >       <mac address='52:54:00:9c:c1:cb'/>
>> >       <source bridge='br0'/>
>> >       <target dev='vnet4'/>
>> >       <model type='virtio'/>
>> >     </interface>
>> >     <interface type='bridge'>
>> >       <mac address='00:03:0a:00:01:04'/>
>> >       <source bridge='br0'/>
>> >       <target dev='vnet5'/>
>> >       <model type='virtio'/>
>> >     </interface>
>> >   </devices>
>> >   <seclabel type='dynamic' model='apparmor'>
>> >     <label>libvirt-89e69209-ba37-8ccf-832f-f637ab753710</label>
>> >
>> > <imagelabel>libvirt-89e69209-ba37-8ccf-832f-f637ab753710</imagelabel>
>> >   </seclabel>
>> > </domain>
>> >
>> > As you can see no console element.
>> >
>> > If I redefine the domain and add the following (via virsh), I can
>> > connect
>> > successfully.
>> >
>> > <domain type='kvm'>
>> >   <name>one-31</name>
>> >   <uuid>89e69209-ba37-8ccf-832f-f637ab753710</uuid>
>> >   <memory>262144</memory>
>> >   <currentMemory>262144</currentMemory>
>> >   <vcpu>1</vcpu>
>> >   <os>
>> >     <type arch='i686' machine='pc-0.11'>hvm</type>
>> >     <boot dev='hd'/>
>> >   </os>
>> >   <features>
>> >     <acpi/>
>> >     <pae/>
>> >   </features>
>> >   <clock offset='utc'/>
>> >   <on_poweroff>destroy</on_poweroff>
>> >   <on_reboot>restart</on_reboot>
>> >   <on_crash>destroy</on_crash>
>> >   <devices>
>> >     <emulator>/usr/bin/kvm</emulator>
>> >     <disk type='file' device='disk'>
>> >       <source file='/opt/nebula/ONE/var//31/images/disk.0'/>
>> >       <target dev='vda' bus='virtio'/>
>> >     </disk>
>> >     <interface type='bridge'>
>> >       <mac address='52:54:00:9c:c1:cb'/>
>> >       <source bridge='br0'/>
>> >       <target dev='vnet4'/>
>> >       <model type='virtio'/>
>> >     </interface>
>> >     <interface type='bridge'>
>> >       <mac address='00:03:0a:00:01:04'/>
>> >       <source bridge='br0'/>
>> >       <target dev='vnet5'/>
>> >       <model type='virtio'/>
>> >     </interface>
>> >     <serial type='pty'>
>> >       <source path='/dev/pts/5'/>
>> >       <target port='0'/>
>> >     </serial>
>> >     <console type='pty' tty='/dev/pts/5'>
>> >       <source path='/dev/pts/5'/>
>> >       <target port='0'/>
>> >     </console>
>> >   </devices>
>> > </domain>
>> >
>> > So I tried passing in the following as RAW attributes:
>> >
>> > RAW = [ type = "kvm",
>> >               data = "<serial type=\"pty\"><source
>> > path=\"/dev/pts/5\"/><target port=\"0\"/></serial><console type=\"pty\"
>> > tty=\"/dev/pts/5\"><source path=\"/dev/pts/5\"/><target
>> > port=\"0\"/></console>" ]
>> >
>> > The above results in the following deployment descriptor being
>> > generated:
>> >
>> > <domain type='kvm'>
>> >     <name>one-32</name>
>> >     <memory>262144</memory>
>> >     <os>
>> >         <type>hvm</type>
>> >         <boot dev='hd'/>
>> >     </os>
>> >     <devices>
>> >         <emulator>/usr/bin/kvm</emulator>
>> >         <disk type='file' device='disk'>
>> >             <source file='/opt/nebula/ONE/var//32/images/disk.0'/>
>> >             <target dev='vda' bus='virtio'/>
>> >         </disk>
>> >         <interface type='bridge'>
>> >             <source bridge='br0'/>
>> >             <model type='virtio'/>
>> >         </interface>
>> >         <interface type='bridge'>
>> >             <source bridge='br0'/>
>> >             <mac address='00:03:0a:00:01:04'/>
>> >             <model type='virtio'/>
>> >         </interface>
>> >     </devices>
>> >     <features>
>> >         <pae/>
>> >         <acpi/>
>> >     </features>
>> >     <serial type="pty"><source path="/dev/pts/5"/><target
>> > port="0"/></serial><console type="pty" tty="/dev/pts/5"><source
>> > path="/dev/pts/5"/><target port="0"/></console>
>> > </domain>
>> >
>> > But still cannot connect to the console. The dumpxml (via virsh) reveals
>> > the
>> > following:
>> >
>> > oneadmin at uecB:~/domainTemplates$ virsh dumpxml one-32
>> > Connecting to uri: qemu:///system
>> > <domain type='kvm' id='15'>
>> >   <name>one-32</name>
>> >   <uuid>c51c3deb-7685-3722-9df1-10600d3f2df0</uuid>
>> >   <memory>262144</memory>
>> >   <currentMemory>262144</currentMemory>
>> >   <vcpu>1</vcpu>
>> >   <os>
>> >     <type arch='i686' machine='pc-0.11'>hvm</type>
>> >     <boot dev='hd'/>
>> >   </os>
>> >   <features>
>> >     <acpi/>
>> >     <pae/>
>> >   </features>
>> >   <clock offset='utc'/>
>> >   <on_poweroff>destroy</on_poweroff>
>> >   <on_reboot>restart</on_reboot>
>> >   <on_crash>destroy</on_crash>
>> >   <devices>
>> >     <emulator>/usr/bin/kvm</emulator>
>> >     <disk type='file' device='disk'>
>> >       <source file='/opt/nebula/ONE/var//32/images/disk.0'/>
>> >       <target dev='vda' bus='virtio'/>
>> >     </disk>
>> >     <interface type='bridge'>
>> >       <mac address='52:54:00:9c:1f:76'/>
>> >       <source bridge='br0'/>
>> >       <target dev='vnet4'/>
>> >       <model type='virtio'/>
>> >     </interface>
>> >     <interface type='bridge'>
>> >       <mac address='00:03:0a:00:01:04'/>
>> >       <source bridge='br0'/>
>> >       <target dev='vnet5'/>
>> >       <model type='virtio'/>
>> >     </interface>
>> >   </devices>
>> >   <seclabel type='dynamic' model='apparmor'>
>> >     <label>libvirt-c51c3deb-7685-3722-9df1-10600d3f2df0</label>
>> >
>> > <imagelabel>libvirt-c51c3deb-7685-3722-9df1-10600d3f2df0</imagelabel>
>> >   </seclabel>
>> > </domain>
>> >
>> > As you can see, the RAW attributes did not get generated here. Any idea
>> > what
>> > is going on and how I can get this resolved.
>> >
>> >
>> > Also, the documentation at
>> > http://opennebula.org/doku.php?id=documentation:rel1.4:kvmg
>> >
>> > <quote>
>> >
>> >   RAW = [ type = "kvm",
>> >
>> >
>> >           data = "<console type=\"stdio\"><target port=\"1\"></console>"
>> > ]
>> >
>> > </quote>
>> >
>> > causes the deployment to fail with the following error in the vm.log
>> >
>> > Thu Feb  4 11:37:59 2010 [VMM][I]: error: Failed to create domain from
>> > /opt/nebula/ONE/var//30/images/deployment.0
>> > Thu Feb  4 11:37:59 2010 [VMM][I]: error: at line 28: Opening and ending
>> > tag
>> > mismatch: target line 28 and console
>> > Thu Feb  4 11:37:59 2010 [VMM][I]:
>> > Thu Feb  4 11:37:59 2010 [VMM][I]: ExitCode: 1
>> > Thu Feb  4 11:37:59 2010 [VMM][E]: Error deploying virtual machine
>> >
>> > Therefore please update the documentation.
>> >
>> > Front Controller:
>> > ---------------------
>> > Ubuntu Karmic
>> > Open Nebula 1.4
>> >
>> > Node:
>> > -------
>> > Ubuntu Karmic
>> > KVM hypervisor
>> >
>> > Thanks in advance,
>> > RS
>> >
>> > _______________________________________________
>> > Users mailing list
>> > Users at lists.opennebula.org
>> > http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>> >
>> >
>>
>>
>>
>> --
>> Dr. Ruben Santiago Montero
>> Associate Professor, Complutense University of Madrid
>>
>> URL:    http://dsa-research.org/doku.php?id=people:ruben
>> Weblog: http://blog.dsa-research.org/?author=7
>
>



-- 
Dr. Ruben Santiago Montero
Associate Professor, Complutense University of Madrid

URL:    http://dsa-research.org/doku.php?id=people:ruben
Weblog: http://blog.dsa-research.org/?author=7



More information about the Users mailing list