You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cloudstack.apache.org by Muhammad Adeel Zahid <16...@lums.edu.pk> on 2017/10/18 14:59:04 UTC

Creating a Template from VM and then VM's from that template

Hello,


I have installed apache cloudstack suite on two of my machine. First machine acts both as management server and as hypervisor (kvm). My second machine acts only as hypervisor(kvm). I first created a VM, say vm1, from centOS ISO and added some software that I need new VM's to have. I, then, created a template, say t1,  from vm1 so that I can create new VMs using this template. But when I created a new VM say vm2 from t1 , it does not assume any IP address for eth0 interface. It only has loopback interface address.

The reason seems to be ifcfg-eth0 file in /etc/sysconfig/network-scripsts/ directory.

This file is exactly the same in vm1 and vm2 including HWADDR and UUID entries. I presume this is the reason vm2 is not being able to get an IP address. Any Suggestions? Am I doing it wrong way?


Regards

Adeel


Re: Creating a Template from VM and then VM's from that template

Posted by Dag Sonstebo <Da...@shapeblue.com>.
No problem Adeel – in short you follow the same procedure whenever you create a template – whether this is for CloudStack – or for any other non-CloudStack hosted hypervisors. You are looking to strip out any NIC mac addresses and udev rules from your source VM, as well as any DHCP lease files. You also prepopulate with any SSH keys or root passwords you want your end users to utilise.

You’ll find a ton of guides for this – see a couple below (I’m not the owner of these):

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.0/html/Evaluation_Guide/Evaluation_Guide-Create_RHEL_Template.html 
https://banck.net/2016/04/creating-vmware-centos-7-template/ 

Regards,
Dag Sonstebo
Cloud Architect
ShapeBlue

On 19/10/2017, 08:55, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:

    Hi Dag,
    
    
    Unfortunately, I deleted everything (the template and the VMs) and now starting afresh. Will post if I have problems.
    
    
    Regards
    
    Adeel
    
    ________________________________
    From: Dag Sonstebo <Da...@shapeblue.com>
    Sent: Thursday, October 19, 2017 4:17:24 AM
    To: users@cloudstack.apache.org
    Subject: Re: Creating a Template from VM and then VM's from that template
    
    Could you post up the contents of your ifcfg-eth0 on the ISO VM and the template created VM? (Please don’t attach files since they are stripped by the mailing list).
    
    The other thing I noticed just now is the documentation doesn’t mention cleaning your DHCP cache files – this also needs done on the source VM.
    
    Regards,
    Dag Sonstebo
    Cloud Architect
    ShapeBlue
     S: +44 20 3603 0540  | dag.sonstebo@shapeblue.com | http://www.shapeblue.com <http://www.shapeblue.com/> | Twitter:@ShapeBlue <https://twitter.com/#!/shapeblue>
    
    
    On 18/10/2017, 22:19, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:
    
        Hi Dag,
    
    
        Thanks for the response. I created the first VM from ISO image. Then I followed the instructions in the link you posted but still having same problem. Any suggestions
    
    
    
        Regards
    
        Adeel
    
        ________________________________
        From: Dag Sonstebo <Da...@shapeblue.com>
        Sent: Wednesday, October 18, 2017 9:08:15 PM
        To: users@cloudstack.apache.org
        Subject: Re: Creating a Template from VM and then VM's from that template
    
        Hi Adeel,
    
        You need to tidy up the first source VM before you create a template from this – it will most likely still have udev rules and hard coded MAC addresses still in it. This means when the first VM is created from the template the networking can’t find the NICs which were in the original VM and networking fails.
    
        More information in http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/4.9/templates.html
    
        Regards,
        Dag Sonstebo
        Cloud Architect
        ShapeBlue
    
        On 18/10/2017, 15:59, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:
    
            Hello,
    
    
            I have installed apache cloudstack suite on two of my machine. First machine acts both as management server and as hypervisor (kvm). My second machine acts only as hypervisor(kvm). I first created a VM, say vm1, from centOS ISO and added some software that I need new VM's to have. I, then, created a template, say t1,  from vm1 so that I can create new VMs using this template. But when I created a new VM say vm2 from t1 , it does not assume any IP address for eth0 interface. It only has loopback interface address.
    
            The reason seems to be ifcfg-eth0 file in /etc/sysconfig/network-scripsts/ directory.
    
            This file is exactly the same in vm1 and vm2 including HWADDR and UUID entries. I presume this is the reason vm2 is not being able to get an IP address. Any Suggestions? Am I doing it wrong way?
    
    
            Regards
    
            Adeel
    
    
    
    
        Dag.Sonstebo@shapeblue.com
        www.shapeblue.com<http://www.shapeblue.com>
        53 Chandos Place, Covent Garden, London  WC2N 4HSUK
        @shapeblue
    
    
    
    
    
    
    Dag.Sonstebo@shapeblue.com
    www.shapeblue.com<http://www.shapeblue.com>
    53 Chandos Place, Covent Garden, London  WC2N 4HSUK
    @shapeblue
    
    
    
    


Dag.Sonstebo@shapeblue.com 
www.shapeblue.com
53 Chandos Place, Covent Garden, London  WC2N 4HSUK
@shapeblue
  
 


Re: Creating a Template from VM and then VM's from that template

Posted by Muhammad Adeel Zahid <16...@lums.edu.pk>.
Hi Dag,


Unfortunately, I deleted everything (the template and the VMs) and now starting afresh. Will post if I have problems.


Regards

Adeel

________________________________
From: Dag Sonstebo <Da...@shapeblue.com>
Sent: Thursday, October 19, 2017 4:17:24 AM
To: users@cloudstack.apache.org
Subject: Re: Creating a Template from VM and then VM's from that template

Could you post up the contents of your ifcfg-eth0 on the ISO VM and the template created VM? (Please don’t attach files since they are stripped by the mailing list).

The other thing I noticed just now is the documentation doesn’t mention cleaning your DHCP cache files – this also needs done on the source VM.

Regards,
Dag Sonstebo
Cloud Architect
ShapeBlue
 S: +44 20 3603 0540  | dag.sonstebo@shapeblue.com | http://www.shapeblue.com <http://www.shapeblue.com/> | Twitter:@ShapeBlue <https://twitter.com/#!/shapeblue>


On 18/10/2017, 22:19, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:

    Hi Dag,


    Thanks for the response. I created the first VM from ISO image. Then I followed the instructions in the link you posted but still having same problem. Any suggestions



    Regards

    Adeel

    ________________________________
    From: Dag Sonstebo <Da...@shapeblue.com>
    Sent: Wednesday, October 18, 2017 9:08:15 PM
    To: users@cloudstack.apache.org
    Subject: Re: Creating a Template from VM and then VM's from that template

    Hi Adeel,

    You need to tidy up the first source VM before you create a template from this – it will most likely still have udev rules and hard coded MAC addresses still in it. This means when the first VM is created from the template the networking can’t find the NICs which were in the original VM and networking fails.

    More information in http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/4.9/templates.html

    Regards,
    Dag Sonstebo
    Cloud Architect
    ShapeBlue

    On 18/10/2017, 15:59, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:

        Hello,


        I have installed apache cloudstack suite on two of my machine. First machine acts both as management server and as hypervisor (kvm). My second machine acts only as hypervisor(kvm). I first created a VM, say vm1, from centOS ISO and added some software that I need new VM's to have. I, then, created a template, say t1,  from vm1 so that I can create new VMs using this template. But when I created a new VM say vm2 from t1 , it does not assume any IP address for eth0 interface. It only has loopback interface address.

        The reason seems to be ifcfg-eth0 file in /etc/sysconfig/network-scripsts/ directory.

        This file is exactly the same in vm1 and vm2 including HWADDR and UUID entries. I presume this is the reason vm2 is not being able to get an IP address. Any Suggestions? Am I doing it wrong way?


        Regards

        Adeel




    Dag.Sonstebo@shapeblue.com
    www.shapeblue.com<http://www.shapeblue.com>
    53 Chandos Place, Covent Garden, London  WC2N 4HSUK
    @shapeblue






Dag.Sonstebo@shapeblue.com
www.shapeblue.com<http://www.shapeblue.com>
53 Chandos Place, Covent Garden, London  WC2N 4HSUK
@shapeblue




Re: Creating a Template from VM and then VM's from that template

Posted by Dag Sonstebo <Da...@shapeblue.com>.
Could you post up the contents of your ifcfg-eth0 on the ISO VM and the template created VM? (Please don’t attach files since they are stripped by the mailing list).

The other thing I noticed just now is the documentation doesn’t mention cleaning your DHCP cache files – this also needs done on the source VM.

Regards, 
Dag Sonstebo
Cloud Architect
ShapeBlue
 S: +44 20 3603 0540  | dag.sonstebo@shapeblue.com | http://www.shapeblue.com <http://www.shapeblue.com/> | Twitter:@ShapeBlue <https://twitter.com/#!/shapeblue>


On 18/10/2017, 22:19, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:

    Hi Dag,
    
    
    Thanks for the response. I created the first VM from ISO image. Then I followed the instructions in the link you posted but still having same problem. Any suggestions
    
    
    
    Regards
    
    Adeel
    
    ________________________________
    From: Dag Sonstebo <Da...@shapeblue.com>
    Sent: Wednesday, October 18, 2017 9:08:15 PM
    To: users@cloudstack.apache.org
    Subject: Re: Creating a Template from VM and then VM's from that template
    
    Hi Adeel,
    
    You need to tidy up the first source VM before you create a template from this – it will most likely still have udev rules and hard coded MAC addresses still in it. This means when the first VM is created from the template the networking can’t find the NICs which were in the original VM and networking fails.
    
    More information in http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/4.9/templates.html
    
    Regards,
    Dag Sonstebo
    Cloud Architect
    ShapeBlue
    
    On 18/10/2017, 15:59, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:
    
        Hello,
    
    
        I have installed apache cloudstack suite on two of my machine. First machine acts both as management server and as hypervisor (kvm). My second machine acts only as hypervisor(kvm). I first created a VM, say vm1, from centOS ISO and added some software that I need new VM's to have. I, then, created a template, say t1,  from vm1 so that I can create new VMs using this template. But when I created a new VM say vm2 from t1 , it does not assume any IP address for eth0 interface. It only has loopback interface address.
    
        The reason seems to be ifcfg-eth0 file in /etc/sysconfig/network-scripsts/ directory.
    
        This file is exactly the same in vm1 and vm2 including HWADDR and UUID entries. I presume this is the reason vm2 is not being able to get an IP address. Any Suggestions? Am I doing it wrong way?
    
    
        Regards
    
        Adeel
    
    
    
    
    Dag.Sonstebo@shapeblue.com
    www.shapeblue.com<http://www.shapeblue.com>
    53 Chandos Place, Covent Garden, London  WC2N 4HSUK
    @shapeblue
    
    
    
    


Dag.Sonstebo@shapeblue.com 
www.shapeblue.com
53 Chandos Place, Covent Garden, London  WC2N 4HSUK
@shapeblue
  
 


Re: Creating a Template from VM and then VM's from that template

Posted by Muhammad Adeel Zahid <16...@lums.edu.pk>.
Hi Dag,


Thanks for the response. I created the first VM from ISO image. Then I followed the instructions in the link you posted but still having same problem. Any suggestions



Regards

Adeel

________________________________
From: Dag Sonstebo <Da...@shapeblue.com>
Sent: Wednesday, October 18, 2017 9:08:15 PM
To: users@cloudstack.apache.org
Subject: Re: Creating a Template from VM and then VM's from that template

Hi Adeel,

You need to tidy up the first source VM before you create a template from this – it will most likely still have udev rules and hard coded MAC addresses still in it. This means when the first VM is created from the template the networking can’t find the NICs which were in the original VM and networking fails.

More information in http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/4.9/templates.html

Regards,
Dag Sonstebo
Cloud Architect
ShapeBlue

On 18/10/2017, 15:59, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:

    Hello,


    I have installed apache cloudstack suite on two of my machine. First machine acts both as management server and as hypervisor (kvm). My second machine acts only as hypervisor(kvm). I first created a VM, say vm1, from centOS ISO and added some software that I need new VM's to have. I, then, created a template, say t1,  from vm1 so that I can create new VMs using this template. But when I created a new VM say vm2 from t1 , it does not assume any IP address for eth0 interface. It only has loopback interface address.

    The reason seems to be ifcfg-eth0 file in /etc/sysconfig/network-scripsts/ directory.

    This file is exactly the same in vm1 and vm2 including HWADDR and UUID entries. I presume this is the reason vm2 is not being able to get an IP address. Any Suggestions? Am I doing it wrong way?


    Regards

    Adeel




Dag.Sonstebo@shapeblue.com
www.shapeblue.com<http://www.shapeblue.com>
53 Chandos Place, Covent Garden, London  WC2N 4HSUK
@shapeblue




Re: Creating a Template from VM and then VM's from that template

Posted by Dag Sonstebo <Da...@shapeblue.com>.
Hi Adeel,

You need to tidy up the first source VM before you create a template from this – it will most likely still have udev rules and hard coded MAC addresses still in it. This means when the first VM is created from the template the networking can’t find the NICs which were in the original VM and networking fails.

More information in http://docs.cloudstack.apache.org/projects/cloudstack-administration/en/4.9/templates.html 

Regards,
Dag Sonstebo
Cloud Architect
ShapeBlue

On 18/10/2017, 15:59, "Muhammad Adeel Zahid" <16...@lums.edu.pk> wrote:

    Hello,
    
    
    I have installed apache cloudstack suite on two of my machine. First machine acts both as management server and as hypervisor (kvm). My second machine acts only as hypervisor(kvm). I first created a VM, say vm1, from centOS ISO and added some software that I need new VM's to have. I, then, created a template, say t1,  from vm1 so that I can create new VMs using this template. But when I created a new VM say vm2 from t1 , it does not assume any IP address for eth0 interface. It only has loopback interface address.
    
    The reason seems to be ifcfg-eth0 file in /etc/sysconfig/network-scripsts/ directory.
    
    This file is exactly the same in vm1 and vm2 including HWADDR and UUID entries. I presume this is the reason vm2 is not being able to get an IP address. Any Suggestions? Am I doing it wrong way?
    
    
    Regards
    
    Adeel
    
    


Dag.Sonstebo@shapeblue.com 
www.shapeblue.com
53 Chandos Place, Covent Garden, London  WC2N 4HSUK
@shapeblue