Can we do bundle within a bundle?

2017-04-20 Thread fengxia
We have a design that calls for tree structure of entities, each will be 
mapped to a charm/bundle. So how to bundle a list of bundles?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Can we do bundle within a bundle?

2017-04-20 Thread fengxia

Thank you for the pointer. I'll take a look. Can it package local charms?


On 04/20/2017 03:58 PM, Junaid Ali wrote:

Fengxia,
juju-deployer 
<https://launchpad.net/%7Etvansteenburgh/+archive/ubuntu/ppa> could be 
helpful here to incorporate multiple bundles. Charm-testing repo 
<http://bazaar.launchpad.net/%7Eost-maintainers/openstack-charm-testing/trunk/files/head:/bundles/> 
can help you in using juju-deployer supported bundles e.g check this 
bundle 
<http://bazaar.launchpad.net/%7Eost-maintainers/openstack-charm-testing/trunk/view/head:/bundles/lxd/default.yaml>.



--
Junaid

On Fri, Apr 21, 2017 at 12:38 AM, Tom Barber <t...@spicule.co.uk 
<mailto:t...@spicule.co.uk>> wrote:


Currently bundles are pretty dumb and nested bundles don't exist.

Tom

On 20 Apr 2017 20:29, "fengxia" <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

We have a design that calls for tree structure of entities,
each will be mapped to a charm/bundle. So how to bundle a list
of bundles?

-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>


--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Can we do bundle within a bundle?

2017-04-20 Thread fengxia
If we have a tree hierarchy, three levels, 1,2,3 where lvl 1 is the 
root. We are thinking to make entity at each level a charm. I can see at 
level 2 I can create bundles to include level 3 charms, how about level 
1 then? What artifact should I use to include bundles in lvl2?


On 04/20/2017 03:38 PM, Tom Barber wrote:

Currently bundles are pretty dumb and nested bundles don't exist.

Tom

On 20 Apr 2017 20:29, "fengxia" <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


We have a design that calls for tree structure of entities, each
will be mapped to a charm/bundle. So how to bundle a list of bundles?

-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Juju deploy same application twice, failed "application already exist"

2017-04-20 Thread fengxia

Hi,

I have developed a charm called "test". Using command line to deploy 
from local repo:


$ juju deploy $JUJU_REPOSITORY/trusty/test

First one went well. Issuing this command again will give error:

08:28:49 ERROR cmd supercommand.go:460 cannot add application "test": 
application already exists


Must be missing something. How do you achieve HA then if one cant 
install multiple instances of a charm?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Juju deploy same application twice, failed "application already exist"

2017-04-20 Thread fengxia
I c. So I should have used add-unit command instead of "deploy". Is that 
right?



On 04/20/2017 08:34 AM, Tom Barber wrote:
You add new "units" so you can run n units of a charm which then can 
use the internal peer relation to deal with inter-app communications.


Tom

On Thu, Apr 20, 2017 at 1:32 PM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi,

I have developed a charm called "test". Using command line to
deploy from local repo:

$ juju deploy $JUJU_REPOSITORY/trusty/test

First one went well. Issuing this command again will give error:

08:28:49 ERROR cmd supercommand.go:460 cannot add application
"test": application already exists

Must be missing something. How do you achieve HA then if one cant
install multiple instances of a charm?

-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Tom Barber
CTO Spicule LTD
t...@spicule.co.uk <mailto:t...@spicule.co.uk>

http://spicule.co.uk

@spiculeim <http://twitter.com/spiculeim>

Schedule a meeting with me <http://meetme.so/spicule>

GB: +44(0)5603641316
US: +18448141689

<https://leanpub.com/juju-cookbook>


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Do states have namespace?

2017-04-18 Thread fengxia

Replying my own question:

charmhelpers.core.unitdata shows how states are stored -- 
"reactive.state.xyz" is saved in a sqlite3 as a string. So if split 
states in multiple charms, I think it will still work if deploying these 
charms to the same unit because they will be registered in the same DB.


Can someone verify this?

On 04/18/2017 08:50 AM, fengxia wrote:

I did a quick experiment:

1. Created two layers in one charm, each layer has a few states, 
set_state() can trigger @when defined in other layers.


2. Use the same set of states, now splitting them in two charms => 
@when don't trigger anymore.


So does this mean states have a namespace by the charm it belongs?



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Do states have namespace?

2017-04-18 Thread fengxia

I did a quick experiment:

1. Created two layers in one charm, each layer has a few states, 
set_state() can trigger @when defined in other layers.


2. Use the same set of states, now splitting them in two charms => @when 
don't trigger anymore.


So does this mean states have a namespace by the charm it belongs?

--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Juju charm hook vs. state

2017-04-14 Thread fengxia

I'm learning charm development and confused about state vs. hook.

I used @when_not("state.0") to mark the very first function that gets 
executed. In document it also says "install" hook will be the first to 
execute. Tried @hooks.hook("install") but it just failed at charm 
installation.


So what is the right way to determine the "entry" point in a charm? I 
mean the first function block that will be executed. I'm thinking to use 
chained state from that point on to guide execution process. Is this the 
right approach?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Do states have namespace?

2017-04-18 Thread fengxia

I see. Thanks for the pointer. This is very helpful in our design.


On 04/18/2017 09:30 AM, Marco Ceppi wrote:
On Tue, Apr 18, 2017 at 8:57 AM Alex Kavanagh 
<alex.kavan...@canonical.com <mailto:alex.kavan...@canonical.com>> wrote:


Hi


On Tue, Apr 18, 2017 at 1:50 PM, fengxia <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

I did a quick experiment:

1. Created two layers in one charm, each layer has a few
states, set_state() can trigger @when defined in other layers.

2. Use the same set of states, now splitting them in two
charms => @when don't trigger anymore.

So does this mean states have a namespace by the charm it belongs?


States are stored on the individual instance of the charm.  They
are private and no other charm can see those states.


More directly, states are private per unit of a charm. Layers 
namespace by convention rather than implicitly. For example, layer foo 
should set states as follows:


set_state('foo.state-name')

That state, as you've seen, can be responded to by any other layer in 
that charm, in that deployed unit. As such, if you have two units of 
charm bar, bar/0 can not see or set states for bar/1 and vice versa.


If you need to transfer state between charms, that's what Juju 
Relations are for. They provide the ability to transfer key/vals 
between one or more connected item: 
https://jujucharms.com/docs/stable/developer-layers-interfaces


Thanks,
Marco Ceppi


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Do states have namespace?

2017-04-18 Thread fengxia

Marco,

I'm modeling a complex workload which may end up having a lots of 
states. So before going down that path I want to understand better how 
to modularize these states instead of laying all flat. So I thought of 
putting them into different layers within a single charm -- this works. 
Then to divide them into different charms -- this didn't.


Now I can see each unit has its own sqlite so these states won't come 
across.


On 04/18/2017 10:16 AM, Marco Ceppi wrote:


No, because it's a sqlitedb per unit of charm. So a charm collocated 
on the same machine will still have its own state.


Can I ask what you're looking to achieve?

Marco


On Tue, Apr 18, 2017, 10:05 fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Replying my own question:

charmhelpers.core.unitdata shows how states are stored --
"reactive.state.xyz <http://reactive.state.xyz>" is saved in a
sqlite3 as a string. So if split
states in multiple charms, I think it will still work if deploying
these
charms to the same unit because they will be registered in the
same DB.

Can someone verify this?

On 04/18/2017 08:50 AM, fengxia wrote:
> I did a quick experiment:
>
> 1. Created two layers in one charm, each layer has a few states,
> set_state() can trigger @when defined in other layers.
>
> 2. Use the same set of states, now splitting them in two charms =>
> @when don't trigger anymore.
>
> So does this mean states have a namespace by the charm it belongs?
>

--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Is a set state called multiple times?

2017-07-28 Thread fengxia

Very helpful indeed! Thank you for the insight Alex.

The concern of "doing too much" is exactly what started conversation 
when we are expecrimenting with charm, because in our design we are 
using charm as a state-driven framework that interacts with external 
resources. So it's the sanity of these external resources we want to guard.




On 07/28/2017 05:37 AM, Alex Kavanagh wrote:

Hi fengxia

As Cory says, it's much better to think of the set_state() and 
remove_state() as binary flags; in fact in the upcoming version, 
set_state becomes set_flag() and remove_state() becomes remove_flag() 
 -- although the existing functions will still exist for backwards 
compatibility.


So a handler with a set of conditions built from flags (states) that 
evaluates to 'true' will always run on EVERY invocation of the charm; 
that's all of the charm hooks, plus relation hooks.


This can often lead to a charm 'doing too much' during a hook 
invocation if you don't gate or otherwise detect that a charm doesn't 
need to do something.  I've had 'bugs' in the past where databases 
were set up multiple times because I didn't gate (by using a 
flag/state) the 'have I set up the database yet'.  Just something to 
watch for.


Also, the update-status hook is a bit redundant now.  To get 
equivalent functionality without having to use a 
@hook('update-status') just use a @when_not("never-set-update-status") 
and it will always run on every hook invocation; it also means you can 
gate the 'update status' if certain other things haven't happened.


And yes, in your example, you can use flags to 'make progress' in the 
charm life-cycle by using them to only run a bit of functionality 
once.  You can always do them in cycles too!


Finally, remember that states are NOT shared amongst units of the same 
application; they are unique to each individual unit.  Juju is not 
aware that the charm is using reactive states.


Hope this helps
Cheers
Alex.


On Thu, Jul 27, 2017 at 9:09 PM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Now thinking of it, I just realized that this concept of True
state executing repeatedly is actually a good thing.


In many cases, there is a need to query external resource for its
status. This is often implemented as a polling loop. So in charm,
I can implement it as


@when("prep")

def prep():

# are we there yet?

is_ready = prep_test()

if is_ready:

remove_state("prep")

set_state("do.sth")

@when("do.sth")

def do_sth():

# do this

pass


# move on

remove_state("do.sth")

set_state("next")


On 07/27/2017 03:56 PM, Cory Johns wrote:

fengxia,

It's probably more enlightening to think of them as "flags"
rather than states.  (Indeed, the next release of charms.reactive
will deprecate calling them states and will provide set_flag,
remove_flag, etc. functions instead.)

On Thu, Jul 27, 2017 at 3:29 PM, fengxia <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

Alex,

Thank you for the detailed explanations and examples.

After reading Tilman's and Cory's replies, I think the
confusion is at continuous evaluation (thus execution) of a
True state. So a pair of @when and @when_not will result in
one of them being executed over and over despite adding a
remove_state("myself") in the @when block.

I'm still trying to grasp the idea of this "state" instead of
treating it as an event handler.

So for states, I usually draw a state machine diagram. In
this case, it feels rather unnatural that all True states
will inherently loop to themselves.

But I don't what alternative is in charm's context.


On 07/27/2017 04:13 AM, Alex Kavanagh wrote:

Hi

On Thu, Jul 27, 2017 at 2:37 AM, fengxia <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

Hi Juju,

Once I set a state, set_state("here"), I want to make
sure its @when will only be executed ONCE (when "here"
from False->True).

So my thought is to remove_state("here") in its
@when("here") code block. If I don't, will this @when be
called multiple times if I don't reset this state?
What's the good practice here?


You have a couple of options here depending on the nature of
the handler.

 1. If, in the lifetime of the unit's existence, the handler
only has to execute ONCE.  (and I mean EVER), then there
is a @only_once decorator that can be used.  It can be
used in combination with other decorators to set 

Re: LXD bootstrap inside KVM failed

2017-08-02 Thread fengxia

For anyone, the solution is rather strange:

$ sudo service stop bind9

$ sudo lxd start

Reference: https://github.com/lxc/lxd/issues/2046


On 08/02/2017 03:33 PM, fengxia wrote:

Hi Juju,

I have a 16.04 KVM. Installed juju and LXD from apt.

$ juju bootstrap localhost test

ERROR creating LXD client: can't connect to the local LXD server: Get 
http://unix.socket/1.0: read unix @->/var/lib/lxd/unix.socket: read: 
connection reset by peer


Please install LXD by running:
$ sudo apt-get install lxd
and then configure it with:
$ newgrp lxd
$ lxd init

Tried the suggested commands. Rebooted KVM. No avail.

Is this because I'm running LXD inside KVM?



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: LXD bootstrap inside KVM failed

2017-08-02 Thread fengxia

Here is an update. Manually run this command,

$ sudo lxd --group lxd

Then $ lxc list works. So the LXD service was not started after reboot. 
Permission issue?


On 08/02/2017 03:33 PM, fengxia wrote:

Hi Juju,

I have a 16.04 KVM. Installed juju and LXD from apt.

$ juju bootstrap localhost test

ERROR creating LXD client: can't connect to the local LXD server: Get 
http://unix.socket/1.0: read unix @->/var/lib/lxd/unix.socket: read: 
connection reset by peer


Please install LXD by running:
$ sudo apt-get install lxd
and then configure it with:
$ newgrp lxd
$ lxd init

Tried the suggested commands. Rebooted KVM. No avail.

Is this because I'm running LXD inside KVM?



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: JUJU bootstrap error

2017-08-03 Thread fengxia

Another thing to check. Is your VM in the "READY" state?


On 08/03/2017 03:12 AM, wahi wrote:


Dear all,


Recently I am investingating the installation of Openstack using MAAS
and JUJU.

I installaed MAAS on bare metals server Ubuntu 16.04, I have another
server also which has Ubuntu 16.04.

I managed to deploy several KVM virtual machines on two servers using
MAAS, so every VM got private IP address form MAAS.


I installed JUJU package on a VM which is located on the second server
(not MAAS server), from there I did the following steps:

juju add-cloud /here I chose MAAS/

Here: Enter the API endpoint url: http://public_IP_OF_MAAS:5240/MAAS

juju bootstrap maas-cloud

juju clouds /maas-cloud is there/

juju add-credential maas-cloud /Entered the API key/

juju bootstrap maas-cloud maas-cloud-controller

after this command getting

Creating Juju controller "prodmaas-controller" on prodmaas

Looking for packaged Juju agent version 2.0.2 for amd64

Launching controller instance(s) on prodmaas...

ERROR failed to bootstrap model: cannot start bootstrap instance:
cannot run instances: cannot run instance: No available machine
matches constraints: [('zone', ['default']), ('agent_name',
['f7a273ac-6190-4798-8ee6-f7d2df722b27']), ('mem', ['3584'])]
(resolved to "mem=3584.0 zone=default")


I need to mention that I have a VM on MAAS server with 4GB memory!!!
(I don’t know if the error related to that)


Could you please help me to identify the problem.


Thank you very much in advance.



Regards,

Wahi





--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: JUJU bootstrap error

2017-08-03 Thread fengxia

I think your old SSH won't work anymore.

Instead, at juju CLI terminal, find the machine number, say machine 1, 
that corresponds to your VM, then


$ juju ssh 1

During the provisioning process, juju creates its own credentials so 
your MAAS ssh is not relevant. That's my understanding.



On 08/03/2017 02:36 PM, wahi wrote:
I was trying to ssh from the MAAS server as when the VM was deployed. 
and got ssh key permission error.


But it worked as you have suggested.

Thank you.


On 08/03/2017 10:34 PM, Witold Krecicki wrote:

What do you mean by 'not working'? What's the error message?
You can try connecting to it by using juju ssh -m controller 0


On Thu, Aug 3, 2017 at 8:24 PM, wahi <w...@sci.am> wrote:

One and final question.

When I released the node and deployed it once again, the ssh 
connection with
it not working, it was working before releasing, I think it is 
something

related to ssh known hosts keys etc how can I adjust it ?

Thank you very much once again.



On 08/03/2017 10:12 PM, wahi wrote:

Yes indeed the situation is much better now:

juju bootstrap maas-cloud maas-cloud-controller
Creating Juju controller "maas-cloud-controller" on maas-cloud
Looking for packaged Juju agent version 2.2.2 for amd64
Launching controller instance(s) on maas-cloud...
  - hwgnpw (arch=amd64 mem=4G cores=2)
Fetching Juju GUI 2.7.5
Waiting for address
Attempting to connect to 10.0.17.7:22
sudo: unable to resolve host node5
Bootstrap agent now started
Contacting Juju controller at 10.0.17.7 to verify accessibility...
Bootstrap complete, "maas-cloud-controller" controller now available.
Controller machines are in the "controller" model.
Initial model "default" added.

Do I need to add public IP to this VM in order to use JUJU 
controller web

UI.

And thank you very much for all suggestions and help.


On 08/03/2017 10:02 PM, wahi wrote:
I released the VM now and erasing the disk, I will try to 
bootstrap and

update the status.


On 08/03/2017 09:55 PM, Witold Krecicki wrote:
It has to be ready and available for juju - it'll take care of 
deploying

it.

On Thu, Aug 3, 2017 at 7:48 PM, wahi <w...@sci.am> wrote:

Hi Fengxia,

Thanks for your response.

Actually the VM is deployed already by MAAS, do I need to 
commission it

and
not go to the deployment ? is the deployment will be by JUJU ?


On 08/03/2017 06:23 PM, fengxia wrote:

Another thing to check. Is your VM in the "READY" state?


On 08/03/2017 03:12 AM, wahi wrote:

Dear all,


Recently I am investingating the installation of Openstack using 
MAAS

and
JUJU.

I installaed MAAS on bare metals server Ubuntu 16.04, I have 
another

server
also which has Ubuntu 16.04.

I managed to deploy several KVM virtual machines on two servers 
using

MAAS,
so every VM got private IP address form MAAS.


I installed JUJU package on a VM which is located on the second 
server

(not
MAAS server), from there I did the following steps:

juju add-cloud /here I chose MAAS/

Here: Enter the API endpoint url: 
http://public_IP_OF_MAAS:5240/MAAS


juju bootstrap maas-cloud

juju clouds /maas-cloud is there/

juju add-credential maas-cloud /Entered the API key/

juju bootstrap maas-cloud maas-cloud-controller

after this command getting

Creating Juju controller "prodmaas-controller" on prodmaas

Looking for packaged Juju agent version 2.0.2 for amd64

Launching controller instance(s) on prodmaas...

ERROR failed to bootstrap model: cannot start bootstrap instance:
cannot run
instances: cannot run instance: No available machine matches
constraints:
[('zone', ['default']), ('agent_name',
['f7a273ac-6190-4798-8ee6-f7d2df722b27']), ('mem', ['3584'])] 
(resolved

to
"mem=3584.0 zone=default")


I need to mention that I have a VM on MAAS server with 4GB 
memory!!! (I

don’t know if the error related to that)


Could you please help me to identify the problem.


Thank you very much in advance.



Regards,

Wahi




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums





--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju






--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How to set local charm path in bundle file

2017-08-03 Thread fengxia

Hi Juju,

Trying to deploy a bundle which consists of local charms.

$JUJU_REPOSITORY=/home/fengxia/workspace/dist

in this folder, all charms are in "trusty/"

Bundle file is located in /home/fengxia/workspace/project/test.yaml:

services:
  # solution
  solution:
charm: ./trusty/solution
num_units: 1

But juju deploy tet.yaml yields an error:

ERROR the provided bundle has the following errors:
charm path in application "solution" does not exist: 
/home/fengxia/workspace/project/trusty/solution


Looks to me that it ignores the $JUJU_REPOSITORY setting, and looking 
for the charm in local directory instead. I know "./trusty/solution" is 
pointing it this way.


So question now is, what's the right setting in bundle when charms are 
NOT in the same folder as the bundle file?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: How to set local charm path in bundle file

2017-08-03 Thread fengxia

Thanks Dmitrii.

This is... not exactly an ideal in my case. The bundle file is a static, 
and charms are built by a CI. So I would rather have a cleaner way to 
decouple the two. In other words, CI can have a /dist somewhere it feels 
so, and bundle only needs know the charms are local, and using sth like 
the OS environment variable (or a Juju config of some kind?) to link the 
two.


Another question then, I know $JUJU_REPOSITORY is still used in `charm 
build` to indicate where the built charms will be. Reading the note, 
does it mean it is not used there either? But in Juju version 
2.0.2-xenial-amd64 it still is.



On 08/03/2017 04:40 PM, Dmitrii Shcherbakov wrote:

Hi Feng,

Just use an absolute path:

https://github.com/juju/docs/pull/1980

Best Regards,
Dmitrii Shcherbakov

Field Software Engineer
IRC (freenode): Dmitrii-Sh

On Thu, Aug 3, 2017 at 11:34 PM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Juju,

Trying to deploy a bundle which consists of local charms.

$JUJU_REPOSITORY=/home/fengxia/workspace/dist

in this folder, all charms are in "trusty/"

Bundle file is located in /home/fengxia/workspace/project/test.yaml:

services:
  # solution
  solution:
charm: ./trusty/solution
num_units: 1

But juju deploy tet.yaml yields an error:

ERROR the provided bundle has the following errors:
charm path in application "solution" does not exist:
/home/fengxia/workspace/project/trusty/solution

Looks to me that it ignores the $JUJU_REPOSITORY setting, and
looking for the charm in local directory instead. I know
"./trusty/solution" is pointing it this way.

So question now is, what's the right setting in bundle when charms
are NOT in the same folder as the bundle file?

-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: charm layers hooks/install, how are they "merged"?

2017-08-11 Thread fengxia

Make sense. Thank you Stuart.


On 08/11/2017 06:31 AM, Stuart Bishop wrote:

On 11 August 2017 at 09:02, fengxia <fx...@lenovo.com> wrote:

Hi Juju,

I'm building a charm by including two layers in layer.yaml:

includes:
   - 'layer:basic'
   - 'layer:pylxca'

Pylxca is a library I packaged into a "layer" format for reuse.

Both layers have a folder called "hooks", and each has a hook called
"install". The curious result is that after `charm build`, the pylxca's
install hook is the one in dist.

The pylxca layer should not be adding the hook stubs if the hooks/
directory. These are declared in layer:basic, and duplicating them in
the pylxca leads to the problem you describe.


So my question now is, if I want to use layers, and each layer defines its
own hooks so to help its implementation, how does `charm build` handle them?
Are they merged? From this test, only the last one will survive. If so, does
it mean only one layer can define hooks?

Only one layer should define the hook stubs. Layers can do it, as you
have found, and it can be useful in some debugging situations to
override and inject behaviour, but I don't think should ever go as far
as a release.

If multiple layers need hook specific code, they can all declare
handlers with the @hook decorator and they are all run in an arbitrary
order. Its best to avoid @hook completely though and just use normal
reactive states. So instead of using @hook('install'), use
@when_not('mycharm.installed') and have that handler set the
mycharm.installed state at the end.



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


charm layers hooks/install, how are they "merged"?

2017-08-10 Thread fengxia

Hi Juju,

I'm building a charm by including two layers in layer.yaml:

includes:
  - 'layer:basic'
  - 'layer:pylxca'

Pylxca is a library I packaged into a "layer" format for reuse.

Both layers have a folder called "hooks", and each has a hook called 
"install". The curious result is that after `charm build`, the pylxca's 
install hook is the one in dist.


So my question now is, if I want to use layers, and each layer defines 
its own hooks so to help its implementation, how does `charm build` 
handle them? Are they merged? From this test, only the last one will 
survive. If so, does it mean only one layer can define hooks?



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How do you run playbook from charm?

2017-07-11 Thread fengxia

Hi Juju,

I'm curious how you run playbook from charms?

Here are two approaches I have done so far. It gets me going. But I'm
wondering whether there is a better way to do this. Comments?

--

Previously I have been using charms.ansible
. But I always felt
calling CLI isn't as flexible as using a programming API. Inspired by
this blog
, I
created a new layer-ansible that takes advantage of the Ansible Python
API .

