Tuesday, July 30, 2019

missing required virtualport type on RHEL

If you define vm with virtualinterfaces, that don't have virtualport, then cloning of such vms will fail with below error


*** libvirtError: XML error: missing required virtualport type



Eg xml for the vm, where you'd see the failure while cloning

38     type='bridge'>
39       address='52:54:00:8c:30:e1'/>
40       bridge='br0'/>
41       type='virtio'/>
42       
type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
43     
44     type='bridge'>
45       address='52:54:00:e6:70:f8'/>
46       bridge='nsx-managed'/>
47       type='openvswitch'>
48         interfaceid='df55d7eb-5f25-43db-8bf8-f67b259bf51b'/>
49       
50       type='virtio'/>
51       
type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
52     

A bad work-around is to comment out the line which does this validation


/usr/share/virt-manager/virtinst/cloner.py


     def start_duplicate(self, meter=None):
         """
         Actually perform the duplication: cloning disks if needed and defining
         the new clone xml.
         """
         logging.debug("Starting duplicate.")
         meter = util.ensure_meter(meter)

         dom = None
         try:
             # Replace orig VM if required
             Guest.check_vm_collision(self.conn, self.clone_name,
                                      do_remove=self.replace)

             # Define domain early to catch any xml errors before duping storage
             # The below statement was commented out for systest. While cloning a VM
             # with no virtual port defined, it will error out
             #dom = self.conn.defineXML(self.clone_xml)
             dom = None
             if self.preserve:
                 for dst_dev in self.clone_disks:
                     dst_dev.setup(meter=meter)
                 if self._nvram_disk:
                     self._nvram_disk.setup(meter=meter)
         except Exception as e:
             logging.debug("Duplicate failed: %s", str(e))
             if dom:
                 dom.undefine()

             raise


0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home