Ack,
Mathi.
On Mon, Jul 3, 2017 at 9:27 PM, Alex Jones <[email protected]> wrote:
> If the controller is a VM, and the parent hypervisor instantiates, the
> controller VM is immediately reset.
>
> All VMs which are children of the hypervisor are immediately reset.
>
> Don't reset ourself if we are PLMD.
> ---
> src/plm/plmd/plms_virt.cc | 47 ++++++++++++++++++++++++++++++
> +++++++++--------
> 1 file changed, 39 insertions(+), 8 deletions(-)
>
> diff --git a/src/plm/plmd/plms_virt.cc b/src/plm/plmd/plms_virt.cc
> index fbe2e8a..7aee6e2 100644
> --- a/src/plm/plmd/plms_virt.cc
> +++ b/src/plm/plmd/plms_virt.cc
> @@ -24,6 +24,7 @@
>
> #include <libvirt/virterror.h>
> #include <cstring>
> +#include <fstream>
> #include <set>
> #include "osaf/immutil/immutil.h"
> #include "plm/common/plms_virt.h"
> @@ -561,15 +562,45 @@ extern "C" SaUint32T plms_ee_instantiate_vm(const
> PLMS_ENTITY *entity) {
>
> TRACE_ENTER();
>
> - // find the hypervisor and tell it to boot the vm
> - PlmsVmmMap::iterator vmmIt(plmsVmmMap.find(entity->parent->dn_name));
> + do {
> + bool instantiate(true);
>
> - if (vmmIt != plmsVmmMap.end()) {
> - rc = vmmIt->second->instantiate(entity->dn_name);
> - } else {
> - LOG_ER("unable to find hypervisor to instantiate vm: %s",
> - entity->dn_name.value);
> - }
> + std::string plmcdFile(SYSCONFDIR);
> + plmcdFile += "/plmcd.conf";
> +
> + std::ifstream ifs(plmcdFile.c_str(), std::ifstream::in);
> +
> + while (ifs.good()) {
> + char myEE[SA_MAX_NAME_LENGTH];
> +
> + ifs.getline(myEE, SA_MAX_NAME_LENGTH);
> +
> + if (!strncmp(myEE, "safEE", sizeof("safEE") - 1)) {
> + if (!strcmp(reinterpret_cast<const char
> *>(entity->dn_name.value),
> + myEE)) {
> + TRACE("not restting myself: virtual machine %s is already
> running",
> + entity->dn_name.value);
> + instantiate = false;
> + rc = NCSCC_RC_SUCCESS;
> + }
> +
> + break;
> + }
> + }
> +
> + if (!instantiate)
> + break;
> +
> + // find the hypervisor and tell it to boot the vm
> + PlmsVmmMap::iterator vmmIt(plmsVmmMap.find(entity->parent->dn_name));
> +
> + if (vmmIt != plmsVmmMap.end()) {
> + rc = vmmIt->second->instantiate(entity->dn_name);
> + } else {
> + LOG_ER("unable to find hypervisor to instantiate vm: %s",
> + entity->dn_name.value);
> + }
> + } while (false);
>
> TRACE_LEAVE();
>
> --
> 2.7.5
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel