'Attaches device to the guest.
:param conf: A LibvirtConfigObject of the device to attach
:param persistent: A bool to indicate whether the change is
persistent or not
:param live: A bool to indicate whether it affect the guest
in running state'

def attach_device(self, conf, persistent=False, live=False):

    flags = ((persistent and libvirt.VIR_DOMAIN_AFFECT_CONFIG) or 0)
    flags |= ((live and libvirt.VIR_DOMAIN_AFFECT_LIVE) or 0)
    device_xml = conf.to_xml()
    if (six.PY3 and isinstance(device_xml, six.binary_type)):
        device_xml = device_xml.decode('utf-8')
    LOG.debug('attach    device    xml:    %s', device_xml)
    self._domain.attachDeviceFlags(device_xml, flags=flags)