I have posted the code here ,
which is forked from original one and two methods are completely
compatible (two code bases don't really overlap). By pointing LAYER_PATH
to this clone, I can use either method to run playbook. I kept both in
one repo for convenience.

To use it in charm is pretty simple (see details
):

1.

   Include layer. In|layer.yaml|:

   includes:
  -'layer:basic'
  -'layer:ansible'

2.

   Create a|playbooks|folder and place /playbooks here:

   |. ├── config.yaml ├── icon.svg ├── layer.yaml ├── metadata.yaml ├──
   playbooks │   └── test.yaml └── reactive └── solution.py |

3.

   Using|config.yaml|to pass in playbook for each action that is
   defined in the charm states. For example, define|test.yaml|for an
   action in|state-0|:

   options:
  state-0-playbook:
type:string
default:"test.yaml"
description:"Playbook for..."

4.

   Define the playbook. For example, a/hello world/that will create a
   file `/tmp/testfile.txt'.

   -name:This is a hello-world example
  hosts:127.0.0.1
  tasks:
  -name:Create a file called '/tmp/testfile.txt' with the content 'hello 
world'.
copy:content="hello world\n" dest=/tmp/testfile.txt
tags:
  -sth

   Note that|tags|value|sth|must match playbook run call (see below).

5.

   In charm|.py|file,|from charms.layer.task import Runner|, then
   in|state-0|to call given playbook:

   playbook=  config['state-0-playbook']
   runner=  Runner(
tags  =  'sth',# <-- must match the tag in the playbook
connection  =  'local',# <-- must be "local"
hostnames  =  '127.0.0.1',# <-- assuming execution in localhost
playbooks  =  [playbook],
private_key_file  =  '',
run_data  =  {},
become_pass  =  '',
verbosity  =  0
   )
   stats=  runner.run()

--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Is a set state called multiple times?

2017-07-27 Thread fengxia
Now thinking of it, I just realized that this concept of True state 
executing repeatedly is actually a good thing.



In many cases, there is a need to query external resource for its 
status. This is often implemented as a polling loop. So in charm, I can 
implement it as



@when("prep")

def prep():

# are we there yet?

is_ready = prep_test()

if is_ready:

remove_state("prep")

set_state("do.sth")

@when("do.sth")

def do_sth():

# do this

pass


# move on

remove_state("do.sth")

set_state("next")


On 07/27/2017 03:56 PM, Cory Johns wrote:

fengxia,

It's probably more enlightening to think of them as "flags" rather 
than states.  (Indeed, the next release of charms.reactive will 
deprecate calling them states and will provide set_flag, remove_flag, 
etc. functions instead.)


On Thu, Jul 27, 2017 at 3:29 PM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Alex,

Thank you for the detailed explanations and examples.

After reading Tilman's and Cory's replies, I think the confusion
is at continuous evaluation (thus execution) of a True state. So a
pair of @when and @when_not will result in one of them being
executed over and over despite adding a remove_state("myself") in
the @when block.

I'm still trying to grasp the idea of this "state" instead of
treating it as an event handler.

So for states, I usually draw a state machine diagram. In this
case, it feels rather unnatural that all True states will
inherently loop to themselves.

But I don't what alternative is in charm's context.


On 07/27/2017 04:13 AM, Alex Kavanagh wrote:

Hi

On Thu, Jul 27, 2017 at 2:37 AM, fengxia <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

Hi Juju,

Once I set a state, set_state("here"), I want to make sure
its @when will only be executed ONCE (when "here" from
False->True).

So my thought is to remove_state("here") in its @when("here")
code block. If I don't, will this @when be called multiple
times if I don't reset this state? What's the good practice here?


You have a couple of options here depending on the nature of the
handler.

 1. If, in the lifetime of the unit's existence, the handler only
has to execute ONCE.  (and I mean EVER), then there is a
@only_once decorator that can be used.  It can be used in
combination with other decorators to set up a condition, but
it guarantees that the handler will only be called once.
However, what you probably want is ...
 2. Use a @when_not('flag') and then set it the 'flag' in the
body of the handler.

The first would look something like:

@when('some-condition-flag')
@only_once
def
do_something_only_once_when_some_condition_flag_is_set_for_the_first_time():
 ... do something once ...

The second treats a flag as a 'have I done this yet' condition,
and allows you to reset the flag at some other point in the
charm's life cycle so that you can do it again.  'installed' is a
good example of this:

@when_not('installed-something')
def do_install_of_something():
... do the installation ...
# when it is fully successful, set the installed-something
flag.  Don't set it early as
# if it errors, a future handler invocation may be able to
continue the installation.
set_state('installed-something')


@when(some other conditions indicating do an upgrade)
def do_upgrade():
 ... set upgrade sources, or other pre upgrade actions
 remove_state('installed-something')

In this situation, hopefully you can see that we can re-use
'do_install_of_something()' when we do upgrades.

I think it's useful to think about states (flags) as being a
'memory' that something has happened, and use them to either gate
on not doing things again, or to trigger the next action is a
graph of actions that need to take place to get the charm's
payload to the desired operational state.  I tend to name them,
and use them, to indicate when something has happened, rather
than when it hasn't, and so tend to use @when_not('some-flag') on
the handler that eventually sets that flag.

Hope that this helps.
Alex.



-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
  

Re: Is a set state called multiple times?

2017-07-27 Thread fengxia

Alex,

Thank you for the detailed explanations and examples.

After reading Tilman's and Cory's replies, I think the confusion is at 
continuous evaluation (thus execution) of a True state. So a pair of 
@when and @when_not will result in one of them being executed over and 
over despite adding a remove_state("myself") in the @when block.


I'm still trying to grasp the idea of this "state" instead of treating 
it as an event handler.


So for states, I usually draw a state machine diagram. In this case, it 
feels rather unnatural that all True states will inherently loop to 
themselves.


But I don't what alternative is in charm's context.


On 07/27/2017 04:13 AM, Alex Kavanagh wrote:

Hi

On Thu, Jul 27, 2017 at 2:37 AM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Juju,

Once I set a state, set_state("here"), I want to make sure its
@when will only be executed ONCE (when "here" from False->True).

So my thought is to remove_state("here") in its @when("here") code
block. If I don't, will this @when be called multiple times if I
don't reset this state? What's the good practice here?


You have a couple of options here depending on the nature of the handler.

 1. If, in the lifetime of the unit's existence, the handler only has
to execute ONCE.  (and I mean EVER), then there is a @only_once
decorator that can be used.  It can be used in combination with
other decorators to set up a condition, but it guarantees that the
handler will only be called once.  However, what you probably want
is ...
 2. Use a @when_not('flag') and then set it the 'flag' in the body of
the handler.

The first would look something like:

@when('some-condition-flag')
@only_once
def 
do_something_only_once_when_some_condition_flag_is_set_for_the_first_time():

 ... do something once ...

The second treats a flag as a 'have I done this yet' condition, and 
allows you to reset the flag at some other point in the charm's life 
cycle so that you can do it again.  'installed' is a good example of this:


@when_not('installed-something')
def do_install_of_something():
... do the installation ...
# when it is fully successful, set the installed-something flag.  
Don't set it early as
# if it errors, a future handler invocation may be able to 
continue the installation.

set_state('installed-something')


@when(some other conditions indicating do an upgrade)
def do_upgrade():
 ... set upgrade sources, or other pre upgrade actions
 remove_state('installed-something')

In this situation, hopefully you can see that we can re-use 
'do_install_of_something()' when we do upgrades.


I think it's useful to think about states (flags) as being a 'memory' 
that something has happened, and use them to either gate on not doing 
things again, or to trigger the next action is a graph of actions that 
need to take place to get the charm's payload to the desired 
operational state.  I tend to name them, and use them, to indicate 
when something has happened, rather than when it hasn't, and so tend 
to use @when_not('some-flag') on the handler that eventually sets that 
flag.


Hope that this helps.
Alex.



-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Alex Kavanagh - Software Engineer
Cloud Dev Ops - Solutions & Product Engineering - Canonical Ltd


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Is a set state called multiple times?

2017-07-27 Thread fengxia

Tilman,

This is quite interesting, and I think that's exactly what confused me 
-- I took @when as event handler, and expected to be executed only on 
False->True transition, but not being continuously executed if I don't 
"remove_state" inside itself.



On 07/27/2017 12:29 PM, Tilman Baumann wrote:

The confusion comes from the expectations at states are somehow events
and @when decorators are event handlers.
@when are predicates on states. When predicates are true the decorated
code is executed at every hook invocation.


If you want to trigger on edges (state changes) you need to build flipflops.


@when("state.wanted")
@when_not("state.reached")

do stuff here when entering state
set_state("state.reached")


@when_not("state.wanted")
@when("state.reached")

do stuff here when leaving state
remove_state("state.reached")


Reactive is still quite nice after you wrapped your head around that.


// Rant follows

Shame though that ALL interfaces are broken and thus unusable.

Interfaces need to be fixed on a fundamental level IMHO.
I have a workaround proposal
https://github.com/tbaumann/charm-interface-peer-discovery/blob/master/peers.py
But in truth, that is not a great solution, it's just a workaround.

I know I'm derailing the conversation here completely, but the
brokenness of interfaces has been a personal annoyance for a while and I
wish I could do something to change that.

One of the issues is that one can not react on "relation.connected"
states because the context they are supposed to have (argument to
decorated function) only works in the right hook context.
I propose a @interface decorator which will create the right context and
instantiate a interface object.
That way I can use interfaces in all sorts of functions and not only in
hook context and the kludges around to avoid being called outside of
hook context.


Problems with interfaces:
- *.connected state gets dropped when one  unit leaves. Not when the
last one leaves.
- self.* only works when code runs in the right hook context
- interface class reference is only passed in decorated functions if the
hook inside the interface code ran
- Only the first occurrence of a unit joining a relation can be caught
with handler
- Interfaces have 90% identical code which is just boilerplate



Just my 0.02€


On 27.07.2017 03:37, fengxia wrote:

Hi Juju,

Once I set a state, set_state("here"), I want to make sure its @when
will only be executed ONCE (when "here" from False->True).

So my thought is to remove_state("here") in its @when("here") code
block. If I don't, will this @when be called multiple times if I don't
reset this state? What's the good practice here?



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Is a set state called multiple times?

2017-07-26 Thread fengxia

Hi Juju,

Once I set a state, set_state("here"), I want to make sure its @when 
will only be executed ONCE (when "here" from False->True).


So my thought is to remove_state("here") in its @when("here") code 
block. If I don't, will this @when be called multiple times if I don't 
reset this state? What's the good practice here?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Is it possible to return management to Juju after manual provision of a machine?

2017-07-05 Thread fengxia

Hi NAZ,

Like Andrew already pointed out, you can issue `juju deploy your-char 
--to 9` to run your charms.


Then on the juju CLI side, use `juju debug-log` to get a running debug 
log. Whatever the charm error is, you should see it flashing across the 
screen. Also, hooks and states will be run in multiple attempts, so you 
should see error repeated, then you can Ctrl-c to stop the log and look 
at the stack trace there.



Since `install` hook is the first to run, it's actually pretty easy to 
debug because of less noise at that point. If possible, debug charm at a 
time instead of using a bundle, which will kick off multiple charms and 
can create a lot of noise in the log.



On 06/29/2017 05:38 PM, N. S. wrote:

Hi,

Excuse me if this seems a strange scenario.

My scenario is as follows:

I have a charm that has lots of problems in its install script, needs 
massive change (NOT SURE how to fix it)


So,

I added an empty machine by
Juju add-machine --series Xenial

And then I logged into it by
Juju SSH 9
And
I provisioned it (installed some software on it).


Now,
Is it possible to get it back to Juju among the units and the 
applications?

How?

Other hooks are probably fine, how to integrate them in the machine?

Thanks,
BR
NAZ




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Is it possible to return management to Juju after manual provision of a machine?

2017-07-05 Thread fengxia

Hi NAZ,

Like Andrew already pointed out, you can issue `juju deploy your-charm 
--to 9` to run your charms.


Then on the juju CLI side, use `juju debug-log` to get a running debug 
log. Whatever the charm error is, you should see it flashing across the 
screen. Also, hooks and states will be run in multiple attempts, so you 
should see error repeated, then you can Ctrl-c to stop the log and look 
at the stack trace there.



Since `install` hook is the first to run, it's actually pretty easy to 
debug because of less noise at that point. If possible, debug charm at a 
time instead of using a bundle, which will kick off multiple charms and 
can create a lot of noise in the log.



On 06/29/2017 05:38 PM, N. S. wrote:

Hi,

Excuse me if this seems a strange scenario.

My scenario is as follows:

I have a charm that has lots of problems in its install script, needs 
massive change (NOT SURE how to fix it)


So,

I added an empty machine by
Juju add-machine --series Xenial

And then I logged into it by
Juju SSH 9
And
I provisioned it (installed some software on it).


Now,
Is it possible to get it back to Juju among the units and the 
applications?

How?

Other hooks are probably fine, how to integrate them in the machine?

Thanks,
BR
NAZ




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Set status message in Juju GUI

2017-04-25 Thread fengxia

Hi Juju,

I have tried status_set(), which will show up in juju debug-log, but how 
to make some message appear on Juju GUI?


I'm building a charm that I want to feedback user of progress. What's 
the right tool for this?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How to read live feed of the output of juju debug-log?

2017-08-04 Thread fengxia

Hi Juju,

Is there a way to read juju debug-log output as a live data stream?

The thought is to take the log as an input to sth like ELK for 
monitoring and analysis.



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: How to quickly re-deploy the same charm

2017-08-18 Thread fengxia
Did `juju upgrade-charm`. Saw "Added charm...". It works, sometimes, not 
consistently.
The new code changes are not reflected on juju machine. Why is that? Any 
way to force a reload?



On 08/18/2017 09:40 AM, Tom Barber wrote:
Yeah you need to do juju resolved charmunit/0 --no-retry to get it out 
of the error state so that the upgrade happens.


On Fri, Aug 18, 2017 at 2:32 PM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Juju,

So here is what I got:

1. juju status shows  `mycharm` is in an error state.

2. Fixed the bug and built a new version of the same application
charm.

3. `juju upgrade-charm --path /path/to/mycharm mycharm

It says `Added charm  local:trusty/mycharm to the model". But
nothing happens from there.

Did I miss a step somewhere?


On 08/18/2017 09:07 AM, Tom Barber wrote:

juju upgrade-charm is I suspect what you're looking for .

Tom


On Fri, Aug 18, 2017 at 1:58 PM, fengxia <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

Hi Juju,

I'm testing a locally built charm using `localhost` (LXD)
setup. Everytime `juju deploy` will take a good 5-10 minutes
just to download and install python packages before the charm
code runs.

I'm wondering what's a good practice to cut down this in dev
iteration? So if I build a version 2 of the same charm, can I
do `juju deploy my-charm` again to cause an update/upgrade,
so to save the initial install time?

Any advice?

-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




-- 
Tom Barber

CTO Spicule LTD
t...@spicule.co.uk <mailto:t...@spicule.co.uk>

http://spicule.co.uk

@spiculeim <http://twitter.com/spiculeim>

Schedule a meeting with me <http://meetme.so/spicule>

GB: +44(0)5603641316 <tel:+44%2056%200364%201316>
US: +18448141689 <tel:%28844%29%20814-1689>

<https://leanpub.com/juju-cookbook>


-- 
Feng xia

Engineer
Lenovo USA

Phone:5088011794 <tel:%28508%29%20801-1794>
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums




--
Tom Barber
CTO Spicule LTD
t...@spicule.co.uk <mailto:t...@spicule.co.uk>

http://spicule.co.uk

@spiculeim <http://twitter.com/spiculeim>

Schedule a meeting with me <http://meetme.so/spicule>

GB: +44(0)5603641316
US: +18448141689

<https://leanpub.com/juju-cookbook>


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: How to quickly re-deploy the same charm

2017-08-18 Thread fengxia

Hi Juju,

So here is what I got:

1. juju status shows  `mycharm` is in an error state.

2. Fixed the bug and built a new version of the same application charm.

3. `juju upgrade-charm --path /path/to/mycharm mycharm

It says `Added charm  local:trusty/mycharm to the model". But nothing 
happens from there.


Did I miss a step somewhere?


On 08/18/2017 09:07 AM, Tom Barber wrote:

juju upgrade-charm is I suspect what you're looking for .

Tom


On Fri, Aug 18, 2017 at 1:58 PM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Juju,

I'm testing a locally built charm using `localhost` (LXD) setup.
Everytime `juju deploy` will take a good 5-10 minutes just to
download and install python packages before the charm code runs.

I'm wondering what's a good practice to cut down this in dev
iteration? So if I build a version 2 of the same charm, can I do
`juju deploy my-charm` again to cause an update/upgrade, so to
save the initial install time?

Any advice?

-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Tom Barber
CTO Spicule LTD
t...@spicule.co.uk <mailto:t...@spicule.co.uk>

http://spicule.co.uk

@spiculeim <http://twitter.com/spiculeim>

Schedule a meeting with me <http://meetme.so/spicule>

GB: +44(0)5603641316
US: +18448141689

<https://leanpub.com/juju-cookbook>


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How to quickly re-deploy the same charm

2017-08-18 Thread fengxia

Hi Juju,

I'm testing a locally built charm using `localhost` (LXD) setup. 
Everytime `juju deploy` will take a good 5-10 minutes just to download 
and install python packages before the charm code runs.


I'm wondering what's a good practice to cut down this in dev iteration? 
So if I build a version 2 of the same charm, can I do `juju deploy 
my-charm` again to cause an update/upgrade, so to save the initial 
install time?


Any advice?

--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: My beginners experience of juju charm development

2017-05-11 Thread fengxia

I'm a researcher at Lenovo US. I myself started researching Juju and
charms about 4 months ago and can relate to many of Erik's comments. To
add to this discussion, here are my experience and thoughts:

1. Design document.

Reading official document and tutorials are good but not satisfying to
engineer's curiosity. Copy and paste someone's "hello world" example
often got me only to the length of that "hello world", because it lacks
in-depth context that will help beginner to understand how these pieces
come together.

Take reactive framework for example, I want to know who kicks off charm
execution? in what type of running environment -- using system's Python
or a virtualenv? which state will be the first in line? states are
queued, are their order sorted by their names? When it says "reactive",
I was expecting to see mechanisms such as signals or some preemptive
methods. I used to do embedded systems and am familiar with such
designs. But there is no doc explaining how it "react". Looking into
charm-helper code the main function has two loops -- one to scan all
hooks exhaustively, and another is a for(1..100) loop(!?), and that's
very puzzling. Is this by design, or am I looking at the wrong place? I
wish there were "official" voice on these topics so users can learn.

2. Juju -> charm.

Juju and charms go hand in hand. But I haven't been able to find much
information on how they work together. Writing charm and looking at
charm codes actually make me realize that hook sequence are hardcoded in
Juju code. If so, how about a state diagram? I made one and attached it
here. To beginners a visual is much easier than line item definitions.
Canonical did a great job defining these, let's take one step further to
make a diagram.

3. Tutorial of common design pattern.

I'm a 15+ year Python developer. I look at a problem naturally in an OOD
lens -- define a class Car, then inherit it to define a class FordFocus.
Learning a new technology like charm isn't only about syntax, but the
way to think and analyze problem at hand. Therefore tutorials on common
patterns will be of great help. How do I do inheritance -- charm layers.
How do I do aggregation? how do I do composition? In my research,
realizing that charm layers can be nested but bundles can not is
significant factor that will impact how I approach a design.

4. Comparison framework.

There are many orchestration projects out there. To many teams who take
interest in this subject, the first step is not to dive into a
particular one, but to read about it horizontally and make a comparison
sense of their strength and weakness -- in technical term, not marketing
term.

I always feel there needs to be a framework, however flawed it might be,
to establish a scope and categories so one can see technically how one
is different from another. To start, agent vs. agent less, pre-built vs.
runtime interpreted, reuse mechanism (layer, include, import), rich
pre-defined syntax (TOSCA) vs. user-defined (charm states). A voice from
domain expert like Canonical, though biased it may be, will help
beginner to grasp the landscape and what consists of this subject. It's
laundry list, like when I look at programming language, a list of "+-*/,
and, or, xor, if, else, while...".. check check, since I know what I
mostly use, exotic topics are interesting but not necessary.

For orchestration I wish there were such a thing put out by one these
teams. Otherwise, they all look powerful and can do the job, and that's
certainly not helping user adoption since we have no starting point to
evaluate.

Last, just want to add to Erik's comment that Juju and charm are good
technologies. Canonical did a good job implementing them and is in lead.
I hear the word "juju" "charm" more and more these days in various
discussions. So the user interest is strong. We want to learn, to
practice, and to share our experience. Help us and the community to make
the technology better understood.

Best,

Feng


On 05/11/2017 02:19 PM, Erik Lönroth wrote:

Hello!

I've been trying to become friends with juju for the last month or so
and was asked in the #juju IRC channel on Freenode to share my
experiences from a "beginner perspective on juju charming".

Generally, I believe JuJu is a great concept. I makes alot of sense
and the architecture and "thought" gone into the tool is impressive.

BUT:

Having some 10+ years in programmer/sysadmin/linux - I think the high
learning curve of developing charms is a problem. Frankly, without the
help from the guys in the IRC-channel - I would have given up a long
time ago. Let me explain my problems and share my experiences.

1. The target developers are sysadmins - not programmers.

Most developers new to JuJu charms are likely sysadmins or devops.
Likely with -limited- amount of programming knowledge or even self
taught scripters. These professionals are not always deep in with
advanced development concepts like "interfaces", "stubs", "layers",
"reactive", "hooks" etc.

Re: How to build juju for centOS

2017-05-11 Thread fengxia

Andrew,

I tried stock Juju on Ubuntu 16.04, but having the same error:

ERROR cannot obtain provisioning script
ERROR getting instance config: finding tools: no matching tools
available (not found)

Here are the steps:

1. juju bootstrap lxd lxd-test

2. juju add-machine ssh:username@ip --series centos7

I have also tried setting default-series when bootstrap, same error.

I checked streams.canonical.com, there is centos agent listed under
/tools. I also manually tried setting version to 2.0.1, for example, and
got the same error.

Best,

Feng

On 05/10/2017 03:44 AM, Andrew Wilkins wrote:

On Wed, May 10, 2017 at 3:08 PM fengxia <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

I have followed dev instruction and can build Juju binaries for
Ubuntu. The dev machine is also Ubuntu.

$go install -v github.com/juju/juju/ <http://github.com/juju/juju/>…

Using the same binaries will not however bootstrap with "--config
default-series=centos", nor "add-machine --series centos". Both
failed at "no tools founds".

How to build an agent for centos?

For a start, you should use "centos7", not "centos". "juju add-machine
--series=centos" *should* give you an immediate error indicating that
that's not a valid series, and ideally inform you of the closest
match(es); I'll file a bug to get that fixed.
Do you need to build from source? If you're using a released version
of Juju, then the agents are available on streams.canonical.com
<http://streams.canonical.com>.

For dev builds, we don't have a nice, supported solution. The
supported solution is to create agent tarballs and generate
simplestreams metadata. I wrote a plugin a while ago that you can use
to build and upload agent tarballs to the controller directly, but you
shouldn't use it in production systems:

$ go get github.com/axw/juju-tools <http://github.com/axw/juju-tools>
$ juju tools build 2.2-beta4.1-centos7-amd64
building: juju-2.2-beta4.1-centos7-amd64.tgz
$ juju tools upload -m controller juju-2.2-beta4.1-centos7-amd64.tgz
uploading "juju-2.2-beta4.1-centos7-amd64.tgz"
$ juju add-machine --series=centos7

Cheers,
Andrew

--
Feng xia
Engineer
Lenovo USA

Phone:5088011794 <tel:%28508%29%20801-1794>
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: How to build juju for centOS

2017-05-10 Thread fengxia

That's good to know. Let me try out Andrew's instructions.


On 05/10/2017 07:59 AM, John Meinel wrote:

Also, while agents can be built for CentOS we don't support
Controllers on CentOS at this point. So bootstrap I believe only
supports Ubuntu.

John
=:->

On May 10, 2017 11:44, "Andrew Wilkins" <andrew.wilk...@canonical.com
<mailto:andrew.wilk...@canonical.com>> wrote:

On Wed, May 10, 2017 at 3:08 PM fengxia <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

I have followed dev instruction and can build Juju binaries
for Ubuntu. The dev machine is also Ubuntu.

$go install -v github.com/juju/juju/
<http://github.com/juju/juju/>…

Using the same binaries will not however bootstrap with
"--config default-series=centos", nor "add-machine --series
centos". Both failed at "no tools founds".

How to build an agent for centos?

For a start, you should use "centos7", not "centos". "juju
add-machine --series=centos" *should* give you an immediate error
indicating that that's not a valid series, and ideally inform you
of the closest match(es); I'll file a bug to get that fixed.
Do you need to build from source? If you're using a released
version of Juju, then the agents are available on
streams.canonical.com <http://streams.canonical.com>.

For dev builds, we don't have a nice, supported solution. The
supported solution is to create agent tarballs and generate
simplestreams metadata. I wrote a plugin a while ago that you can
use to build and upload agent tarballs to the controller directly,
but you shouldn't use it in production systems:

$ go get github.com/axw/juju-tools <http://github.com/axw/juju-tools>
$ juju tools build 2.2-beta4.1-centos7-amd64
building: juju-2.2-beta4.1-centos7-amd64.tgz
$ juju tools upload -m controller juju-2.2-beta4.1-centos7-amd64.tgz
uploading "juju-2.2-beta4.1-centos7-amd64.tgz"
$ juju add-machine --series=centos7

Cheers,
Andrew

--
Feng xia
Engineer
Lenovo USA

Phone:5088011794 <tel:%28508%29%20801-1794>
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>


--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How to build juju for centOS

2017-05-10 Thread fengxia

I have followed dev instruction and can build Juju binaries for Ubuntu.
The dev machine is also Ubuntu.

$go install -v github.com/juju/juju/…

Using the same binaries will not however bootstrap with "--config
default-series=centos", nor "add-machine --series centos". Both failed
at "no tools founds".

How to build an agent for centos?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How to pass a value from @when code to a relation?

2017-06-21 Thread fengxia

Hi Juju,

I'm designing an application, where charm A and B are linked by a A-B 
relation.


In A there are a few states, and I want to parse a file to extract some 
values, then pass these values to charm B to consume. How do I make 
these values available to B then? via relation? or other mean?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


charm build -s centos7 does nothing special?

2017-05-20 Thread fengxia

Hi Juju,

I made a hello world charm based on charm tutorial, which includes 
layer-basic. I noticed that "charm build" can take a switch "-s series". 
I specified "-s centos7", and diff the result from default built which 
is "trusty". There is no material different between two builds.


Is this expected?

--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: charm build -s centos7 does nothing special?

2017-05-23 Thread fengxia
Interesting. So you mean the diff is really depending on what I put in 
scripts. If so, my immediate thought is that charm build does nothing 
special for series then, since I'm coding the "if series=='ubuntu'... 
else:", the build script cannot touch my code, right?



On 05/20/2017 03:17 AM, John Meinel wrote:
I would guess the charm can define series specific build instructions, 
but that layer-basic doesn't, itself, have different instructions for 
centos7.


John
=:->


On Sat, May 20, 2017 at 10:07 AM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Juju,

I made a hello world charm based on charm tutorial, which includes
layer-basic. I noticed that "charm build" can take a switch "-s
series". I specified "-s centos7", and diff the result from
default built which is "trusty". There is no material different
between two builds.

Is this expected?

-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Juju maas node ssh permission denied

2017-05-19 Thread fengxia

Hi Juju,

I ran into an issue which I couldn't figure out. I setup a MAAS 
controller, can manually provision node directly using MAAS and was able 
to ssh to it, so I suppose MAAS is all working well.


Then if I use $ juju deploy to start a node, I could not ssh to this 
node. What is the right way to access this node?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Build charm for Python2 and CentOS

2017-05-27 Thread fengxia

Juju,

I have created a wiki on how to build charm that is Python2 compatible. 
In our case, we want to deploy charms to CentOS7, and default charm 
build has built-in assumption to use Python3 and Ubuntu.


https://github.com/lenovo/workload-solution/wiki/python2-charm

The method requires modifications to layer-basic, charmhelpers, 
charms.reactive and hook.template. If you are working with CentOS and 
want to use juju charms, hopefully this method will get you going.


Juju, will you be interested in adding such Python2 compatibility to 
standard libs and hooks?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How to count relations?

2017-06-07 Thread fengxia

Hi Juju,

I'm building two charms and linking them with one relation, one charm 
("A") will provide and the other ("B") will require.


The deployment will have one "A" and three "B"s. How do I know all three 
Bs have joined? I'm thinking to use a counter in A's relation, then at 
relation-joined hook by B to add this counter. But set_remote() and 
set_local() didn't work. Not sure what's the right way to achieve this?



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums
9


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: How to count relations?

2017-06-07 Thread fengxia

Cory, Alex, good pointers!

I had provider set to GLOBAL and require in UNIT. Maybe that's why. Let 
me take a look your example and follow your instructions here to give it 
another try.


Thank you guys!


On 06/07/2017 11:44 AM, Cory Johns wrote:
Alex beat me to it, but here's a marginally more complete example: 
https://gist.github.com/johnsca/a91cb5897d92dfb6741ee1a09d82b39b


The key points are:

* The interface needs to be UNIT scoped (because you care about 
individual units)

* The joined handler sets a state for each unit that joins
* The @when('rel.connected') predicate in the charm layer matches all 
units that have had that state set, so the set of conversations in the 
interface layer includes those units, and only those units.  This is 
trivially all of the units in my example, but you could also set a 
different state in a -changed handler based on data sent by each 
remote unit, and the conversations would only include the units that 
had that specific state set when you matched that state using @when


Alex: A conversation will always have a scope, so that list 
comprehension isn't necessary.


On Wed, Jun 7, 2017 at 11:38 AM, Alex Kavanagh 
<alex.kavan...@canonical.com <mailto:alex.kavan...@canonical.com>> wrote:


Hi

I'm assuming you are using charms.reactive; if not then look into
relation_ids command.

In your interface, count the number of conversations that have a
scope set to something other than None.  scope shouldn't be None,
but I've had cases where it has been (it may have been a bug):

So in the provider.py RelationBase derived class, something along
the lines of:

num = len([c for c in self.conversations() if c.scope])

in a method would be a relatively simple way of doing it.

(There may be better ways of doing this!)

Cheers
Alex.

On Wed, Jun 7, 2017 at 4:22 PM, fengxia <fx...@lenovo.com
<mailto:fx...@lenovo.com>> wrote:

Hi Juju,

I'm building two charms and linking them with one relation,
one charm ("A") will provide and the other ("B") will require.

The deployment will have one "A" and three "B"s. How do I know
all three Bs have joined? I'm thinking to use a counter in A's
relation, then at relation-joined hook by B to add this
counter. But set_remote() and set_local() didn't work. Not
sure what's the right way to achieve this?


-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums
9


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




-- 
Alex Kavanagh - Software Engineer

Cloud Dev Ops - Solutions & Product Engineering - Canonical Ltd

--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Does relation scopes need to match?

2017-06-07 Thread fengxia

Hi Juju,

I'm learning to write a relation. One thing that's puzzling to me is the 
scope. The question is, must provide and require use the same scope?


For experiment, I have a scope.GLOBAL provide and scope.UNIT require. In 
deployment, there is one provide unit and three require units. In this 
setup, I was able to call set_remote() from provide side to pass a dict 
to require side (get_remote()).


However, if I change provide to be scope.UNIT also, it generated an error:

unit-A-52: 21:15:44 INFO unit.A/52.b-relation-joined ValueError: 
Conversation with scope 'b/120' not found


Could you elaborate what the behavior should be when these scopes 
selected on either side?


| provides | requires |
| GLOBAL   | GLOBAL   |
| UNIT | UNIT |
| GLOBAL   | UNIT |

--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Does relation scopes need to match?

2017-06-07 Thread fengxia
Just to clarify my question. I know the official doc of these scopes, 
that data are broadcasted in GLOBAL and UNIT is maintained as 1-to-1. 
What I'd like to know is when we should use GLOBAL, and when to use 
UNIT? When I deploy multiple units of a charm, does it mean its end of 
relation must use UNIT? if so, what about the provide end, should it be 
UNIT? GLOBAL? SERVICE?



On 06/07/2017 09:22 PM, fengxia wrote:

Hi Juju,

I'm learning to write a relation. One thing that's puzzling to me is 
the scope. The question is, must provide and require use the same scope?


For experiment, I have a scope.GLOBAL provide and scope.UNIT require. 
In deployment, there is one provide unit and three require units. In 
this setup, I was able to call set_remote() from provide side to pass 
a dict to require side (get_remote()).


However, if I change provide to be scope.UNIT also, it generated an 
error:


unit-A-52: 21:15:44 INFO unit.A/52.b-relation-joined ValueError: 
Conversation with scope 'b/120' not found


Could you elaborate what the behavior should be when these scopes 
selected on either side?


| provides | requires |
| GLOBAL   | GLOBAL   |
| UNIT | UNIT |
| GLOBAL   | UNIT |



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: juju deploy with a series

2017-06-15 Thread fengxia

+1


On 06/15/2017 10:47 PM, Andrew Wilkins wrote:
On Fri, Jun 16, 2017 at 1:36 AM John Meinel > wrote:


"juju show-machine 10" is likely to tell you why we are failing to
provision the machine.

My guess is that we acctually need the alias to be
"juju/centos7/amd64" for Juju to recognize that it is the
container image we want to be starting.


Also, the centos7 image from linuxcontainers.org 
 is not suitable for Juju to use. See 
https://bugs.launchpad.net/juju/+bug/1495978/comments/21.


(We really need to publish the image, so people don't have to do this.)

John
=:->


On Thu, Jun 15, 2017 at 8:37 PM, Daniel Bidwell
> wrote:

I am trying to deploy a charm that I am writing for both
ubuntu and
centos.  "lxc image alias list" produces:

lxc image alias list
+---+--+---+
|   ALIAS   | FINGERPRINT  |DESCRIPTION|
+---+--+---+
| centos7   | 41c7bb494bbd | centos7   |
+---+--+---+
| juju/xenial/amd64 | 1e59027d1d58 | juju/xenial/amd64 |
+---+--+---+
| ubuntu-xenial | 1e59027d1d58 | ubuntu-xenial |
+---+--+---+

"juju deploy ~/charms/xenial/aubase1 --series centos7
aubasecentos"
looks like it is starting, but a "juju status" produces:

juju status
ModelController  Cloud/Region Version
default  lxd-testlocalhost/localhost  2.1.2

App   Version  Status   Scale  CharmStore  Rev  OS  
Notes
aubase1active   1  aubase1  local5  ubuntu

aubasecentos   waiting0/1  aubase1  local4  centos


UnitWorkload  Agent   Machine  Public
address  Ports  Message
aubase1/4*  activeidle910.130.54.192
aubasecentos/4  waiting   allocating  10  
waiting
for machine

Machine  StateDNSInst idSeries   AZ
9started  10.130.54.192  juju-a0c4c9-9  xenial
10   downpendingcentos7

What do I need to do to deploy a centos lxd container with my
charm?
--
Daniel Bidwell >


--
Juju mailing list
Juju@lists.ubuntu.com 
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju


--
Juju mailing list
Juju@lists.ubuntu.com 
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju





--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: juju deploy with a series

2017-06-15 Thread fengxia

John,

There are multiple issues with this since we have just gone through a 
similar effort:


1. LXD does not support CentOS image.

2. Default "charm build" will produce a dist that will not run on 
CentOS, even with "--series centos7".



On 06/15/2017 01:34 PM, John Meinel wrote:
"juju show-machine 10" is likely to tell you why we are failing to 
provision the machine.


My guess is that we acctually need the alias to be 
"juju/centos7/amd64" for Juju to recognize that it is the container 
image we want to be starting.


John
=:->


On Thu, Jun 15, 2017 at 8:37 PM, Daniel Bidwell > wrote:


I am trying to deploy a charm that I am writing for both ubuntu and
centos.  "lxc image alias list" produces:

lxc image alias list
+---+--+---+
|   ALIAS   | FINGERPRINT  |DESCRIPTION|
+---+--+---+
| centos7   | 41c7bb494bbd | centos7   |
+---+--+---+
| juju/xenial/amd64 | 1e59027d1d58 | juju/xenial/amd64 |
+---+--+---+
| ubuntu-xenial | 1e59027d1d58 | ubuntu-xenial |
+---+--+---+

"juju deploy ~/charms/xenial/aubase1 --series centos7 aubasecentos"
looks like it is starting, but a "juju status" produces:

juju status
ModelController  Cloud/Region Version
default  lxd-test localhost/localhost  2.1.2

App   Version  Status   Scale  CharmStore  Rev
OS  Notes
aubase1active   1  aubase1  local5 ubuntu
aubasecentos waiting0/1  aubase1 local4  centos

UnitWorkload Agent   Machine  Public
address  Ports  Message
aubase1/4*  active idle910.130.54.192
aubasecentos/4  waiting allocating  10   waiting for
machine

Machine  StateDNSInst idSeries   AZ
9started  10.130.54.192  juju-a0c4c9-9  xenial
10   downpendingcentos7

What do I need to do to deploy a centos lxd container with my charm?
--
Daniel Bidwell >


--
Juju mailing list
Juju@lists.ubuntu.com 
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju







--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: juju deploy with a series

2017-06-15 Thread fengxia

There was a bug filed back in 2015:

https://bugs.launchpad.net/juju/+bug/1495978

It has information on how to make a work around to run CentOS in LXD.


On 06/15/2017 12:37 PM, Daniel Bidwell wrote:

I am trying to deploy a charm that I am writing for both ubuntu and
centos.  "lxc image alias list" produces:

lxc image alias list
+---+--+---+
|   ALIAS   | FINGERPRINT  |DESCRIPTION|
+---+--+---+
| centos7   | 41c7bb494bbd | centos7   |
+---+--+---+
| juju/xenial/amd64 | 1e59027d1d58 | juju/xenial/amd64 |
+---+--+---+
| ubuntu-xenial | 1e59027d1d58 | ubuntu-xenial |
+---+--+---+

"juju deploy ~/charms/xenial/aubase1 --series centos7 aubasecentos"
looks like it is starting, but a "juju status" produces:

juju status
ModelController  Cloud/Region Version
default  lxd-testlocalhost/localhost  2.1.2

App   Version  Status   Scale  CharmStore  Rev  OS  Notes
aubase1active   1  aubase1  local5  ubuntu
aubasecentos   waiting0/1  aubase1  local4  centos

UnitWorkload  Agent   Machine  Public address  Ports  Message
aubase1/4*  activeidle910.130.54.192
aubasecentos/4  waiting   allocating  10  waiting 
for machine

Machine  StateDNSInst idSeries   AZ
9started  10.130.54.192  juju-a0c4c9-9  xenial
10   downpendingcentos7

What do I need to do to deploy a centos lxd container with my charm?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: juju deploy with a series

2017-06-15 Thread fengxia

The patch and instructions are listed here:

https://github.com/juju/juju/pull/6954

We didn't go this route. In our project, we ended up using MAAS to 
provision CentOS node to test charms.



On 06/15/2017 10:51 PM, fengxia wrote:


+1


On 06/15/2017 10:47 PM, Andrew Wilkins wrote:
On Fri, Jun 16, 2017 at 1:36 AM John Meinel <j...@arbash-meinel.com 
<mailto:j...@arbash-meinel.com>> wrote:


"juju show-machine 10" is likely to tell you why we are failing
to provision the machine.

My guess is that we acctually need the alias to be
"juju/centos7/amd64" for Juju to recognize that it is the
container image we want to be starting.


Also, the centos7 image from linuxcontainers.org 
<http://linuxcontainers.org> is not suitable for Juju to use. See 
https://bugs.launchpad.net/juju/+bug/1495978/comments/21.


(We really need to publish the image, so people don't have to do this.)

John
=:->


On Thu, Jun 15, 2017 at 8:37 PM, Daniel Bidwell
<drbidw...@gmail.com <mailto:drbidw...@gmail.com>> wrote:

I am trying to deploy a charm that I am writing for both
ubuntu and
centos.  "lxc image alias list" produces:

lxc image alias list
+---+--+---+
|   ALIAS   | FINGERPRINT  |DESCRIPTION|
+---+--+---+
| centos7   | 41c7bb494bbd | centos7   |
+---+--+---+
| juju/xenial/amd64 | 1e59027d1d58 | juju/xenial/amd64 |
+---+--+---+
| ubuntu-xenial | 1e59027d1d58 | ubuntu-xenial |
+---+--+---+

"juju deploy ~/charms/xenial/aubase1 --series centos7
aubasecentos"
looks like it is starting, but a "juju status" produces:

juju status
ModelController  Cloud/Region Version
default  lxd-testlocalhost/localhost  2.1.2

App   Version  Status   Scale  CharmStore  Rev  OS  
Notes
aubase1active   1  aubase1  local5  ubuntu

aubasecentos   waiting0/1  aubase1  local4  centos


UnitWorkload  Agent   Machine  Public
address  Ports  Message
aubase1/4*  activeidle910.130.54.192
aubasecentos/4  waiting   allocating  10  
waiting
for machine

Machine  StateDNSInst idSeries   AZ
9started  10.130.54.192  juju-a0c4c9-9  xenial
10   downpendingcentos7

What do I need to do to deploy a centos lxd container with my
charm?
--
Daniel Bidwell <drbidw...@gmail.com <mailto:drbidw...@gmail.com>>


--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju


--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju





--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Juju maas node ssh permission denied

2017-05-19 Thread fengxia

Thank you Rick. You pointed me to the right direction.

Whichever node that was created via Juju will have the SSH credential 
from Juju's machine, not Maas'. One can use the plain $ ssh 
ubuntu@node-ip to access.


Btw, there is no need to remove the SSH key in MAAS, which is still 
useful when you provision node directly from MAAS alone (without juju's 
knowledge).



On 05/19/2017 08:46 AM, Rick Harding wrote:

Hi Feng, what method were you using to ssh to the Juju node?

When you bootstrap with juju it will grab local ssh keys to setup for 
the ubuntu user on the juju managed nodes. For example, I temporarily 
removed my ssh key from my MAAS user profile and bootstrapped from my 
laptop a new controller and I was able to ssh to the controller with 
'juju switch controller && juju ssh 0'. This uses the local keys I 
have on my laptop system.


If you want to not use juju ssh then you need to specify the ubuntu 
user name on the images. On my MAAS the address of machine 0 is 10.0.0.8


ssh ubuntu@10.0.0.8 <mailto:ubuntu@10.0.0.8>

Does that not work for you?

On Fri, May 19, 2017 at 8:12 AM fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Juju,

I ran into an issue which I couldn't figure out. I setup a MAAS
controller, can manually provision node directly using MAAS and
was able
to ssh to it, so I suppose MAAS is all working well.

Then if I use $ juju deploy to start a node, I could not ssh to this
node. What is the right way to access this node?

--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794 <tel:%28508%29%20801-1794>
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: charm build -s centos7 does nothing special?

2017-05-21 Thread fengxia
Anyone can shed some lights on this? I think charm build -s centos7 does 
nothing special to the build.


Btw, /usr/bin/charm is a binary. Where can I find the source?

On 05/20/2017 02:07 AM, fengxia wrote:

Hi Juju,

I made a hello world charm based on charm tutorial, which includes 
layer-basic. I noticed that "charm build" can take a switch "-s 
series". I specified "-s centos7", and diff the result from default 
built which is "trusty". There is no material different between two 
builds.


Is this expected?



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Here is how to make Juju charm working on CentOS7

2017-05-21 Thread fengxia

Juju,

As part of my research of juju charms, we have a requirement to make 
charm compatible with Centos7 and RHEL. However, charm is now using 
Python3 (in some places) and it will fail at "import yum" on CentOS7. I 
have googled it for a few days now and there is limited information on 
how to resolve. this.


So to make things simpler (or more complicated down the road?), I have 
decided to make a Python2-compatible charm. Be warned this is currently 
as a quick hack that I just put together yesterday and proved working. I 
will produce a better documentation later. But for ppl who are in this 
same boat, this may save your headaches or ease your concerns knowing 
that there is a way to "work around".


Objective: Build a Python2 compatible charm that includes layer-basic to 
run on centos7


Two dists: test1 is from default "charm build -s centos7", test25 is 
modified build.


What to modify:

1. Anywhere you see /usr/bin/python3, change to /usr/bin/python. Most of 
these are in /hooks.


2. Add a blank "__init__.py" in /lib/charms. Python2 module search path 
differently from python3.


3. charmhelpers: yes you have to make a modification in charmhelpers: 
/usr/lib/python2.7/site-packages/charmhelpers/fetch/__init__.py.


*if __platform__ == "ubuntu":
apt_cache = fetch.apt_cache
apt_install = fetch.install
apt_update = fetch.update
apt_upgrade = fetch.upgrade
apt_purge = fetch.purge
apt_mark = fetch.apt_mark
apt_hold = fetch.apt_hold
apt_unhold = fetch.apt_unhold
get_upstream_version = fetch.get_upstream_version
elif __platform__ == "centos":
yum_search = fetch.yum_search

# FENG: centos mapping
apt_install = fetch.install
apt_upgrade = fetch.upgrade
apt_update = fetch.update
apt_purge = fetch.purge
apt_cache = fetch.yum_search
*

4. charms.reactive: yes you need to modify this too. Only one place, 
charms.reactive-0.4.7/charms/reactive/relations.py:


class RelationBase(object):
__metaclass__=AutoAccessors

Now for details of diff of files changed and contents I modified to make 
this work:


1. Files to modify:

Files test1/bin/layer_option and test25/bin/layer_option differ
Files test1/.build.manifest and test25/.build.manifest differ
Files test1/hooks/config-changed and test25/hooks/config-changed differ
Files test1/hooks/hook.template and test25/hooks/hook.template differ
Files test1/hooks/install and test25/hooks/install differ
Files test1/hooks/leader-elected and test25/hooks/leader-elected differ
Files test1/hooks/leader-settings-changed and 
test25/hooks/leader-settings-changed differ

Files test1/hooks/start and test25/hooks/start differ
Files test1/hooks/stop and test25/hooks/stop differ
Files test1/hooks/update-status and test25/hooks/update-status differ
Files test1/hooks/upgrade-charm and test25/hooks/upgrade-charm differ
Files test1/layer.yaml and test25/layer.yaml differ
Only in test25/lib/charms: __init__.py
Files test1/lib/charms/layer/basic.py and 
test25/lib/charms/layer/basic.py differ

Only in test25/lib/charms/layer: basic.py.old
Files test1/lib/charms/layer/execd.py and 
test25/lib/charms/layer/execd.py differ

Files test1/metadata.yaml and test25/metadata.yaml differ
Files test1/wheelhouse/charmhelpers-0.15.0.tar.gz and 
test25/wheelhouse/charmhelpers-0.15.0.tar.gz differ
Files test1/wheelhouse/charms.reactive-0.4.7.tar.gz and 
test25/wheelhouse/charms.reactive-0.4.7.tar.gz differ


2. File contents diff:

diff -r test1/bin/layer_option test25/bin/layer_option
1c1
< #!/usr/bin/env python3
---
> #!/usr/bin/env python
4c4,5
< sys.path.append('lib')
---
> import os
> sys.path.append(os.path.join(os.getcwd(),'lib'))
diff -r test1/.build.manifest test25/.build.manifest
4c4
< "test1",
---
> "test25",
31c31
< "621b556cd208005e131e9f648859294347da9376609745a73ca2e808dd2032f9"
---
> "cf7f9c2bec7447406495c1bec5a549276ff26d9220b5bee3c3994253cad86b3d"
34c34
<   "test1",
---
>   "test25",
89c89
<   "test1",
---
>   "test25",
91c91,96
< "f2986d765f3980311b0064cccebdd9080e218a7c25100ae66d52b78f8fb2243c"
---
> "3d93ebb41e22cd44db352b5d87296a3fd67f5deb87729ee17f8b24b5fcd48955"
> ],
> "lib/charms/__init__.py": [
>   "layer:basic",
>   "static",
> "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
101c106,111
< "d09706ef3a224eb60d34366a2867c382791aa30157ab5b77eda37f29731df2e2"
---
> "80389fe735b9d9766515ed36d9134321838fc5bb88c225cdace57a50bbf739e1"
> ],
> "lib/charms/layer/basic.py.old": [
>   "layer:basic",
>   "static",
> "0f353699ba6b5213596354add24a7283273a4cee665a1a038556128f3fdd28db"
106c116
< "af1f2409869f990cdb33cffc4120fb6713876e8e680ac5f064ea510bbdca1073"
---
> "b7a88558cfd3511ea1eff0564524d0caef6e16daa5bf12b80f01183a1e73e4ff"
109c119
<   "test1",
---
>   "test25",
111c121
< "a3ff3ba5321d2b502dd1b9454976e62cc4dfc146d36c18626066c1dfc19787eb"
---
> "2949e0b71e303ac97855af82a938207fd3a1d52aee3f87780b5c48910ce1dad8"
119c129
<   "test1",

Where is the source for "charm build" binary?

2017-05-21 Thread fengxia

Hi Juju,

I have used "charm build" to build my own charms. I noticed 
/usr/bin/charm is a binary file. Where is the source?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: charms.reactive 0.5.0

2017-10-06 Thread fengxia

Like the move from "state" to "flag" terminology ~~


On 10/05/2017 10:38 AM, Cory Johns wrote:

Greetings,

Today we released version 0.5.0 of charms.reactive.  The full 
changelog can be found at 
https://charmsreactive.readthedocs.io/en/latest/changelog.html with 
the changes from this release being:


  * Add flag triggers (#121)
  * Add integration test to Travis to build and deploy a reactive 
charm (#120)

  * Only execute matching hooks in restricted context. (#119)
  * Rename "state" to "flag" and deprecate "state" name (#112)
  * Allow pluggable alternatives to RelationBase (#111)

We will be exclusively using the "flags" terminology going forward in 
place of "states" as the former is more accurate to what they 
represent and how they behave and is less confusing.  For the time 
being, all of the existing "state" functions are still available, but 
they are deprecated.  See 
https://charmsreactive.readthedocs.io/en/latest/charms.reactive.flags.html 
for more info.


The "pluggable alternatives to RelationBase" is groundwork for the 
upcoming Endpoints replacement, which should make writing interface 
layers significantly less confusing. Feedback welcome on 
https://github.com/juju-solutions/charms.reactive/pull/123 and 
https://github.com/juju/docs/pull/2207





--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


"Attempting to connect to" takes a long time

2017-10-05 Thread fengxia

Hi Juju,

Boostrapping a local LXD controller, it sits at "Attempting to connect 
to..." for a good 5-10 minutes. Any idea what it is doing, and how to 
speed it up?


_

Host: Ubuntu 16.04

Juju: 2.2.4-xenial-amd64

CLI: juju bootstrap localhost devlocal

Output:

Please either create a new controller using "juju bootstrap" or connect to
another controller that you have been given access to using "juju register".

Creating Juju controller "c6k37aysz8" on localhost/localhost
Looking for packaged Juju agent version 2.2.4 for amd64
To configure your system to better support LXD containers, please see: 
https://github.com/lxc/lxd/blob/master/doc/production-setup.md

Launching controller instance(s) on localhost/localhost...
 - juju-4a20f8-0 (arch=amd64)
Fetching Juju GUI 2.9.2
Waiting for address
Attempting to connect to 10.175.135.202:22


--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: set_state not setting the state immediately

2017-10-05 Thread fengxia

" An assumption is being made that the state changes get committed
immediately, but these changes are actually transactional and
following the same transactional behaviour as the Juju hook
environment [1]."

To chip in my experience as 6-month into learning charms and writing a 
few simple charms.


1. The "transactional" nature of Juju hook needs better explained. To be 
honest I have no idea what this means, and what implication it has to a 
charm writer. Any reference would be helpful.


2. I like Mike Wilson's approach to provide a list of "set_state_xxx" 
functions so new writer can better guess what this function will do. 
Further, a different name calls for further study why they are 
different, thus learning important concept of whatever Juju thinks charm 
writer needs to understand.


Otherwise, I will expect "set_state" will set that state/flag asap. If 
there is a scanning cycle (which I heard there is some kind of 5-min 
cycle, which document has not sufficiently made it clear to a writer 
either), charm writer needs to have better doc to learn what it means 
for design. I came from embedded system world in which a timer loop is 
common. It calls for a different thinking than user space script user. I 
think such implication should be emphasized more.


3. idempotent

Again, this is a concept me (or many new writer) will fail to grasp. 
Looking at "apt install" as example, my reaction was that the package 
manager is taking care of "doing nothing" if called multiple times. But 
how this translate to my system in which charm is expected to "do 
something"? Does it mean I need a gatekeeper like the package manager so 
to guard these "multiple calls"?


Again, this feels like a work around because "set_state" will call the 
same function block multiple times, which is unintuitive to writer -- 
when I set a state, the action for that state is executed once, not over 
and over again until I turn it off. Further, even "remove_state" doesn't 
take effect immediately, so it feels arbitrary how many cycles a block 
of code is executed. This is a design pattern I'm afraid many are not 
familiar with, so some tutorial examples will be much appreciated.


Best,

Feng




On 10/04/2017 08:59 AM, Marco Ceppi wrote:
So, I've not actually checked the logs in a while, but if visibility 
is an issue, it seems reasonable that the reactive framework should 
print in the log that X flags are being reset due to hook failure. 
Things like set_flag_immediate has farther reaching consequences than 
simply stating that flags only get set on success of a hook run.


I know there are further reaching initiatives to alleviate this by 
decoupling the reactive state engine from the juju hooks system. In 
this case each successive loop of the reactive runtime could better 
snapshot state and make failures more granular.


* state is being renamed to flag in the next major version of reactive.

On Wed, Oct 4, 2017 at 8:52 AM Mike Wilson > wrote:


So as a new charm writer coming to Juju I would first do this:

def get_ready():
    func0()
    func1_fails()

Then I would, hopefully, test and notice issues. I would
investigate and see that I needed to be idempotent. My next
attempt would be to wrap those functions inside state checks with
sets after they complete. This would also fail and now the charm
creator is left with nothing in the api that can help. They are
now off to their own devices to start doing random things to
attempt to make this work the way they want it to work. Hopefully,
the solution is as straight-forward as touching random files, but
we just never know.

I would expect the name of set_state to be something like
set_state_on_success and I would further expect some sort of
immediate state thing like set_state or set_state_immediate. This
would give the user the tools we know that they need in order to
create bug-free charms.

Now to compound that confusion, we have the issue of a hook can
call multiple functions inside the charm code and if any of those
functions have something that fails the whole thing is unwrapped.
I understand from a Juju perspective why this is the case, but as
a user, I would be completely taken by surprise here. The only
real fix here is documentation so that we can set expectations,
but people will most likely look at examples instead of
documentation. This means that we need to make sure to call out
any potential issues like this in the example charms we release.


On Wed, Oct 4, 2017 at 6:34 AM Stuart Bishop
>
wrote:

On 4 October 2017 at 00:51, Mike Wilson
>
wrote:
> So the best practice here is to touch a file and test for
the existence 

Re: How to use LXC local image for new machine

2017-09-06 Thread fengxia

To give an update on this, and it can be helpful to someone interested in:

Verified.

1. create a vanilla `trusty` LXD container named `gold`
2. ssh into `gold` container, `apt install python python-dev...`
3. in terminal, `$ lxc snapshot gold`, this created a snapshot, can be 
viewed from `$ lxc info gold`.

4. in terminal, `$ lxc publish gold/snap0 --alias juju/trusty/amd64`
5. `$ lxc image delete ubuntu-trusty`. This is to delete the default 
ubuntu-trusty image downloaded by LXD.


6. Update juju to 2.2.2 (https://jujucharms.com/docs/2.2/reference-install)
7. re-bootstrap a controller (juju bootstrap localhost [pick a name])

It is now using a local image w/ alias `juju/trusty/amd64`.

Thank you Juju.


On 09/01/2017 06:47 AM, Stuart Bishop wrote:

On 1 September 2017 at 02:37, fengxia <fx...@lenovo.com> wrote:

According to https://bugs.launchpad.net/juju/+bug/1650651, juju 2.1 supports
using local image if its alias is `juju/series/arch` format.

So following this, I created a local image and gave it an alias of this
format, but juju deploy will still download ubuntu-trusty before creating
the container.

I'm attaching the script I'm using, which is slightly modified from
the original version passed around and posted here. It might point you
to where your process is failing. I haven't done it manually myself.



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How to deploy the same charm with different name?

2017-09-04 Thread fengxia

Hi Juju,

Previously, I was able to define two charms in bundle, both have `charm` 
(the path to charm files) set to the same location, but with different 
names, and `juju deploy this-bundle` will create two applications.


For example (bundle):

Sevices:

   A:

 charm: ./trusty/mycharm

.

   B:

  charm: ./trusty/mycharm

Deploying this will create two applications, named "A" and "B".

How to achieve this using two-step $ juju deploy [charm] commandline 
instead? On the second time Juju complained that application "mycharm" 
already exist.



--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Juju-gui only show localhost as the deployment option

2017-08-30 Thread fengxia

Akshat,

Just to chip in some of my thoughts on this since we (disclosure, I'm a 
researcher at Lenovo) have had extensive discussions on a similar use 
case and consequently come down to the same challenge as you are 
currently looking at.


1. Juju CLI allows user to select controller, which essentially leads to 
a particular cloud/provider (these two are 1-1 mapping). Therefore, in 
practice it already supports multi-cloud scenario (last time I counted 
12 clouds out of box including local LXD and manual). The catch is, of 
course, the manual step of selecting the proper controller.


2. There are two schools of thought -- whether to have Juju being more 
intelligent so to handle multiple clouds `automatically` (for example, 
in bundle YAML specify which cloud a charm should be deployed to, which 
is one step further than OS series), or using Juju as-is and utilize 
something else as a wrapper to facilitate such mixed-cloud automation. 
The former option minimize tech stack so there is one set of technology 
to learn and manage; the latter gives flexibility, mitigate vendor lock 
in... I think the theme is not new, so it's really a matter of design 
preference


Juju team has done 90% of the heavy liftings. The former will require 
more in-depth of Juju knowledge, the latter requires less. I think the 
requirements, however, is clear, that there is a higher level of 
abstraction required above the current Juju existence so to drive this.




On 08/30/2017 04:27 AM, Akshat Jiwan Sharma wrote:

Thank you Feng,

As I understand for now there is no way to use multiple providers with 
juju either with a GUI or command line.


My goal is to be able to allow users to deploy charms (mostly 
wordpress/drupal/ghost) on a cloud of their choice. Anything that 
allows me to do this is acceptable. The only requirement is maximum 
cloud coverage. So for a multi cloud setup what options do I have?


- Should I go for one controller per cloud setup?
- Can juju api <https://godoc.org/github.com/juju/juju/api> help me 
write some custom code that'll allow me to do what I want? If so what 
should I be looking for in the documentation?
- Since juju runs in an lxc  would it be a good idea to create clone 
containers that can switch the cloud environment on demand? Or would 
this cause more problems that it'll solve?


Thank you once more for being patient with the questions and for all 
the answers! Much appreciated


Best,
Akshat

On Wed, Aug 30, 2017 at 7:56 AM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Akshat,

Juju controller does not support multiple cloud/provider. It's
like a switch board, juju can only talk to one controller at a time.

However, I do think there are use case of supporting multiple
clouds with one orchestrator. I'm not sure whether juju team has
sth like that on its roadmap, or maybe using some other tools for
the purpose?
On 08/29/2017 09:59 AM, Akshat Jiwan Sharma wrote:

Is there a way I can configure multiple providers using the
Juju-GUI? Also is there a way I can configure cloud providers
based on user access roles? For example a user with access to a
particular model can deploy only to a specific cloud provider.

If one controller can manage multiple clouds and one controller
can have many users then what is the mapping of the relationship
between the users and the clouds?

Thanks,
Akshat




-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Juju-gui only show localhost as the deployment option

2017-08-30 Thread fengxia

Akshat,

Just to chip in some of my thoughts on this since we (disclosure, I'm a 
researcher at Lenovo) have had extensive discussions on a similar use 
case and consequently come down to the same challenge as you are 
currently looking at.


1. Juju CLI allows user to select controller, which essentially leads to 
a particular cloud/provider (these two are 1-1 mapping). Therefore, in 
practice it already supports multi-cloud scenario (last time I counted 
12 clouds out of box including local LXD and manual). The catch is, of 
course, the manual step of selecting the proper controller.


2. There are two schools of thought -- whether to have Juju being more 
intelligent so to handle multiple clouds `automatically` (for example, 
in bundle YAML specify which cloud a charm should be deployed to, which 
is one step further than OS series), or using Juju as-is and utilize 
something else as a wrapper to facilitate such mixed-cloud automation. 
The former option minimize tech stack so there is one set of technology 
to learn and manage; the latter gives flexibility, mitigate vendor lock 
in... I think the theme is not new, so it's really a matter of design 
preference


Juju team has done 90% of the heavy liftings. The former will require 
more in-depth of Juju knowledge, the latter requires less. I think the 
requirements, however, is clear, that there is a higher level of 
abstraction required above the current Juju existence so to drive this.




On 08/30/2017 04:27 AM, Akshat Jiwan Sharma wrote:

Thank you Feng,

As I understand for now there is no way to use multiple providers with 
juju either with a GUI or command line.


My goal is to be able to allow users to deploy charms (mostly 
wordpress/drupal/ghost) on a cloud of their choice. Anything that 
allows me to do this is acceptable. The only requirement is maximum 
cloud coverage. So for a multi cloud setup what options do I have?


- Should I go for one controller per cloud setup?
- Can juju api <https://godoc.org/github.com/juju/juju/api> help me 
write some custom code that'll allow me to do what I want? If so what 
should I be looking for in the documentation?
- Since juju runs in an lxc  would it be a good idea to create clone 
containers that can switch the cloud environment on demand? Or would 
this cause more problems that it'll solve?


Thank you once more for being patient with the questions and for all 
the answers! Much appreciated


Best,
Akshat

On Wed, Aug 30, 2017 at 7:56 AM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Akshat,

Juju controller does not support multiple cloud/provider. It's
like a switch board, juju can only talk to one controller at a time.

However, I do think there are use case of supporting multiple
clouds with one orchestrator. I'm not sure whether juju team has
sth like that on its roadmap, or maybe using some other tools for
the purpose?
On 08/29/2017 09:59 AM, Akshat Jiwan Sharma wrote:

Is there a way I can configure multiple providers using the
Juju-GUI? Also is there a way I can configure cloud providers
based on user access roles? For example a user with access to a
particular model can deploy only to a specific cloud provider.

If one controller can manage multiple clouds and one controller
can have many users then what is the mapping of the relationship
between the users and the clouds?

Thanks,
Akshat




-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


How to use LXC local image for new machine

2017-08-31 Thread fengxia

Hi Juju,

I'm using `localhost` provider for dev test. I have create a LXD 
controller, and each time `juju deploy` will create a new container 
(series/trusty).


I'm experimenting to use a local image so `juju deploy` can use. So far:

1. Created an image, "gold-copy"

2. `lxc image alias create trusty [hash]`, also created alias 
`ubuntu-trusty`


But no avail. Juju will continue to download a `ubuntu-trusty` image to 
use.


Any advice here?

btw, the ultimate goal is to shorten the cycle of getting a new machine. 
The thought is to provide a customized image that has packages 
pre-loaded, eg python, python-dev, and a few charm libs.


I also read somewhere about juju using `clone-image`? Any detail on this 
function?


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: How to use LXC local image for new machine

2017-08-31 Thread fengxia
According to https://bugs.launchpad.net/juju/+bug/1650651, juju 2.1 
supports using local image if its alias is `juju/series/arch` format.


So following this, I created a local image and gave it an alias of this 
format, but juju deploy will still download ubuntu-trusty before 
creating the container.


Below is dump from `lxc image [image-name] info`:

fengxia@local-charmdev:~/workspace/wss$ lxc image info trusty
Fingerprint: 
203a6ae7d45cbe5c1411ad3f17b9b2429cb5ddfec69019fa96ce5710c4871504

Size: 365.92MB
Architecture: x86_64
Public: no
Timestamps:
Uploaded: 2017/08/31 14:32 UTC
Expires: never
Last used: never
Properties:
label: release
os: ubuntu
release: trusty
serial: 20170811
version: 14.04
architecture: amd64
description: ubuntu 14.04 LTS amd64 (release) (20170811)
Aliases:
- gold-image (gold-image)
- trusty (trusty)
- juju/trusty/amd64 (juju/trusty/amd64)
Auto update: disabled



On 08/31/2017 02:20 PM, fengxia wrote:

Hi Juju,

I'm using `localhost` provider for dev test. I have create a LXD 
controller, and each time `juju deploy` will create a new container 
(series/trusty).


I'm experimenting to use a local image so `juju deploy` can use. So far:

1. Created an image, "gold-copy"

2. `lxc image alias create trusty [hash]`, also created alias 
`ubuntu-trusty`


But no avail. Juju will continue to download a `ubuntu-trusty` image 
to use.


Any advice here?

btw, the ultimate goal is to shorten the cycle of getting a new 
machine. The thought is to provide a customized image that has 
packages pre-loaded, eg python, python-dev, and a few charm libs.


I also read somewhere about juju using `clone-image`? Any detail on 
this function?




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: How to deploy the same charm with different name?

2017-09-05 Thread fengxia

Ah, how wonderful!

On 09/04/2017 03:56 PM, Tom Barber wrote:

simply:

juju deploy [charm] newcharmname

is what you're after.

Tom

On Mon, Sep 4, 2017 at 8:49 PM, fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>> wrote:


Hi Juju,

Previously, I was able to define two charms in bundle, both have
`charm` (the path to charm files) set to the same location, but
with different names, and `juju deploy this-bundle` will create
two applications.

For example (bundle):

Sevices:

   A:

 charm: ./trusty/mycharm

.

   B:

  charm: ./trusty/mycharm

Deploying this will create two applications, named "A" and "B".

How to achieve this using two-step $ juju deploy [charm]
commandline instead? On the second time Juju complained that
application "mycharm" already exist.


-- 
Feng xia

Engineer
Lenovo USA

Phone: 5088011794 
fx...@lenovo.com <mailto:fx...@lenovo.com>

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums


-- 
Juju mailing list

Juju@lists.ubuntu.com <mailto:Juju@lists.ubuntu.com>
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/juju
<https://lists.ubuntu.com/mailman/listinfo/juju>




--
Tom Barber
CTO Spicule LTD
t...@spicule.co.uk <mailto:t...@spicule.co.uk>

http://spicule.co.uk

@spiculeim <http://twitter.com/spiculeim>

Schedule a meeting with me <http://meetme.so/spicule>

GB: +44(0)5603641316 <tel:+44%2056%200364%201316>
US: +18448141689 <tel:%28844%29%20814-1689>

<https://leanpub.com/juju-cookbook>


--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Juju-gui only show localhost as the deployment option

2017-08-29 Thread fengxia

Hi Akshat,

Juju controller does not support multiple cloud/provider. It's like a 
switch board, juju can only talk to one controller at a time.


However, I do think there are use case of supporting multiple clouds 
with one orchestrator. I'm not sure whether juju team has sth like that 
on its roadmap, or maybe using some other tools for the purpose?

On 08/29/2017 09:59 AM, Akshat Jiwan Sharma wrote:
Is there a way I can configure multiple providers using the Juju-GUI? 
Also is there a way I can configure cloud providers based on user 
access roles? For example a user with access to a particular model can 
deploy only to a specific cloud provider.


If one controller can manage multiple clouds and one controller can 
have many users then what is the mapping of the relationship between 
the users and the clouds?


Thanks,
Akshat




--
Feng xia
Engineer
Lenovo USA

Phone: 5088011794
fx...@lenovo.com

Lenovo.com
Twitter | Facebook | Instagram | Blogs | Forums

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: Juju patents

2017-11-14 Thread fengxia

I'm having difficulty understanding these patents.

Descriptions and diagrams are generic, with many "..." etc type of 
notions, "chef, puppet, juju, ...". Doesn't it make this open-ended, 
thus can include just about anything it wants?


Also, modeling a component then using them to form a service is a broad 
,general description. When it says topology, does it confine itself to 
**network topology**? cause the word "topology" can also be extended to 
anything that has a link/connection/relation. As long as the thing 
doesn't stand alone and work only by itself, it's part of some sort of 
topology, isn't it?


Anyone could chip in how to read and interpret these patents here? what 
could be the hypothetical impact on Juju and charms?



On 11/13/2017 04:34 AM, Merlijn Sebrechts wrote:

Hi all


Just got a scholar alert for three patents that seem to be describing 
Juju/TOSCA.


- "TOPOLOGY BASED MANAGEMENT WITH STAGE AND VERSION POLICIES": 
http://www.freepatentsonline.com/y2017/0302532.html
- "TOPOLOGY BASED MANAGEMENT WITH COMPLIANCE POLICIES": 
http://www.freepatentsonline.com/y2017/0302531.html
- TOPOLOGY BASED MANAGEMENT OF SECOND DAY OPERATIONS": 
http://www.freepatentsonline.com/y2017/0302537.html


These were filed in 2014 by HPE. Even with a grace period of one year, 
it's still more than a year after the first release of Juju and TOSCA. 
Is Canonical interested in fighting this?




Kind regards
Merlijn





--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


juju status ERROR current model controller devlocal not found

2017-12-04 Thread fengxia

Hi Juju,

I had a localhost controller bootstrapped and deployed 8 machines (LXDs) 
to it. Host is a KVM vm of Ubuntu 16.04 amd64.


Now for some strange reason, `juju status` reports error as if it lost 
its model? `list-controllers` showed the controller looks fine. `lxc 
list` shows all the machines are up and running.


Any idea of what this error is about, and how to debug it?



(dev) fengxia@ubuntu:~$ juju status
ERROR current model for controller devlocal not found
(dev) fengxia@ubuntu:~$ juju list-controllers
Use --refresh flag with this command to see the latest information.

Controller  Model  User   Access Cloud/Region Models 
Machines    HA  Version
devlocal*   -  admin  superuser  localhost/localhost 2 1  
none  2.2.6


(dev) fengxia@ubuntu:~$ juju status
ERROR current model for controller devlocal not found
(dev) fengxia@ubuntu:~$ lxc list
+---+-+---+--++---+
| NAME  |  STATE  | IPV4  | IPV6 | TYPE    | 
SNAPSHOTS |

+---+-+---+--++---+
| juju-6f4281-0 | RUNNING | 10.175.135.196 (eth0) |  | PERSISTENT | 
0 |

+---+-+---+--++---+
| juju-7031bf-0 | RUNNING | 10.175.135.253 (eth0) |  | PERSISTENT | 
0 |

+---+-+---+--++---+
| juju-7031bf-1 | RUNNING | 10.175.135.247 (eth0) |  | PERSISTENT | 
0 |

+---+-+---+--++---+
| juju-7031bf-2 | RUNNING | 10.175.135.191 (eth0) |  | PERSISTENT | 
0 |

+---+-+---+--++---+
| juju-7031bf-3 | RUNNING | 10.175.135.116 (eth0) |  | PERSISTENT | 
0 |

+---+-+---+--++---+
| juju-7031bf-4 | RUNNING | 10.175.135.106 (eth0) |  | PERSISTENT | 
0 |

+---+-+---+--++---+
| juju-7031bf-5 | RUNNING | 10.175.135.128 (eth0) |  | PERSISTENT | 
0 |

+---+-+---+--++---+
| juju-7031bf-6 | RUNNING | 10.175.135.83 (eth0)  |  | PERSISTENT | 
0 |

+---+-+---+--++---+
| juju-7031bf-7 | RUNNING | 10.175.135.223 (eth0) |  | PERSISTENT | 
0 |

+---+-+---+--++---+

(dev) fengxia@ubuntu:~$ juju list-models
Controller: devlocal

Model   Cloud/Region Status Machines  Cores Access  Last 
connection

controller  localhost/localhost  available 1  - admin   just now
default localhost/localhost  available 8  - admin   11 
hours ago


--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: set_state not setting the state immediately

2017-10-31 Thread fengxia

Merlijn,

Nice summary of these issues. Especially for the #2, we have been using 
Ansible (called from charm) for executions. I think there are 3 points 
here:


1. confg mgt has solved idempotency, great!
2. many organizations have accumulated an asset of recipes using these 
config tools (puppet, chef, ansible, and so on)s. Being able to re-use 
them makes transition and adoption within these orgs easier.
3. Betting on technology. Puppet, chef, ansible all have/had their days. 
New things will inevitably emerge. Having two in the stack, though 
inefficient, mitigate risk. This is just sad reality.


Using an analogy. A charm is like a cooked dish prepared by a wonderful 
chef, tastes great, but few can do that at home yet. I have awed many by 
showing them how easy it is to deploy an Openstack with a click of 
button using Juju GUI. But ppl fear things they don't understand. Config 
mgt tools are like giving you a set of cooking utensils and a recipe 
book, you can follow the book, or be an iron chef yourself, and 
surprisingly, many believe they have that talent to be the iron chef, 
though over optimistically often ~~





On 10/30/2017 11:56 AM, Merlijn Sebrechts wrote:

Hi all


Great discussion in this thread. I sense there are two issues here:

1. The transactional nature of charms.reactive and Juju needs to be 
explained better 
<https://github.com/juju-solutions/charms.reactive/issues/137>. We 
can't change the transactional nature from the charms.reactive side 
since this is a Juju core feature, but we can provide a lot better 
docs and change function names to better match their actual behavior. 
This is already discussed for relationships as part of the Endpoint PR 
<https://github.com/juju-solutions/charms.reactive/pull/123>.
2. Idempotency is hard, not commonly understood outside of config mgmt 
community and charms.reactive isn't helping. 
<https://github.com/juju-solutions/charms.reactive/issues/138> Idempotency 
is a solved issue in config mgmt tools. I don't think it's the job of 
Juju and charms.reactive to provide ways to do this because we operate 
on a higher level (service orchestration, not config mgmt). What we 
should to is make it easier to use charms.reactive together with 
config mgmt tools like Puppet and Chef. This will keep us from 
reinventing the wheel and will provide a number of additional benefits 
(such as being able to leverage existing Puppet scripts and quicker 
charms).


Please create more issues if I've missed something, and add your 
comments to the issues.




Kind regards
Merlijn

2017-10-05 20:50 GMT+02:00 fengxia <fx...@lenovo.com 
<mailto:fx...@lenovo.com>>:


" An assumption is being made that the state changes get committed
immediately, but these changes are actually transactional and
following the same transactional behaviour as the Juju hook
environment [1]."

To chip in my experience as 6-month into learning charms and
writing a few simple charms.

1. The "transactional" nature of Juju hook needs better explained.
To be honest I have no idea what this means, and what implication
it has to a charm writer. Any reference would be helpful.

2. I like Mike Wilson's approach to provide a list of
"set_state_xxx" functions so new writer can better guess what this
function will do. Further, a different name calls for further
study why they are different, thus learning important concept of
whatever Juju thinks charm writer needs to understand.

Otherwise, I will expect "set_state" will set that state/flag
asap. If there is a scanning cycle (which I heard there is some
kind of 5-min cycle, which document has not sufficiently made it
clear to a writer either), charm writer needs to have better doc
to learn what it means for design. I came from embedded system
world in which a timer loop is common. It calls for a different
thinking than user space script user. I think such implication
should be emphasized more.

3. idempotent

Again, this is a concept me (or many new writer) will fail to
grasp. Looking at "apt install" as example, my reaction was that
the package manager is taking care of "doing nothing" if called
multiple times. But how this translate to my system in which charm
is expected to "do something"? Does it mean I need a gatekeeper
like the package manager so to guard these "multiple calls"?

Again, this feels like a work around because "set_state" will call
the same function block multiple times, which is unintuitive to
writer -- when I set a state, the action for that state is
executed once, not over and over again until I turn it off.
Further, even "remove_state" doesn't take effect immediately, so
it feels arbitrary how many cycles a block of code is executed.
This is a 

Re: juju 2.3.3 failing to bootstrap localhost

2018-02-21 Thread fengxia
Verified by login to the container. I could `apt update`, `apt install 
htop`.


At juju bootstrap terminal, I picked up this error message:

01:27:52 DEBUG juju.provider.common bootstrap.go:564 connection attempt 
for 10.170.


130.125 failed: WARNING: Your password has expired.
Password change required but no TTY available.

What does it mean? I looked at my user's password expiration settings on 
the host using `chage`:


(dev) fengxia@ubuntu:~$ sudo chage -l fengxia
Last password change                    : Dec 07, 2017
Password expires                    : never
Password inactive                    : never
Account expires                        : never
Minimum number of days between password change        : 0
Maximum number of days between password change        : 9
Number of days of warning before password expires    : 7

Looks like the password should be just fine.

Any other pointer would be highly appreciated.


On 02/21/2018 06:24 PM, Nicholas Skaggs wrote:

On 02/21/2018 04:47 PM, David Britton wrote:

On Wed, Feb 21, 2018 at 04:11:44PM -0500, fengxia wrote:

Hi Juju,

Is anyone seeing this? I'm running the same setup as yesterday's, then
updated `apt update && apt upgrade` this morning. All of a sudden `juju
bootstrap localhost ..` stuck at Attempting to connect. LXC 
container was

created and had an IP, but juju won't connect somehow?

1. Tried reconfiguring LXD to different network addresses, not helpful.

2. Made sure `.local/share/juju/ssh/juju_id_rsa` has mode 0600

Any idea what to try?

If you have your lxd container created, you can get access to it
directly:

lxc list
lxc exec  bash
# look in /var/log/cloud*, /var/log/juju/*,
# /var/log/syslog, etc for errors

Also, you can run your `juju bootstrap` in --debug mode, which gives a
lot more data.


Specifically make sure you can:

1) create an lxc container

2) ssh into the container

3) that container has proper connectivity, including the ability to 
install packages



Nicholas



--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


juju 2.3.3 failing to bootstrap localhost

2018-02-21 Thread fengxia

Hi Juju,

Is anyone seeing this? I'm running the same setup as yesterday's, then 
updated `apt update && apt upgrade` this morning. All of a sudden `juju 
bootstrap localhost ..` stuck at Attempting to connect. LXC container 
was created and had an IP, but juju won't connect somehow?


1. Tried reconfiguring LXD to different network addresses, not helpful.

2. Made sure `.local/share/juju/ssh/juju_id_rsa` has mode 0600

Any idea what to try?

--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: juju 2.3.3 failing to bootstrap localhost

2018-02-21 Thread fengxia

Here is a debug trace running via `juju bootstrap --show-log --debug



(dev) fengxia@ubuntu:~$ juju bootstrap localhost devlocal

Creating Juju controller "devlocal" on localhost/localhost
Looking for packaged Juju agent version 2.3.3 for amd64
To configure your system to better support LXD containers, please see: 
https://github.com/lxc/lxd/blob/master/doc/production-setup.md

Launching controller instance(s) on localhost/localhost...
 - juju-b88ca2-0 (arch=amd64)
Installing Juju agent on bootstrap instance
Fetching Juju GUI 2.11.3
Waiting for address
Attempting to connect to 10.170.130.158:22


On 02/21/2018 04:11 PM, fengxia wrote:

Hi Juju,

Is anyone seeing this? I'm running the same setup as yesterday's, then 
updated `apt update && apt upgrade` this morning. All of a sudden 
`juju bootstrap localhost ..` stuck at Attempting to connect. LXC 
container was created and had an IP, but juju won't connect somehow?


1. Tried reconfiguring LXD to different network addresses, not helpful.

2. Made sure `.local/share/juju/ssh/juju_id_rsa` has mode 0600

Any idea what to try?



--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


Re: juju 2.3.3 failing to bootstrap localhost

2018-02-21 Thread fengxia

Some progress. It's complaining about "password expired"? What does it mean?

Here is a debug trace running via `juju bootstrap --show-log --debug

----

(dev) fengxia@ubuntu:~$ juju bootstrap --show-log --debug localhost devlocal
21:17:23 INFO  juju.cmd supercommand.go:56 running juju [2.3.3 gc go1.9.2]
21:17:23 DEBUG juju.cmd supercommand.go:57   args: 
[]string{"/snap/juju/3452/bin/juju", "bootstrap", "--show-log", 
"--debug", "localhost", "devlocal"}
21:17:23 DEBUG juju.tools.lxdclient client.go:235 LXD snap socket not 
found, falling back to debian socket: "/var/lib/lxd"
21:17:23 DEBUG juju.tools.lxdclient client.go:252 connecting to LXD 
remote "local": "unix:///var/lib/lxd/unix.socket"
21:17:23 INFO  juju.tools.lxdclient client.go:306 using LXD API version 
"1.0"
21:17:23 INFO  juju.tools.lxdclient client.go:355 LXD "default" profile 
uses network bridge "lxdbr0"
21:17:23 INFO  cmd provider.go:189 Resolved LXD host address on bridge 
lxdbr0: 10.170.130.1:8443
21:17:23 INFO  cmd cloudcredential.go:51 no credentials found, checking 
environment
21:17:23 DEBUG juju.tools.lxdclient client.go:229 Using environment 
LXD_DIR as socket path: "/var/lib/lxd"
21:17:23 DEBUG juju.tools.lxdclient client.go:252 connecting to LXD 
remote "local": "unix:///var/lib/lxd/unix.socket"
21:17:23 INFO  juju.tools.lxdclient client.go:306 using LXD API version 
"1.0"
21:17:23 INFO  juju.tools.lxdclient client.go:355 LXD "default" profile 
uses network bridge "lxdbr0"
21:17:23 DEBUG juju.cmd.juju.commands bootstrap.go:835 authenticating 
with region "" and credential "localhost" ()

21:17:23 DEBUG juju.cmd.juju.commands bootstrap.go:963 provider attrs: map[]
21:17:24 INFO  cmd authkeys.go:114 Adding contents of 
"/home/fengxia/.local/share/juju/ssh/juju_id_rsa.pub" to authorized-keys
21:17:24 INFO  cmd authkeys.go:114 Adding contents of 
"/home/fengxia/.ssh/id_rsa.pub" to authorized-keys
21:17:24 DEBUG juju.cmd.juju.commands bootstrap.go:1019 preparing 
controller with config: map[default-series:xenial 
no-proxy:127.0.0.1,localhost,::1 ftp-proxy: 
update-status-hook-interval:5m https-proxy: 
enable-os-refresh-update:true apt-mirror: name:controller 
development:false max-status-history-size:5G image-stream:released 
max-action-results-age:336h proxy-ssh:false 
uuid:ffe164a4-5717-41eb-8531-6b1c7d460d42 net-bond-reconfigure-delay:17 
test-mode:false cloudinit-userdata: authorized-keys:ssh-rsa 
B3NzaC1yc2EDAQABAAABAQDFrgQso2OVedVHYDH3ey9bM/mHKvz45FDK1LCq9Ap+eLDanJObvCFzQvWRfZdOVPfsmdSbP3vKm0vetM/fqRrlWFQbg2A13WwC95hAXAbN0VpmI5kx7izWPGuN8rBX5EsgWZS9crZkS9jQ5Cri/5feGihbH4kqDr06+RzimFqu5qozl+SKCTJv30a25x0YxvKoxmnJPNra4xiPh6woDFro7c7+sW++fDTg1hgXoau5ldsDWOoreC3l2tCgX8A6tDuwe4fCAisMUzGBlfDVRBNGABx7WVe6hk9/gzmMVohsmnVkPYY1L5o/clDiztWJJuqSzZFNYPgjxDceBz/ONlPX 
juju-client-key
ssh-rsa 
B3NzaC1yc2EDAQABAAABAQCVAgY29fjJrLRtvCoYdvaGMrGdQXStURUn5b+BonX2+3UgCyE770kh8Ml7BCxwg8N46QdrERKxQBOharM6oUGXHpug4Svesh0ao74GqNd8O7Lc6Zm9QxTKH+fBhSt5zvkuQ5LG34pjYtPk2EouVDdnYlYMQf/z8ojaQUjoeX54beO7TciShyAgq6JdW7X326VY6uhiVkgi1bBLat3WjBn+X9wuMVdL7YTyM0vEBEudWNF5e9Hyh1owIfAxF6x6xMuMDd9ynfbvwOsLNFSsdMDHGImGL3mRtD8oOMOaVxfYr+d6v3jBWJewFvl2jhjGNoFKmQOvSZPZW1fdY/naJ7Wx 
fengxia@ubuntu
 apt-http-proxy: ignore-machine-addresses:false fan-config: 
logging-config: automatically-retry-hooks:true 
container-networking-method: provisioner-harvest-mode:destroyed 
resource-tags: max-status-history-age:336h type:lxd apt-ftp-proxy: 
apt-https-proxy: http-proxy: transmit-vendor-metrics:true 
firewall-mode:instance logforward-enabled:false enable-os-upgrade:true 
container-inherit-properties: agent-metadata-url: 
ssl-hostname-verification:true egress-subnets: 
max-action-results-size:5G image-metadata-url: 
disable-network-management:false apt-no-proxy: agent-stream:released]
21:17:24 DEBUG juju.tools.lxdclient client.go:229 Using environment 
LXD_DIR as socket path: "/var/lib/lxd"
21:17:24 DEBUG juju.tools.lxdclient client.go:252 connecting to LXD 
remote "remote": "10.170.130.1:8443"
21:17:24 INFO  juju.tools.lxdclient client.go:306 using LXD API version 
"1.0"
21:17:24 INFO  cmd bootstrap.go:508 Creating Juju controller "devlocal" 
on localhost/localhost
21:17:24 INFO  juju.cmd.juju.commands bootstrap.go:572 combined 
bootstrap constraints:
21:17:24 DEBUG juju.environs.bootstrap bootstrap.go:199 model 
"controller" supports service/machine networks: false
21:17:24 DEBUG juju.environs.bootstrap bootstrap.go:201 network 
management by juju enabled: true

21:17:24 INFO  cmd bootstrap.go:233 Loading image metadata
21:17:24 INFO  cmd bootstrap.go:303 Looking for packaged Juju agent 
version 2.3.3 for amd64
21:17:24 INFO  juju.environs.bootstrap tool

Re: bootstrap failed

2018-01-02 Thread fengxia

This is it! Thank you Chris.


On 12/21/2017 01:19 AM, Chris MacNaughton wrote:

SSH will refuse to use a key that is not protected, if you run ‘chmod 0600 
/home/fengxia/.local/share/juju/ssh/juju_id_rsa’, that error should go away.

Chris


On Dec 21, 2017, at 04:49, fengxia <fx...@lenovo.com> wrote:

/home/fengxia/.local/share/juju/ssh/juju_id_rsa


--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju


bootstrap failed

2017-12-20 Thread fengxia

Hi Juju,

First time catch this bootstrap error.

Symptom is that it will hang on "Attempting to connect to". I 
usually waited from 5-10min and Ctrl-c the process. This time I waited 
till it timed out.


Juju version: 2.3.1-xenial-amd64

What does this error mean? I have seen it a few times, sort of randomly 
however. So I never figured out what's the cause. Any pointer what I 
might be doing wrong?


--

Creating Juju controller "devlocal" on localhost/localhost
Loading image metadata
Looking for packaged Juju agent version 2.3.1 for amd64
Starting new instance for initial controller
To configure your system to better support LXD containers, please see: 
https://github.com/lxc/lxd/blob/master/doc/production-setup.md

Launching controller instance(s) on localhost/localhost...
 - juju-d05b8f-0 (arch=amd64)
Installing Juju agent on bootstrap instance
Fetching Juju GUI 2.11.1
Waiting for address
Attempting to connect to 10.175.135.109:22
ERROR failed to bootstrap model: waited for 20m0s without being able to 
connect: @@@

@ WARNING: UNPROTECTED PRIVATE KEY FILE!  @
@@@
Permissions 0755 for '/home/fengxia/.local/share/juju/ssh/juju_id_rsa' 
are too open.

It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/fengxia/.local/share/juju/ssh/juju_id_rsa": bad permissions
Permission denied (publickey).

--
Feng Xia

Advisory Engineer
Datacenter Group (DCG), Lenovo US
8000 Development Dr, Morrisiville, NC 27509
W: http://www.lenovo.com


--
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju